org-export: Fix bug with recursive file inclusion and relative paths
[org-mode/org-mode-NeilSmithlineMods.git] / testing / lisp / test-ob-emacs-lisp.el
bloba83e8e9e5b0c0655efe1f8b3186e9faec900bf20
1 ;;; test-ob-emacs-lisp.el
3 ;; Copyright (c) 2012 Free Software Foundation, Inc.
4 ;; Authors: Eric Schulte, Martyn Jago
6 ;; Released under the GNU General Public License version 3
7 ;; see: http://www.gnu.org/licenses/gpl-3.0.html
9 ;;;; Comments:
11 ;; Org-mode tests for ob-emacs-lisp.el live here
14 ;;; Code:
16 (let ((load-path (cons (expand-file-name
17 ".." (file-name-directory
18 (or load-file-name buffer-file-name)))
19 load-path)))
20 (require 'org-test)
21 (require 'org-test-ob-consts))
24 ;;; Tests
26 (ert-deftest ob-emacs-lisp/commented-last-block-line-no-var ()
27 (org-test-with-temp-text-in-file "
28 #+begin_src emacs-lisp
30 #+end_src"
31 (progn
32 (org-babel-next-src-block)
33 (org-ctrl-c-ctrl-c)
34 (should (re-search-forward "results:" nil t))
35 (forward-line)
36 (should
37 (string=
38 ""
39 (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
40 (org-test-with-temp-text-in-file "
41 #+begin_src emacs-lisp
42 \"some text\";;
43 #+end_src"
45 (progn
46 (org-babel-next-src-block)
47 (org-ctrl-c-ctrl-c)
48 (should (re-search-forward "results:" nil t))
49 (forward-line)
50 (should
51 (string=
52 ": some text"
53 (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))))
55 (ert-deftest ob-emacs-lisp/commented-last-block-line-with-var ()
56 (org-test-with-temp-text-in-file "
57 #+begin_src emacs-lisp :var a=1
59 #+end_src"
60 (progn
61 (org-babel-next-src-block)
62 (org-ctrl-c-ctrl-c)
63 (re-search-forward "results" nil t)
64 (forward-line)
65 (should (string=
66 ""
67 (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
68 (org-test-with-temp-text-in-file "
69 #+begin_src emacs-lisp :var a=2
70 2;;
71 #+end_src"
72 (progn
73 (org-babel-next-src-block)
74 (org-ctrl-c-ctrl-c)
75 (re-search-forward "results" nil t)
76 (forward-line)
77 (should (string=
78 ": 2"
79 (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))))
80 (provide 'test-ob-emacs-lisp)
82 ;;; test-ob-emacs-lisp.el ends here