test-ob-emacs-lisp.el 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. ;;; test-ob-emacs-lisp.el
  2. ;; Copyright (c) 2012 Free Software Foundation, Inc.
  3. ;; Authors: Eric Schulte, Martyn Jago
  4. ;; This file is not part of GNU Emacs.
  5. ;; This program is free software; you can redistribute it and/or modify
  6. ;; it under the terms of the GNU General Public License as published by
  7. ;; the Free Software Foundation, either version 3 of the License, or
  8. ;; (at your option) any later version.
  9. ;; This program is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. ;;; Comments:
  16. ;; Org-mode tests for ob-emacs-lisp.el live here
  17. ;;; Code:
  18. (ert-deftest ob-emacs-lisp/commented-last-block-line-no-var ()
  19. (org-test-with-temp-text-in-file "
  20. #+begin_src emacs-lisp
  21. ;;
  22. #+end_src"
  23. (progn
  24. (org-babel-next-src-block)
  25. (org-ctrl-c-ctrl-c)
  26. (should (re-search-forward "results:" nil t))
  27. (forward-line)
  28. (should
  29. (string=
  30. ""
  31. (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
  32. (org-test-with-temp-text-in-file "
  33. #+begin_src emacs-lisp
  34. \"some text\";;
  35. #+end_src"
  36. (progn
  37. (org-babel-next-src-block)
  38. (org-ctrl-c-ctrl-c)
  39. (should (re-search-forward "results:" nil t))
  40. (forward-line)
  41. (should
  42. (string=
  43. ": some text"
  44. (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))))
  45. (ert-deftest ob-emacs-lisp/commented-last-block-line-with-var ()
  46. (org-test-with-temp-text-in-file "
  47. #+begin_src emacs-lisp :var a=1
  48. ;;
  49. #+end_src"
  50. (progn
  51. (org-babel-next-src-block)
  52. (org-ctrl-c-ctrl-c)
  53. (re-search-forward "results" nil t)
  54. (forward-line)
  55. (should (string=
  56. ""
  57. (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
  58. (org-test-with-temp-text-in-file "
  59. #+begin_src emacs-lisp :var a=2
  60. 2;;
  61. #+end_src"
  62. (progn
  63. (org-babel-next-src-block)
  64. (org-ctrl-c-ctrl-c)
  65. (re-search-forward "results" nil t)
  66. (forward-line)
  67. (should (string=
  68. ": 2"
  69. (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))))
  70. (provide 'test-ob-emacs-lisp)
  71. ;;; test-ob-emacs-lisp.el ends here