test-ob-sh.el 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. ;;; test-ob-sh.el
  2. ;; Copyright (c) 2010 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. ;;;; Comments:
  7. ;; Template test file for Org-mode tests
  8. ;;; Code:
  9. (let ((load-path (cons (expand-file-name
  10. ".." (file-name-directory
  11. (or load-file-name buffer-file-name)))
  12. load-path)))
  13. (require 'org-test)
  14. (require 'org-test-ob-consts))
  15. ;;; Tests
  16. (ert-deftest test-ob-sh/dont-insert-spaces-on-expanded-bodies ()
  17. "Expanded shell bodies should not start with a blank line
  18. unless the body of the tangled block does."
  19. (should-not (string-match "^[\n\r][\t ]*[\n\r]"
  20. (org-babel-expand-body:sh "echo 2" '())))
  21. (should (string-match "^[\n\r][\t ]*[\n\r]"
  22. (org-babel-expand-body:sh "\n\necho 2" '()))))
  23. (ert-deftest test-ob-sh/dont-error-on-empty-results ()
  24. "Was throwing an elisp error when shell blocks threw errors and
  25. returned empty results."
  26. (should (null (org-babel-execute:sh "ls NoSuchFileOrDirectory.txt" nil))))
  27. (provide 'test-ob-sh)
  28. ;;; test-ob-sh.el ends here