forked from mirrors/org-mode
test-ob: Simplify a test
* testing/lisp/test-ob.el (test-org-babel/inline-src-blocks): Make test self-contained. Do not use `macrolet' either.
This commit is contained in:
parent
59da320b30
commit
d6377d7e11
|
@ -265,23 +265,45 @@ this is simple"
|
||||||
(should (= 14 (org-babel-execute-src-block)))))
|
(should (= 14 (org-babel-execute-src-block)))))
|
||||||
|
|
||||||
(ert-deftest test-org-babel/inline-src-blocks ()
|
(ert-deftest test-org-babel/inline-src-blocks ()
|
||||||
(macrolet ((at-next (&rest body)
|
(should
|
||||||
`(progn
|
(= 1
|
||||||
(move-end-of-line 1)
|
(org-test-with-temp-text
|
||||||
(re-search-forward org-babel-inline-src-block-regexp nil t)
|
"In the middle <point>src_emacs-lisp{(+ 0 1)} of a line"
|
||||||
(goto-char (match-beginning 1))
|
(org-babel-execute-src-block))))
|
||||||
(save-match-data ,@body))))
|
(should
|
||||||
(org-test-at-id
|
(= 2
|
||||||
"54cb8dc3-298c-4883-a933-029b3c9d4b18"
|
(org-test-with-temp-text
|
||||||
(at-next (should (equal 1 (org-babel-execute-src-block))))
|
"One at the end of a line: <point>src_emacs-lisp{(+ 1 1)}"
|
||||||
(at-next (should (equal 2 (org-babel-execute-src-block))))
|
(org-babel-execute-src-block))))
|
||||||
(at-next (should (equal 3 (org-babel-execute-src-block)))))
|
(should
|
||||||
(org-test-at-id
|
(= 3
|
||||||
"cd54fc88-1b6b-45b6-8511-4d8fa7fc8076"
|
(org-test-with-temp-text
|
||||||
(at-next (should (equal 1 (org-babel-execute-src-block))))
|
"src_emacs-lisp{(+ 2 1)} at the beginning of a line."
|
||||||
(at-next (should (equal 2 (org-babel-execute-src-block))))
|
(org-babel-execute-src-block))))
|
||||||
(at-next (should (equal 3 (org-babel-execute-src-block))))
|
(should
|
||||||
(at-next (should (equal 4 (org-babel-execute-src-block)))))))
|
(= 4
|
||||||
|
(org-test-with-temp-text
|
||||||
|
"In the middle <point>src_emacs-lisp[:results silent\
|
||||||
|
:exports code]{(+ 3 1)} of a line"
|
||||||
|
(org-babel-execute-src-block))))
|
||||||
|
(should
|
||||||
|
(= 5
|
||||||
|
(org-test-with-temp-text
|
||||||
|
"One at the end of a line: <point>src_emacs-lisp[:results silent\
|
||||||
|
:exports code]{(+ 4 1)}"
|
||||||
|
(org-babel-execute-src-block))))
|
||||||
|
(should
|
||||||
|
(= 6
|
||||||
|
(org-test-with-temp-text
|
||||||
|
"src_emacs-lisp[:results silent :exports code]{(+ 5 1)}\
|
||||||
|
at the beginning of a line."
|
||||||
|
(org-babel-execute-src-block))))
|
||||||
|
(should
|
||||||
|
(= 7
|
||||||
|
(org-test-with-temp-text
|
||||||
|
"One also evaluated: <point>src_emacs-lisp[:exports both\
|
||||||
|
:results silent]{(+ 6 1)}"
|
||||||
|
(org-babel-execute-src-block)))))
|
||||||
|
|
||||||
(ert-deftest test-org-babel/org-babel-get-inline-src-block-matches ()
|
(ert-deftest test-org-babel/org-babel-get-inline-src-block-matches ()
|
||||||
(flet ((test-at-id (id)
|
(flet ((test-at-id (id)
|
||||||
|
|
Loading…
Reference in New Issue