test-ob-sh.el 989 B

123456789101112131415161718192021222324252627282930
  1. ;;; test-ob-sh.el
  2. ;; Copyright (c) 2010-2012 Eric Schulte
  3. ;; Authors: Eric Schulte
  4. ;; Released under the GNU General Public License version 3
  5. ;; see: http://www.gnu.org/licenses/gpl-3.0.html
  6. ;; Template test file for Org-mode tests
  7. ;;; Code:
  8. (unless (featurep 'ob-sh)
  9. (signal 'missing-test-dependency "Support for Sh code blocks"))
  10. (ert-deftest test-ob-sh/dont-insert-spaces-on-expanded-bodies ()
  11. "Expanded shell bodies should not start with a blank line
  12. unless the body of the tangled block does."
  13. (should-not (string-match "^[\n\r][\t ]*[\n\r]"
  14. (org-babel-expand-body:generic "echo 2" '())))
  15. (should (string-match "^[\n\r][\t ]*[\n\r]"
  16. (org-babel-expand-body:generic "\n\necho 2" '()))))
  17. (ert-deftest test-ob-sh/dont-error-on-empty-results ()
  18. "Was throwing an elisp error when shell blocks threw errors and
  19. returned empty results."
  20. (should (null (org-babel-execute:sh "ls NoSuchFileOrDirectory.txt" nil))))
  21. (provide 'test-ob-sh)
  22. ;;; test-ob-sh.el ends here