test-ob-emacs-lisp.el 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. ;;; test-ob-emacs-lisp.el
  2. ;; Copyright (c) 2012 Free Software Foundation, Inc.
  3. ;; Authors: Eric Schulte, Martyn Jago
  4. ;; Released under the GNU General Public License version 3
  5. ;; see: http://www.gnu.org/licenses/gpl-3.0.html
  6. ;;;; Comments:
  7. ;; Org-mode tests for ob-emacs-lisp.el live here
  8. ;;; Code:
  9. (ert-deftest ob-emacs-lisp/commented-last-block-line-no-var ()
  10. (org-test-with-temp-text-in-file "
  11. #+begin_src emacs-lisp
  12. ;;
  13. #+end_src"
  14. (progn
  15. (org-babel-next-src-block)
  16. (org-ctrl-c-ctrl-c)
  17. (should (re-search-forward "results:" nil t))
  18. (forward-line)
  19. (should
  20. (string=
  21. ""
  22. (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
  23. (org-test-with-temp-text-in-file "
  24. #+begin_src emacs-lisp
  25. \"some text\";;
  26. #+end_src"
  27. (progn
  28. (org-babel-next-src-block)
  29. (org-ctrl-c-ctrl-c)
  30. (should (re-search-forward "results:" nil t))
  31. (forward-line)
  32. (should
  33. (string=
  34. ": some text"
  35. (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))))
  36. (ert-deftest ob-emacs-lisp/commented-last-block-line-with-var ()
  37. (org-test-with-temp-text-in-file "
  38. #+begin_src emacs-lisp :var a=1
  39. ;;
  40. #+end_src"
  41. (progn
  42. (org-babel-next-src-block)
  43. (org-ctrl-c-ctrl-c)
  44. (re-search-forward "results" nil t)
  45. (forward-line)
  46. (should (string=
  47. ""
  48. (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
  49. (org-test-with-temp-text-in-file "
  50. #+begin_src emacs-lisp :var a=2
  51. 2;;
  52. #+end_src"
  53. (progn
  54. (org-babel-next-src-block)
  55. (org-ctrl-c-ctrl-c)
  56. (re-search-forward "results" nil t)
  57. (forward-line)
  58. (should (string=
  59. ": 2"
  60. (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))))
  61. (provide 'test-ob-emacs-lisp)
  62. ;;; test-ob-emacs-lisp.el ends here