[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 6e0012867d 2/8: test-ob-shell.el: Refactor test-ob-
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 6e0012867d 2/8: test-ob-shell.el: Refactor test-ob-shell/session |
Date: |
Wed, 11 Jan 2023 11:58:07 -0500 (EST) |
branch: externals/org
commit 6e0012867d8594913cf4783d7afdc109b8307de3
Author: Matt Trzcinski <matt@excalamus.com>
Commit: Matt Trzcinski <matt@excalamus.com>
test-ob-shell.el: Refactor test-ob-shell/session
* testing/lisp/test-ob-shell.el (ob-shell/session): Split
`ob-shell/session' into
`test-ob-shell/session-single-return-returns-string' and
`test-ob-shell/session-multiple-returns-returns-list'.
(ob-shell/session): Rename comint from to test name. On
pass, kill process and remove process buffer.
---
testing/lisp/test-ob-shell.el | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/testing/lisp/test-ob-shell.el b/testing/lisp/test-ob-shell.el
index fc3ecd3c8f..b08bf84131 100644
--- a/testing/lisp/test-ob-shell.el
+++ b/testing/lisp/test-ob-shell.el
@@ -45,18 +45,28 @@ unless the body of the tangled block does."
(if (should (null (org-babel-execute:sh "ls NoSuchFileOrDirectory.txt" nil)))
(kill-buffer "*Org-Babel Error Output*")))
-(ert-deftest test-ob-shell/session ()
- "This also tests `org-babel-comint-with-output' in
-ob-comint.el, which was not previously tested."
- (let ((res (org-babel-execute:sh "echo 1; echo 2" '((:session . "yes")))))
- (should res)
- (should (listp res)))
- ;; Test multi-line input.
- (let ((result (org-babel-execute:sh
- "if true \n then \n echo yes \n fi"
- '((:session . "yes")))))
+(ert-deftest test-ob-shell/session-single-return-returns-string ()
+ "Sessions with a single result should return a string."
+ (let* ((session-name
"test-ob-shell/session-evaluation-single-return-returns-string")
+ (kill-buffer-query-functions nil)
+ (result (org-babel-execute:sh
+ (format "echo %s" session-name)
+ `((:session . ,session-name)))))
(should result)
- (should (string= "yes" result))))
+ (if (should (string= session-name result))
+ (kill-buffer session-name))))
+
+(ert-deftest test-ob-shell/session-multiple-returns-returns-list ()
+ "Sessions with multiple results should return a list."
+ (let* ((session-name "test-ob-shell/session-multiple-returns-returns-list")
+ (kill-buffer-query-functions nil)
+ (result (org-babel-execute:sh
+ "echo 1; echo 2"
+ `((:session . ,session-name)))))
+ (should result)
+ (should (listp result))
+ (if (should (equal '((1) (2)) result))
+ (kill-buffer session-name))))
; A list of tests using the samples in ob-shell-test.org
(ert-deftest ob-shell/generic-uses-no-arrays ()
- [elpa] externals/org updated (07c63df9c7 -> 4f319088ba), ELPA Syncer, 2023/01/11
- [elpa] externals/org 4f319088ba 8/8: Merge branch 'ob-shell-cleanup-tests', ELPA Syncer, 2023/01/11
- [elpa] externals/org e204c3a6cc 1/8: test-ob-shell.el: Split test-ob-shell/dont-error-on-empty-results, ELPA Syncer, 2023/01/11
- [elpa] externals/org 6e0012867d 2/8: test-ob-shell.el: Refactor test-ob-shell/session,
ELPA Syncer <=
- [elpa] externals/org 9485450222 6/8: ob-shell-test.org: Remove ob-shell-test.org, ELPA Syncer, 2023/01/11
- [elpa] externals/org 2a0f5a5153 4/8: Refactor ob-shell/bash-uses-assoc-arrays, ELPA Syncer, 2023/01/11
- [elpa] externals/org 9ed2821053 7/8: test-ob-shell.el: Organize tests, ELPA Syncer, 2023/01/11
- [elpa] externals/org 728e7fca81 3/8: test-ob-shell.el: Refactor ob-shell/generic-uses-no-assoc-arrays, ELPA Syncer, 2023/01/11
- [elpa] externals/org 3dbc7849a3 5/8: test-ob-shell.el: Refactor test names and kill test buffers, ELPA Syncer, 2023/01/11