Update copyright years again.
[org-mode.git] / testing / lisp / test-ob-sh.el
blob179d195b1915a7386ae1c82d9a0d78568084f5ee
1 ;;; test-ob-sh.el
3 ;; Copyright (c) 2010-2014 Eric Schulte
4 ;; Authors: Eric Schulte
6 ;; This file is not part of GNU Emacs.
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ;;; Comment:
23 ;; Template test file for Org-mode tests
25 ;;; Code:
26 (org-test-for-executable "sh")
27 (unless (featurep 'ob-sh)
28 (signal 'missing-test-dependency "Support for Sh code blocks"))
30 (ert-deftest test-ob-sh/dont-insert-spaces-on-expanded-bodies ()
31 "Expanded shell bodies should not start with a blank line
32 unless the body of the tangled block does."
33 (should-not (string-match "^[\n\r][\t ]*[\n\r]"
34 (org-babel-expand-body:generic "echo 2" '())))
35 (should (string-match "^[\n\r][\t ]*[\n\r]"
36 (org-babel-expand-body:generic "\n\necho 2" '()))))
38 (ert-deftest test-ob-sh/dont-error-on-empty-results ()
39 "Was throwing an elisp error when shell blocks threw errors and
40 returned empty results."
41 (should (null (org-babel-execute:sh "ls NoSuchFileOrDirectory.txt" nil))))
43 (ert-deftest test-ob-sh/session ()
44 "This also tests `org-babel-comint-with-output' in
45 ob-comint.el, which was not previously tested."
46 (let ((res (org-babel-execute:sh "echo 1; echo 2" '((:session . "yes")))))
47 (should res)
48 (should (listp res))))
50 (provide 'test-ob-sh)
52 ;;; test-ob-sh.el ends here