From d6377d7e1121b01ff7383a070229a3372a4686d0 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 26 May 2015 21:24:20 +0200 Subject: [PATCH] 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. --- testing/lisp/test-ob.el | 56 ++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el index 83b4d0075..2a929cd8f 100644 --- a/testing/lisp/test-ob.el +++ b/testing/lisp/test-ob.el @@ -265,23 +265,45 @@ this is simple" (should (= 14 (org-babel-execute-src-block))))) (ert-deftest test-org-babel/inline-src-blocks () - (macrolet ((at-next (&rest body) - `(progn - (move-end-of-line 1) - (re-search-forward org-babel-inline-src-block-regexp nil t) - (goto-char (match-beginning 1)) - (save-match-data ,@body)))) - (org-test-at-id - "54cb8dc3-298c-4883-a933-029b3c9d4b18" - (at-next (should (equal 1 (org-babel-execute-src-block)))) - (at-next (should (equal 2 (org-babel-execute-src-block)))) - (at-next (should (equal 3 (org-babel-execute-src-block))))) - (org-test-at-id - "cd54fc88-1b6b-45b6-8511-4d8fa7fc8076" - (at-next (should (equal 1 (org-babel-execute-src-block)))) - (at-next (should (equal 2 (org-babel-execute-src-block)))) - (at-next (should (equal 3 (org-babel-execute-src-block)))) - (at-next (should (equal 4 (org-babel-execute-src-block))))))) + (should + (= 1 + (org-test-with-temp-text + "In the middle src_emacs-lisp{(+ 0 1)} of a line" + (org-babel-execute-src-block)))) + (should + (= 2 + (org-test-with-temp-text + "One at the end of a line: src_emacs-lisp{(+ 1 1)}" + (org-babel-execute-src-block)))) + (should + (= 3 + (org-test-with-temp-text + "src_emacs-lisp{(+ 2 1)} at the beginning of a line." + (org-babel-execute-src-block)))) + (should + (= 4 + (org-test-with-temp-text + "In the middle 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: 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: 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 () (flet ((test-at-id (id)