test-ob-sh.el 1.1 KB

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