org-test.el (org-test-with-temp-text-in-file): Wrap ,@body into (progn ...).

* org-test.el (org-test-with-temp-text-in-file): Wrap ,@body
into (progn ...) so that tests don't have to wrap it themselves.

Fix the testing suite to use this.
Also fix formatting and trailing whitespaces.
Fix test-org-src/blank-line-block so that it
checks editing of a code block with a whitespace
with point on the #+begin_src line.

Thanks to Michael Brand for spotting the (progn ...) problem.
This commit is contained in:
Bastien Guerry 2012-12-15 08:49:23 +01:00
parent c8452bfca0
commit fa0e8feea8
5 changed files with 207 additions and 234 deletions

View File

@ -28,7 +28,6 @@
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; ;;
#+end_src" #+end_src"
(progn
(org-babel-next-src-block) (org-babel-next-src-block)
(org-ctrl-c-ctrl-c) (org-ctrl-c-ctrl-c)
(should (re-search-forward "results:" nil t)) (should (re-search-forward "results:" nil t))
@ -36,13 +35,12 @@
(should (should
(string= (string=
"" ""
(buffer-substring-no-properties (point-at-bol) (point-at-eol)))))) (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))
(org-test-with-temp-text-in-file " (org-test-with-temp-text-in-file "
#+begin_src emacs-lisp #+begin_src emacs-lisp
\"some text\";; \"some text\";;
#+end_src" #+end_src"
(progn
(org-babel-next-src-block) (org-babel-next-src-block)
(org-ctrl-c-ctrl-c) (org-ctrl-c-ctrl-c)
(should (re-search-forward "results:" nil t)) (should (re-search-forward "results:" nil t))
@ -50,14 +48,13 @@
(should (should
(string= (string=
": some text" ": some text"
(buffer-substring-no-properties (point-at-bol) (point-at-eol))))))) (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
(ert-deftest ob-emacs-lisp/commented-last-block-line-with-var () (ert-deftest ob-emacs-lisp/commented-last-block-line-with-var ()
(org-test-with-temp-text-in-file " (org-test-with-temp-text-in-file "
#+begin_src emacs-lisp :var a=1 #+begin_src emacs-lisp :var a=1
;; ;;
#+end_src" #+end_src"
(progn
(org-babel-next-src-block) (org-babel-next-src-block)
(org-ctrl-c-ctrl-c) (org-ctrl-c-ctrl-c)
(re-search-forward "results" nil t) (re-search-forward "results" nil t)
@ -65,18 +62,17 @@
(should (string= (should (string=
"" ""
(buffer-substring-no-properties (point-at-bol) (point-at-eol)))))) (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
(org-test-with-temp-text-in-file " (org-test-with-temp-text-in-file "
#+begin_src emacs-lisp :var a=2 #+begin_src emacs-lisp :var a=2
2;; 2;;
#+end_src" #+end_src"
(progn
(org-babel-next-src-block) (org-babel-next-src-block)
(org-ctrl-c-ctrl-c) (org-ctrl-c-ctrl-c)
(re-search-forward "results" nil t) (re-search-forward "results" nil t)
(forward-line) (forward-line)
(should (string= (should (string=
": 2" ": 2"
(buffer-substring-no-properties (point-at-bol) (point-at-eol))))))) (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))
(provide 'test-ob-emacs-lisp) (provide 'test-ob-emacs-lisp)
;;; test-ob-emacs-lisp.el ends here ;;; test-ob-emacs-lisp.el ends here

View File

@ -148,12 +148,10 @@
#+begin_src emacs-lisp #+begin_src emacs-lisp
prop prop
#+end_src" #+end_src"
(progn
(goto-char (point-min)) (goto-char (point-min))
(org-babel-next-src-block) (org-babel-next-src-block)
(let ((info (org-babel-get-src-block-info))) (let ((info (org-babel-get-src-block-info)))
(should (= 42 (org-babel-execute-src-block))))))) (should (= 42 (org-babel-execute-src-block))))))
(ert-deftest test-org-babel/simple-named-code-block () (ert-deftest test-org-babel/simple-named-code-block ()
"Test that simple named code blocks can be evaluated." "Test that simple named code blocks can be evaluated."
@ -163,10 +161,8 @@
#+begin_src emacs-lisp #+begin_src emacs-lisp
42 42
#+end_src" #+end_src"
(progn
(org-babel-next-src-block 1) (org-babel-next-src-block 1)
(should (= 42 (org-babel-execute-src-block)))))) (should (= 42 (org-babel-execute-src-block)))))
(ert-deftest test-org-babel/simple-variable-resolution () (ert-deftest test-org-babel/simple-variable-resolution ()
"Test that simple variable resolution is working." "Test that simple variable resolution is working."
@ -181,13 +177,12 @@
(length four) (length four)
#+end_src" #+end_src"
(progn
(org-babel-next-src-block 2) (org-babel-next-src-block 2)
(should (= 4 (org-babel-execute-src-block))) (should (= 4 (org-babel-execute-src-block)))
(forward-line 5) (forward-line 5)
(should (string= ": 4" (buffer-substring (should (string= ": 4" (buffer-substring
(point-at-bol) (point-at-bol)
(point-at-eol))))))) (point-at-eol))))))
(ert-deftest test-org-babel/multi-line-header-arguments () (ert-deftest test-org-babel/multi-line-header-arguments ()
"Test that multi-line header arguments and can be read." "Test that multi-line header arguments and can be read."
@ -202,11 +197,10 @@
(my-map 'list #'list numbers letters) (my-map 'list #'list numbers letters)
#+end_src" #+end_src"
(progn
(org-babel-next-src-block) (org-babel-next-src-block)
(let ((results (org-babel-execute-src-block))) (let ((results (org-babel-execute-src-block)))
(should(equal 'a (cadr (assoc 1 results)))) (should(equal 'a (cadr (assoc 1 results))))
(should(equal 'd (cadr (assoc 4 results)))))))) (should(equal 'd (cadr (assoc 4 results)))))))
(ert-deftest test-org-babel/parse-header-args () (ert-deftest test-org-babel/parse-header-args ()
(org-test-with-temp-text-in-file " (org-test-with-temp-text-in-file "
@ -215,17 +209,16 @@
the body the body
#+end_src" #+end_src"
(progn
(org-babel-next-src-block) (org-babel-next-src-block)
(let* ((info (org-babel-get-src-block-info)) (let* ((info (org-babel-get-src-block-info))
(params (nth 2 info))) (params (nth 2 info)))
(message "%S" params) (message "%S" params)
(should(equal "example-lang" (nth 0 info))) (should (equal "example-lang" (nth 0 info)))
(should(string= "the body" (org-babel-trim (nth 1 info)))) (should (string= "the body" (org-babel-trim (nth 1 info))))
(should-not (member '(:session\ \ \ \ ) params)) (should-not (member '(:session\ \ \ \ ) params))
(should(equal '(:session) (assoc :session params))) (should (equal '(:session) (assoc :session params)))
(should(equal '(:result-type . output) (assoc :result-type params))) (should (equal '(:result-type . output) (assoc :result-type params)))
(should(equal '(num . 9) (cdr (assoc :var params)))))))) (should (equal '(num . 9) (cdr (assoc :var params)))))))
(ert-deftest test-org-babel/parse-header-args2 () (ert-deftest test-org-babel/parse-header-args2 ()
(org-test-with-temp-text-in-file " (org-test-with-temp-text-in-file "
@ -247,11 +240,10 @@
:END: :END:
this is simple" this is simple"
(progn
(should (string-match (regexp-quote "this is simple") (should (string-match (regexp-quote "this is simple")
(org-babel-ref-resolve "simple-subtree"))) (org-babel-ref-resolve "simple-subtree")))
(org-babel-next-src-block) (org-babel-next-src-block)
(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 ()
(org-test-at-id "54cb8dc3-298c-4883-a933-029b3c9d4b18" (org-test-at-id "54cb8dc3-298c-4883-a933-029b3c9d4b18"
@ -321,7 +313,7 @@ this is simple"
(concat test-line " =1= =1=") (concat test-line " =1= =1=")
(buffer-substring-no-properties (point-at-bol) (point-at-eol)))) (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
(forward-char) (forward-char)
(should-error (org-ctrl-c-ctrl-c))))) (should-error (org-ctrl-c-ctrl-c))))))
(ert-deftest test-org-babel/inline-src_blk-default-results-replace-line-2 () (ert-deftest test-org-babel/inline-src_blk-default-results-replace-line-2 ()
;; src_ at bol line 2... ;; src_ at bol line 2...
@ -353,7 +345,7 @@ this is simple"
(concat test-line " =y= =y= end") (concat test-line " =y= =y= end")
(buffer-substring-no-properties (point-at-bol) (point-at-eol)))) (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
(forward-char) (forward-char)
(should-error (org-ctrl-c-ctrl-c)))))) (should-error (org-ctrl-c-ctrl-c)))))
(ert-deftest test-org-babel/inline-src_blk-manual-results-replace () (ert-deftest test-org-babel/inline-src_blk-manual-results-replace ()
(let ((test-line " src_emacs-lisp[:results replace]{ \"x\" }")) (let ((test-line " src_emacs-lisp[:results replace]{ \"x\" }"))
@ -700,7 +692,6 @@ on two lines
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; ;;
#+end_src" #+end_src"
(progn
(org-babel-next-src-block) (org-babel-next-src-block)
(org-ctrl-c-ctrl-c) (org-ctrl-c-ctrl-c)
(should (re-search-forward "\\#\\+results:" nil t)) (should (re-search-forward "\\#\\+results:" nil t))
@ -708,13 +699,11 @@ on two lines
(should (should
(string= (string=
"" ""
(buffer-substring-no-properties (point-at-bol) (point-at-eol)))))) (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))
(org-test-with-temp-text-in-file " (org-test-with-temp-text-in-file "
#+begin_src emacs-lisp #+begin_src emacs-lisp
\"some text\";; \"some text\";;
#+end_src" #+end_src"
(progn
(org-babel-next-src-block) (org-babel-next-src-block)
(org-ctrl-c-ctrl-c) (org-ctrl-c-ctrl-c)
(should (re-search-forward "\\#\\+results:" nil t)) (should (re-search-forward "\\#\\+results:" nil t))
@ -722,33 +711,31 @@ on two lines
(should (should
(string= (string=
": some text" ": some text"
(buffer-substring-no-properties (point-at-bol) (point-at-eol))))))) (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
(ert-deftest test-ob/commented-last-block-line-with-var () (ert-deftest test-ob/commented-last-block-line-with-var ()
(org-test-with-temp-text-in-file " (org-test-with-temp-text-in-file "
#+begin_src emacs-lisp :var a=1 #+begin_src emacs-lisp :var a=1
;; ;;
#+end_src" #+end_src"
(progn
(org-babel-next-src-block) (org-babel-next-src-block)
(org-ctrl-c-ctrl-c) (org-ctrl-c-ctrl-c)
(re-search-forward "\\#\\+results:" nil t) (re-search-forward "\\#\\+results:" nil t)
(forward-line) (forward-line)
(should (string= (should (string=
"" ""
(buffer-substring-no-properties (point-at-bol) (point-at-eol)))))) (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))
(org-test-with-temp-text-in-file " (org-test-with-temp-text-in-file "
#+begin_src emacs-lisp :var a=2 #+begin_src emacs-lisp :var a=2
2;; 2;;
#+end_src" #+end_src"
(progn
(org-babel-next-src-block) (org-babel-next-src-block)
(org-ctrl-c-ctrl-c) (org-ctrl-c-ctrl-c)
(re-search-forward "\\#\\+results:" nil t) (re-search-forward "\\#\\+results:" nil t)
(forward-line) (forward-line)
(should (string= (should (string=
": 2" ": 2"
(buffer-substring-no-properties (point-at-bol) (point-at-eol))))))) (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
(defun test-ob-verify-result-and-removed-result (result buffer-text) (defun test-ob-verify-result-and-removed-result (result buffer-text)
"Test helper function to test `org-babel-remove-result'. "Test helper function to test `org-babel-remove-result'.
@ -759,7 +746,6 @@ The block is actually executed /twice/ to ensure result
replacement happens correctly." replacement happens correctly."
(org-test-with-temp-text (org-test-with-temp-text
buffer-text buffer-text
(progn
(org-babel-next-src-block) (org-ctrl-c-ctrl-c) (org-ctrl-c-ctrl-c) (org-babel-next-src-block) (org-ctrl-c-ctrl-c) (org-ctrl-c-ctrl-c)
(should (re-search-forward "\\#\\+results:" nil t)) (should (re-search-forward "\\#\\+results:" nil t))
(forward-line) (forward-line)
@ -770,7 +756,7 @@ replacement happens correctly."
(org-babel-previous-src-block) (org-babel-remove-result) (org-babel-previous-src-block) (org-babel-remove-result)
(should (string= buffer-text (should (string= buffer-text
(buffer-substring-no-properties (buffer-substring-no-properties
(point-min) (point-max))))))) (point-min) (point-max))))))
(ert-deftest test-ob/org-babel-remove-result--results-default () (ert-deftest test-ob/org-babel-remove-result--results-default ()
"Test `org-babel-remove-result' with default :results." "Test `org-babel-remove-result' with default :results."
@ -778,7 +764,7 @@ replacement happens correctly."
(test-ob-verify-result-and-removed-result (test-ob-verify-result-and-removed-result
"\n" "\n"
(concat (concat
"* org-babel-remove-result "* org-babel-remove-result
#+begin_src " language " #+begin_src " language "
#+end_src #+end_src
@ -793,7 +779,7 @@ replacement happens correctly."
- 3 - 3
- (quote (4 5))" - (quote (4 5))"
"* org-babel-remove-result "* org-babel-remove-result
#+begin_src emacs-lisp :results list #+begin_src emacs-lisp :results list
'(1 2 3 '(4 5)) '(1 2 3 '(4 5))
#+end_src #+end_src
@ -834,7 +820,7 @@ trying to find the :END: marker."
(test-ob-verify-result-and-removed-result (test-ob-verify-result-and-removed-result
": \"I /am/ working!\"" ": \"I /am/ working!\""
"* org-babel-remove-result "* org-babel-remove-result
#+begin_src emacs-lisp :results pp #+begin_src emacs-lisp :results pp
\"I /am/ working!\") \"I /am/ working!\")
#+end_src #+end_src
@ -855,26 +841,24 @@ trying to find the :END: marker."
#+begin_src emacs-lisp :var a=1 #+begin_src emacs-lisp :var a=1
;; ;;
#+end_src" #+end_src"
(progn
(org-babel-next-src-block) (org-babel-next-src-block)
(org-ctrl-c-ctrl-c) (org-ctrl-c-ctrl-c)
(re-search-forward "\\#\\+results:" nil t) (re-search-forward "\\#\\+results:" nil t)
(forward-line) (forward-line)
(should (string= (should (string=
"" ""
(buffer-substring-no-properties (point-at-bol) (point-at-eol)))))) (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))
(org-test-with-temp-text-in-file " (org-test-with-temp-text-in-file "
#+begin_src emacs-lisp :var a=2 #+begin_src emacs-lisp :var a=2
2;; 2;;
#+end_src" #+end_src"
(progn
(org-babel-next-src-block) (org-babel-next-src-block)
(org-ctrl-c-ctrl-c) (org-ctrl-c-ctrl-c)
(re-search-forward "\\#\\+results:" nil t) (re-search-forward "\\#\\+results:" nil t)
(forward-line) (forward-line)
(should (string= (should (string=
": 2" ": 2"
(buffer-substring-no-properties (point-at-bol) (point-at-eol))))))) (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
(defun test-ob-verify-result-and-removed-result (result buffer-text) (defun test-ob-verify-result-and-removed-result (result buffer-text)
"Test helper function to test `org-babel-remove-result'. "Test helper function to test `org-babel-remove-result'.
@ -885,7 +869,6 @@ The block is actually executed /twice/ to ensure result
replacement happens correctly." replacement happens correctly."
(org-test-with-temp-text (org-test-with-temp-text
buffer-text buffer-text
(progn
(org-babel-next-src-block) (org-ctrl-c-ctrl-c) (org-ctrl-c-ctrl-c) (org-babel-next-src-block) (org-ctrl-c-ctrl-c) (org-ctrl-c-ctrl-c)
(should (re-search-forward "\\#\\+results:" nil t)) (should (re-search-forward "\\#\\+results:" nil t))
(forward-line) (forward-line)
@ -896,7 +879,7 @@ replacement happens correctly."
(org-babel-previous-src-block) (org-babel-remove-result) (org-babel-previous-src-block) (org-babel-remove-result)
(should (string= buffer-text (should (string= buffer-text
(buffer-substring-no-properties (buffer-substring-no-properties
(point-min) (point-max))))))) (point-min) (point-max))))))
(ert-deftest test-ob/org-babel-remove-result--results-default () (ert-deftest test-ob/org-babel-remove-result--results-default ()
"Test `org-babel-remove-result' with default :results." "Test `org-babel-remove-result' with default :results."
@ -904,7 +887,7 @@ replacement happens correctly."
(test-ob-verify-result-and-removed-result (test-ob-verify-result-and-removed-result
"\n" "\n"
(concat (concat
"* org-babel-remove-result "* org-babel-remove-result
#+begin_src " language " #+begin_src " language "
#+end_src #+end_src
@ -919,7 +902,7 @@ replacement happens correctly."
- 3 - 3
- (quote (4 5))" - (quote (4 5))"
"* org-babel-remove-result "* org-babel-remove-result
#+begin_src emacs-lisp :results list #+begin_src emacs-lisp :results list
'(1 2 3 '(4 5)) '(1 2 3 '(4 5))
#+end_src #+end_src
@ -950,7 +933,7 @@ hello there
content content
#+END_SRC" #+END_SRC"
"* org-babel-remove-result "* org-babel-remove-result
#+begin_src emacs-lisp :results org #+begin_src emacs-lisp :results org
\"* heading \"* heading
** subheading ** subheading
@ -966,7 +949,7 @@ content\"
<head><body></body></head> <head><body></body></head>
#+END_HTML" #+END_HTML"
"* org-babel-remove-result "* org-babel-remove-result
#+begin_src emacs-lisp :results html #+begin_src emacs-lisp :results html
\"<head><body></body></head>\" \"<head><body></body></head>\"
#+end_src #+end_src
@ -982,7 +965,7 @@ Line 2
Line 3 Line 3
#+END_LaTeX" #+END_LaTeX"
"* org-babel-remove-result "* org-babel-remove-result
#+begin_src emacs-lisp :results latex #+begin_src emacs-lisp :results latex
\"Line 1 \"Line 1
Line 2 Line 2
@ -999,7 +982,7 @@ Line 3\"
\"I am working!\" \"I am working!\"
#+END_SRC" #+END_SRC"
"* org-babel-remove-result "* org-babel-remove-result
#+begin_src emacs-lisp :results code #+begin_src emacs-lisp :results code
(message \"I am working!\") (message \"I am working!\")
#+end_src #+end_src
@ -1011,7 +994,7 @@ Line 3\"
(test-ob-verify-result-and-removed-result (test-ob-verify-result-and-removed-result
": \"I /am/ working!\"" ": \"I /am/ working!\""
"* org-babel-remove-result "* org-babel-remove-result
#+begin_src emacs-lisp :results pp #+begin_src emacs-lisp :results pp
\"I /am/ working!\") \"I /am/ working!\")
#+end_src #+end_src
@ -1060,8 +1043,8 @@ Line 3\"
(org-test-with-temp-text "#+BEGIN_SRC emacs-lisp (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp
\(+ 1 2) \(+ 1 2)
#+END_SRC\n\n\n" #+END_SRC\n\n\n"
(progn (org-babel-execute-src-block) (org-babel-execute-src-block)
(buffer-string)))))) (buffer-string)))))
(ert-deftest test-ob/results-in-narrowed-buffer () (ert-deftest test-ob/results-in-narrowed-buffer ()
"Test block execution in a narrowed buffer." "Test block execution in a narrowed buffer."
@ -1072,19 +1055,17 @@ Line 3\"
"#+BEGIN_SRC emacs-lisp\n(+ 1 2)\n#+END_SRC\n\n#+RESULTS:\n: 3" "#+BEGIN_SRC emacs-lisp\n(+ 1 2)\n#+END_SRC\n\n#+RESULTS:\n: 3"
(org-test-with-temp-text (org-test-with-temp-text
"#+BEGIN_SRC emacs-lisp\n(+ 1 2)\n#+END_SRC\n\nParagraph" "#+BEGIN_SRC emacs-lisp\n(+ 1 2)\n#+END_SRC\n\nParagraph"
(progn
(narrow-to-region (point) (save-excursion (forward-line 3) (point))) (narrow-to-region (point) (save-excursion (forward-line 3) (point)))
(org-babel-execute-src-block) (org-babel-execute-src-block)
(org-trim (buffer-string)))))) (org-trim (buffer-string)))))
(should (should
(equal (equal
"#+NAME: test\n#+BEGIN_SRC emacs-lisp\n(+ 1 2)\n#+END_SRC\n\n#+RESULTS: test\n: 3" "#+NAME: test\n#+BEGIN_SRC emacs-lisp\n(+ 1 2)\n#+END_SRC\n\n#+RESULTS: test\n: 3"
(org-test-with-temp-text (org-test-with-temp-text
"#+NAME: test\n#+BEGIN_SRC emacs-lisp\n(+ 1 2)\n#+END_SRC\n\nParagraph" "#+NAME: test\n#+BEGIN_SRC emacs-lisp\n(+ 1 2)\n#+END_SRC\n\nParagraph"
(progn
(narrow-to-region (point) (save-excursion (forward-line 4) (point))) (narrow-to-region (point) (save-excursion (forward-line 4) (point)))
(org-babel-execute-src-block) (org-babel-execute-src-block)
(org-trim (buffer-string)))))) (org-trim (buffer-string)))))
;; Results in visible part of buffer, should be updated here. ;; Results in visible part of buffer, should be updated here.
(should (should
(equal (equal
@ -1105,10 +1086,9 @@ Line 3\"
: 4 : 4
Paragraph" Paragraph"
(progn
(narrow-to-region (point) (save-excursion (forward-line 7) (point))) (narrow-to-region (point) (save-excursion (forward-line 7) (point)))
(org-babel-execute-src-block) (org-babel-execute-src-block)
(org-trim (buffer-string)))))) (org-trim (buffer-string)))))
;; Results in invisible part of buffer, should be updated there. ;; Results in invisible part of buffer, should be updated there.
(org-test-with-temp-text (org-test-with-temp-text
"#+NAME: test "#+NAME: test
@ -1120,12 +1100,11 @@ Paragraph"
: 4 : 4
Paragraph" Paragraph"
(progn
(narrow-to-region (point) (save-excursion (forward-line 4) (point))) (narrow-to-region (point) (save-excursion (forward-line 4) (point)))
(org-babel-execute-src-block) (org-babel-execute-src-block)
(should-not (re-search-forward "^#\\+RESULTS:" nil t)) (should-not (re-search-forward "^#\\+RESULTS:" nil t))
(widen) (widen)
(should (should (re-search-forward "^: 3" nil t)))))) (should (should (re-search-forward "^: 3" nil t)))))
(provide 'test-ob) (provide 'test-ob)

View File

@ -86,8 +86,7 @@
#+end_src #+end_src
" "
(progn (goto-line 2)
(goto-line 3)
(org-edit-special) (org-edit-special)
(insert "blah") (insert "blah")
(org-edit-src-exit) (org-edit-src-exit)
@ -95,7 +94,7 @@
#+begin_src emacs-lisp #+begin_src emacs-lisp
blah blah
#+end_src #+end_src
"))))) "))))
(provide 'test-org-src) (provide 'test-org-src)
;;; test-org-src.el ends here ;;; test-org-src.el ends here

View File

@ -72,12 +72,11 @@
| | | |
#+TBLFM: $1=vsum(@1..@-1) #+TBLFM: $1=vsum(@1..@-1)
" "
(progn
(re-search-forward (regexp-quote "#+tblname: simple-formula") nil t) (re-search-forward (regexp-quote "#+tblname: simple-formula") nil t)
(forward-line 1) (forward-line 1)
(should (org-at-table-p)) (should (org-at-table-p))
(should (org-table-recalculate 'all)) (should (org-table-recalculate 'all))
(should (string= "10" (first (nth 5 (org-table-to-lisp)))))))) (should (string= "10" (first (nth 5 (org-table-to-lisp)))))))
(provide 'test-org-table) (provide 'test-org-table)

View File

@ -214,7 +214,7 @@ otherwise place the point at the beginning of the inserted text."
(with-temp-file ,file (insert ,inside-text)) (with-temp-file ,file (insert ,inside-text))
(find-file ,file) (find-file ,file)
(org-mode) (org-mode)
(setq ,results ,@body) (setq ,results (progn ,@body))
(save-buffer) (kill-buffer (current-buffer)) (save-buffer) (kill-buffer (current-buffer))
(delete-file ,file) (delete-file ,file)
,results))) ,results)))