summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-12-15 08:49:23 +0100
committerBastien Guerry <bzg@altern.org>2012-12-15 08:49:23 +0100
commitfa0e8feea862e7998ed7bfcf90044c8808d1e2cb (patch)
treef4cb47befbeacd9fca7a402f9ec08b5c7080ede3
parentc8452bfca08a834a4dc452de6040e0956d3770e3 (diff)
downloadorg-mode-fa0e8feea862e7998ed7bfcf90044c8808d1e2cb.tar.gz
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.
-rw-r--r--testing/lisp/test-ob-emacs-lisp.el66
-rw-r--r--testing/lisp/test-ob.el331
-rw-r--r--testing/lisp/test-org-src.el27
-rw-r--r--testing/lisp/test-org-table.el11
-rw-r--r--testing/org-test.el6
5 files changed, 207 insertions, 234 deletions
diff --git a/testing/lisp/test-ob-emacs-lisp.el b/testing/lisp/test-ob-emacs-lisp.el
index 7375e8b..98f9d7a 100644
--- a/testing/lisp/test-ob-emacs-lisp.el
+++ b/testing/lisp/test-ob-emacs-lisp.el
@@ -28,55 +28,51 @@
#+begin_src emacs-lisp
;;
#+end_src"
- (progn
- (org-babel-next-src-block)
- (org-ctrl-c-ctrl-c)
- (should (re-search-forward "results:" nil t))
- (forward-line)
- (should
- (string=
- ""
- (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
+ (org-babel-next-src-block)
+ (org-ctrl-c-ctrl-c)
+ (should (re-search-forward "results:" nil t))
+ (forward-line)
+ (should
+ (string=
+ ""
+ (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))
(org-test-with-temp-text-in-file "
#+begin_src emacs-lisp
\"some text\";;
#+end_src"
- (progn
- (org-babel-next-src-block)
- (org-ctrl-c-ctrl-c)
- (should (re-search-forward "results:" nil t))
- (forward-line)
- (should
- (string=
- ": some text"
- (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))))
+ (org-babel-next-src-block)
+ (org-ctrl-c-ctrl-c)
+ (should (re-search-forward "results:" nil t))
+ (forward-line)
+ (should
+ (string=
+ ": some text"
+ (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
(ert-deftest ob-emacs-lisp/commented-last-block-line-with-var ()
(org-test-with-temp-text-in-file "
#+begin_src emacs-lisp :var a=1
;;
#+end_src"
- (progn
- (org-babel-next-src-block)
- (org-ctrl-c-ctrl-c)
- (re-search-forward "results" nil t)
- (forward-line)
- (should (string=
- ""
- (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
- (org-test-with-temp-text-in-file "
+ (org-babel-next-src-block)
+ (org-ctrl-c-ctrl-c)
+ (re-search-forward "results" nil t)
+ (forward-line)
+ (should (string=
+ ""
+ (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
+(org-test-with-temp-text-in-file "
#+begin_src emacs-lisp :var a=2
2;;
#+end_src"
- (progn
- (org-babel-next-src-block)
- (org-ctrl-c-ctrl-c)
- (re-search-forward "results" nil t)
- (forward-line)
- (should (string=
- ": 2"
- (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))))
+ (org-babel-next-src-block)
+ (org-ctrl-c-ctrl-c)
+ (re-search-forward "results" nil t)
+ (forward-line)
+ (should (string=
+ ": 2"
+ (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))
(provide 'test-ob-emacs-lisp)
;;; test-ob-emacs-lisp.el ends here
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index 6a2c914..5182458 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -148,12 +148,10 @@
#+begin_src emacs-lisp
prop
#+end_src"
-
- (progn
- (goto-char (point-min))
- (org-babel-next-src-block)
- (let ((info (org-babel-get-src-block-info)))
- (should (= 42 (org-babel-execute-src-block)))))))
+ (goto-char (point-min))
+ (org-babel-next-src-block)
+ (let ((info (org-babel-get-src-block-info)))
+ (should (= 42 (org-babel-execute-src-block))))))
(ert-deftest test-org-babel/simple-named-code-block ()
"Test that simple named code blocks can be evaluated."
@@ -163,10 +161,8 @@
#+begin_src emacs-lisp
42
#+end_src"
-
- (progn
- (org-babel-next-src-block 1)
- (should (= 42 (org-babel-execute-src-block))))))
+ (org-babel-next-src-block 1)
+ (should (= 42 (org-babel-execute-src-block)))))
(ert-deftest test-org-babel/simple-variable-resolution ()
"Test that simple variable resolution is working."
@@ -181,13 +177,12 @@
(length four)
#+end_src"
- (progn
- (org-babel-next-src-block 2)
- (should (= 4 (org-babel-execute-src-block)))
- (forward-line 5)
- (should (string= ": 4" (buffer-substring
- (point-at-bol)
- (point-at-eol)))))))
+ (org-babel-next-src-block 2)
+ (should (= 4 (org-babel-execute-src-block)))
+ (forward-line 5)
+ (should (string= ": 4" (buffer-substring
+ (point-at-bol)
+ (point-at-eol))))))
(ert-deftest test-org-babel/multi-line-header-arguments ()
"Test that multi-line header arguments and can be read."
@@ -202,11 +197,10 @@
(my-map 'list #'list numbers letters)
#+end_src"
- (progn
- (org-babel-next-src-block)
- (let ((results (org-babel-execute-src-block)))
- (should(equal 'a (cadr (assoc 1 results))))
- (should(equal 'd (cadr (assoc 4 results))))))))
+ (org-babel-next-src-block)
+ (let ((results (org-babel-execute-src-block)))
+ (should(equal 'a (cadr (assoc 1 results))))
+ (should(equal 'd (cadr (assoc 4 results)))))))
(ert-deftest test-org-babel/parse-header-args ()
(org-test-with-temp-text-in-file "
@@ -215,17 +209,16 @@
the body
#+end_src"
- (progn
- (org-babel-next-src-block)
- (let* ((info (org-babel-get-src-block-info))
- (params (nth 2 info)))
- (message "%S" params)
- (should(equal "example-lang" (nth 0 info)))
- (should(string= "the body" (org-babel-trim (nth 1 info))))
- (should-not (member '(:session\ \ \ \ ) params))
- (should(equal '(:session) (assoc :session params)))
- (should(equal '(:result-type . output) (assoc :result-type params)))
- (should(equal '(num . 9) (cdr (assoc :var params))))))))
+ (org-babel-next-src-block)
+ (let* ((info (org-babel-get-src-block-info))
+ (params (nth 2 info)))
+ (message "%S" params)
+ (should (equal "example-lang" (nth 0 info)))
+ (should (string= "the body" (org-babel-trim (nth 1 info))))
+ (should-not (member '(:session\ \ \ \ ) params))
+ (should (equal '(:session) (assoc :session params)))
+ (should (equal '(:result-type . output) (assoc :result-type params)))
+ (should (equal '(num . 9) (cdr (assoc :var params)))))))
(ert-deftest test-org-babel/parse-header-args2 ()
(org-test-with-temp-text-in-file "
@@ -247,20 +240,19 @@
:END:
this is simple"
- (progn
- (should (string-match (regexp-quote "this is simple")
- (org-babel-ref-resolve "simple-subtree")))
- (org-babel-next-src-block)
- (should (= 14 (org-babel-execute-src-block))))))
+ (should (string-match (regexp-quote "this is simple")
+ (org-babel-ref-resolve "simple-subtree")))
+ (org-babel-next-src-block)
+ (should (= 14 (org-babel-execute-src-block)))))
(ert-deftest test-org-babel/inline-src-blocks ()
(org-test-at-id "54cb8dc3-298c-4883-a933-029b3c9d4b18"
(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))))
+ `(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))))
(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)))))))
@@ -309,19 +301,19 @@ this is simple"
(buffer-substring-no-properties (point-at-bol) (point-at-eol)))))
;; src_ follows space line 1...
(let ((test-line " src_emacs-lisp{ 1 }"))
- (org-test-with-temp-text
- test-line
- (should-error (org-ctrl-c-ctrl-c))
- (forward-char) (org-ctrl-c-ctrl-c)
- (should (string=
- (concat test-line " =1=")
- (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
- (re-search-forward "{ 1 ") (org-ctrl-c-ctrl-c)
- (should (string=
- (concat test-line " =1= =1=")
- (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
- (forward-char)
- (should-error (org-ctrl-c-ctrl-c)))))
+ (org-test-with-temp-text
+ test-line
+ (should-error (org-ctrl-c-ctrl-c))
+ (forward-char) (org-ctrl-c-ctrl-c)
+ (should (string=
+ (concat test-line " =1=")
+ (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
+ (re-search-forward "{ 1 ") (org-ctrl-c-ctrl-c)
+ (should (string=
+ (concat test-line " =1= =1=")
+ (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
+ (forward-char)
+ (should-error (org-ctrl-c-ctrl-c))))))
(ert-deftest test-org-babel/inline-src_blk-default-results-replace-line-2 ()
;; src_ at bol line 2...
@@ -346,14 +338,14 @@ this is simple"
(insert (concat "\n" test-line " end"))
(re-search-backward "src") (org-ctrl-c-ctrl-c)
(should (string=
- (concat test-line " =y= end")
- (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
+ (concat test-line " =y= end")
+ (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
(re-search-forward "\" ") (org-ctrl-c-ctrl-c)
(should (string=
(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)
- (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 ()
(let ((test-line " src_emacs-lisp[:results replace]{ \"x\" }"))
@@ -637,15 +629,15 @@ on two lines
(ert-deftest test-ob/eval-header-argument ()
(flet ((check-eval (eval runp)
- (org-test-with-temp-text (format "#+begin_src emacs-lisp :eval %s
+ (org-test-with-temp-text (format "#+begin_src emacs-lisp :eval %s
(setq foo :evald)
#+end_src" eval)
- (let ((foo :not-run))
- (if runp
- (progn (should (org-babel-execute-src-block))
- (should (eq foo :evald)))
- (progn (should-not (org-babel-execute-src-block))
- (should-not (eq foo :evald))))))))
+ (let ((foo :not-run))
+ (if runp
+ (progn (should (org-babel-execute-src-block))
+ (should (eq foo :evald)))
+ (progn (should-not (org-babel-execute-src-block))
+ (should-not (eq foo :evald))))))))
(check-eval "never" nil)
(check-eval "no" nil)
(check-eval "never-export" t)
@@ -700,55 +692,50 @@ on two lines
#+begin_src emacs-lisp
;;
#+end_src"
- (progn
- (org-babel-next-src-block)
- (org-ctrl-c-ctrl-c)
- (should (re-search-forward "\\#\\+results:" nil t))
- (forward-line)
- (should
- (string=
- ""
- (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
+ (org-babel-next-src-block)
+ (org-ctrl-c-ctrl-c)
+ (should (re-search-forward "\\#\\+results:" nil t))
+ (forward-line)
+ (should
+ (string=
+ ""
+ (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))
(org-test-with-temp-text-in-file "
#+begin_src emacs-lisp
\"some text\";;
#+end_src"
-
- (progn
- (org-babel-next-src-block)
- (org-ctrl-c-ctrl-c)
- (should (re-search-forward "\\#\\+results:" nil t))
- (forward-line)
- (should
- (string=
- ": some text"
- (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))))
+ (org-babel-next-src-block)
+ (org-ctrl-c-ctrl-c)
+ (should (re-search-forward "\\#\\+results:" nil t))
+ (forward-line)
+ (should
+ (string=
+ ": some text"
+ (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
(ert-deftest test-ob/commented-last-block-line-with-var ()
(org-test-with-temp-text-in-file "
#+begin_src emacs-lisp :var a=1
;;
#+end_src"
- (progn
- (org-babel-next-src-block)
- (org-ctrl-c-ctrl-c)
- (re-search-forward "\\#\\+results:" nil t)
- (forward-line)
- (should (string=
- ""
- (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
+ (org-babel-next-src-block)
+ (org-ctrl-c-ctrl-c)
+ (re-search-forward "\\#\\+results:" nil t)
+ (forward-line)
+ (should (string=
+ ""
+ (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))
(org-test-with-temp-text-in-file "
#+begin_src emacs-lisp :var a=2
2;;
#+end_src"
- (progn
- (org-babel-next-src-block)
- (org-ctrl-c-ctrl-c)
- (re-search-forward "\\#\\+results:" nil t)
- (forward-line)
- (should (string=
- ": 2"
- (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))))
+ (org-babel-next-src-block)
+ (org-ctrl-c-ctrl-c)
+ (re-search-forward "\\#\\+results:" nil t)
+ (forward-line)
+ (should (string=
+ ": 2"
+ (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
(defun test-ob-verify-result-and-removed-result (result buffer-text)
"Test helper function to test `org-babel-remove-result'.
@@ -759,18 +746,17 @@ The block is actually executed /twice/ to ensure result
replacement happens correctly."
(org-test-with-temp-text
buffer-text
- (progn
- (org-babel-next-src-block) (org-ctrl-c-ctrl-c) (org-ctrl-c-ctrl-c)
- (should (re-search-forward "\\#\\+results:" nil t))
- (forward-line)
- (should (string= result
- (buffer-substring-no-properties
- (point-at-bol)
- (- (point-max) 16))))
- (org-babel-previous-src-block) (org-babel-remove-result)
- (should (string= buffer-text
- (buffer-substring-no-properties
- (point-min) (point-max)))))))
+ (org-babel-next-src-block) (org-ctrl-c-ctrl-c) (org-ctrl-c-ctrl-c)
+ (should (re-search-forward "\\#\\+results:" nil t))
+ (forward-line)
+ (should (string= result
+ (buffer-substring-no-properties
+ (point-at-bol)
+ (- (point-max) 16))))
+ (org-babel-previous-src-block) (org-babel-remove-result)
+ (should (string= buffer-text
+ (buffer-substring-no-properties
+ (point-min) (point-max))))))
(ert-deftest test-ob/org-babel-remove-result--results-default ()
"Test `org-babel-remove-result' with default :results."
@@ -778,7 +764,7 @@ replacement happens correctly."
(test-ob-verify-result-and-removed-result
"\n"
(concat
-"* org-babel-remove-result
+ "* org-babel-remove-result
#+begin_src " language "
#+end_src
@@ -793,7 +779,7 @@ replacement happens correctly."
- 3
- (quote (4 5))"
-"* org-babel-remove-result
+ "* org-babel-remove-result
#+begin_src emacs-lisp :results list
'(1 2 3 '(4 5))
#+end_src
@@ -805,7 +791,7 @@ replacement happens correctly."
If not inserted correctly then the second evaluation will fail
trying to find the :END: marker."
(org-test-with-temp-text
- "- indented
+ "- indented
#+begin_src sh :results file wrap
echo test.txt
#+end_src"
@@ -834,7 +820,7 @@ trying to find the :END: marker."
(test-ob-verify-result-and-removed-result
": \"I /am/ working!\""
-"* org-babel-remove-result
+ "* org-babel-remove-result
#+begin_src emacs-lisp :results pp
\"I /am/ working!\")
#+end_src
@@ -855,26 +841,24 @@ trying to find the :END: marker."
#+begin_src emacs-lisp :var a=1
;;
#+end_src"
- (progn
- (org-babel-next-src-block)
- (org-ctrl-c-ctrl-c)
- (re-search-forward "\\#\\+results:" nil t)
- (forward-line)
- (should (string=
- ""
- (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
+ (org-babel-next-src-block)
+ (org-ctrl-c-ctrl-c)
+ (re-search-forward "\\#\\+results:" nil t)
+ (forward-line)
+ (should (string=
+ ""
+ (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))
(org-test-with-temp-text-in-file "
#+begin_src emacs-lisp :var a=2
2;;
#+end_src"
- (progn
- (org-babel-next-src-block)
- (org-ctrl-c-ctrl-c)
- (re-search-forward "\\#\\+results:" nil t)
- (forward-line)
- (should (string=
- ": 2"
- (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))))
+ (org-babel-next-src-block)
+ (org-ctrl-c-ctrl-c)
+ (re-search-forward "\\#\\+results:" nil t)
+ (forward-line)
+ (should (string=
+ ": 2"
+ (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
(defun test-ob-verify-result-and-removed-result (result buffer-text)
"Test helper function to test `org-babel-remove-result'.
@@ -885,18 +869,17 @@ The block is actually executed /twice/ to ensure result
replacement happens correctly."
(org-test-with-temp-text
buffer-text
- (progn
- (org-babel-next-src-block) (org-ctrl-c-ctrl-c) (org-ctrl-c-ctrl-c)
- (should (re-search-forward "\\#\\+results:" nil t))
- (forward-line)
- (should (string= result
- (buffer-substring-no-properties
- (point-at-bol)
- (- (point-max) 16))))
- (org-babel-previous-src-block) (org-babel-remove-result)
- (should (string= buffer-text
- (buffer-substring-no-properties
- (point-min) (point-max)))))))
+ (org-babel-next-src-block) (org-ctrl-c-ctrl-c) (org-ctrl-c-ctrl-c)
+ (should (re-search-forward "\\#\\+results:" nil t))
+ (forward-line)
+ (should (string= result
+ (buffer-substring-no-properties
+ (point-at-bol)
+ (- (point-max) 16))))
+ (org-babel-previous-src-block) (org-babel-remove-result)
+ (should (string= buffer-text
+ (buffer-substring-no-properties
+ (point-min) (point-max))))))
(ert-deftest test-ob/org-babel-remove-result--results-default ()
"Test `org-babel-remove-result' with default :results."
@@ -904,7 +887,7 @@ replacement happens correctly."
(test-ob-verify-result-and-removed-result
"\n"
(concat
-"* org-babel-remove-result
+ "* org-babel-remove-result
#+begin_src " language "
#+end_src
@@ -919,7 +902,7 @@ replacement happens correctly."
- 3
- (quote (4 5))"
-"* org-babel-remove-result
+ "* org-babel-remove-result
#+begin_src emacs-lisp :results list
'(1 2 3 '(4 5))
#+end_src
@@ -933,7 +916,7 @@ replacement happens correctly."
hello there
:END:"
- "* org-babel-remove-result
+ "* org-babel-remove-result
#+begin_src emacs-lisp :results wrap
\"hello there\"
@@ -950,7 +933,7 @@ hello there
content
#+END_SRC"
-"* org-babel-remove-result
+ "* org-babel-remove-result
#+begin_src emacs-lisp :results org
\"* heading
** subheading
@@ -966,7 +949,7 @@ content\"
<head><body></body></head>
#+END_HTML"
-"* org-babel-remove-result
+ "* org-babel-remove-result
#+begin_src emacs-lisp :results html
\"<head><body></body></head>\"
#+end_src
@@ -982,7 +965,7 @@ Line 2
Line 3
#+END_LaTeX"
-"* org-babel-remove-result
+ "* org-babel-remove-result
#+begin_src emacs-lisp :results latex
\"Line 1
Line 2
@@ -999,7 +982,7 @@ Line 3\"
\"I am working!\"
#+END_SRC"
-"* org-babel-remove-result
+ "* org-babel-remove-result
#+begin_src emacs-lisp :results code
(message \"I am working!\")
#+end_src
@@ -1011,7 +994,7 @@ Line 3\"
(test-ob-verify-result-and-removed-result
": \"I /am/ working!\""
-"* org-babel-remove-result
+ "* org-babel-remove-result
#+begin_src emacs-lisp :results pp
\"I /am/ working!\")
#+end_src
@@ -1022,11 +1005,11 @@ Line 3\"
(org-test-with-temp-text "Block two has a space after the name.
#+name: foo
- #+begin_src emacs-lisp
+ #+begin_src emacs-lisp
1
#+end_src emacs-lisp
-#+name: foo
+#+name: foo
#+begin_src emacs-lisp
2
#+end_src
@@ -1060,8 +1043,8 @@ Line 3\"
(org-test-with-temp-text "#+BEGIN_SRC emacs-lisp
\(+ 1 2)
#+END_SRC\n\n\n"
- (progn (org-babel-execute-src-block)
- (buffer-string))))))
+ (org-babel-execute-src-block)
+ (buffer-string)))))
(ert-deftest test-ob/results-in-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"
(org-test-with-temp-text
"#+BEGIN_SRC emacs-lisp\n(+ 1 2)\n#+END_SRC\n\nParagraph"
- (progn
- (narrow-to-region (point) (save-excursion (forward-line 3) (point)))
- (org-babel-execute-src-block)
- (org-trim (buffer-string))))))
+ (narrow-to-region (point) (save-excursion (forward-line 3) (point)))
+ (org-babel-execute-src-block)
+ (org-trim (buffer-string)))))
(should
(equal
"#+NAME: test\n#+BEGIN_SRC emacs-lisp\n(+ 1 2)\n#+END_SRC\n\n#+RESULTS: test\n: 3"
(org-test-with-temp-text
"#+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)))
- (org-babel-execute-src-block)
- (org-trim (buffer-string))))))
+ (narrow-to-region (point) (save-excursion (forward-line 4) (point)))
+ (org-babel-execute-src-block)
+ (org-trim (buffer-string)))))
;; Results in visible part of buffer, should be updated here.
(should
(equal
@@ -1105,10 +1086,9 @@ Line 3\"
: 4
Paragraph"
- (progn
- (narrow-to-region (point) (save-excursion (forward-line 7) (point)))
- (org-babel-execute-src-block)
- (org-trim (buffer-string))))))
+ (narrow-to-region (point) (save-excursion (forward-line 7) (point)))
+ (org-babel-execute-src-block)
+ (org-trim (buffer-string)))))
;; Results in invisible part of buffer, should be updated there.
(org-test-with-temp-text
"#+NAME: test
@@ -1120,12 +1100,11 @@ Paragraph"
: 4
Paragraph"
- (progn
- (narrow-to-region (point) (save-excursion (forward-line 4) (point)))
- (org-babel-execute-src-block)
- (should-not (re-search-forward "^#\\+RESULTS:" nil t))
- (widen)
- (should (should (re-search-forward "^: 3" nil t))))))
+ (narrow-to-region (point) (save-excursion (forward-line 4) (point)))
+ (org-babel-execute-src-block)
+ (should-not (re-search-forward "^#\\+RESULTS:" nil t))
+ (widen)
+ (should (should (re-search-forward "^: 3" nil t)))))
(provide 'test-ob)
diff --git a/testing/lisp/test-org-src.el b/testing/lisp/test-org-src.el
index 049dd39..46184a7 100644
--- a/testing/lisp/test-org-src.el
+++ b/testing/lisp/test-org-src.el
@@ -31,21 +31,21 @@
#+begin_src line
"
(org-test-with-temp-text
- "
+ "
#+begin_src emacs-lisp
(message hello)
#+end_src
"
- (goto-line 2)
- (org-edit-special)
- (insert "blah")
- (org-edit-src-exit)
- (should (equal (buffer-string) "
+ (goto-line 2)
+ (org-edit-special)
+ (insert "blah")
+ (org-edit-src-exit)
+ (should (equal (buffer-string) "
#+begin_src emacs-lisp
blah(message hello)
#+end_src
"))
- (should (equal (word-at-point) "blah"))))
+ (should (equal (word-at-point) "blah"))))
(ert-deftest test-org-src/point-outside-block ()
"Editing with point before/after block signals expected error."
@@ -86,16 +86,15 @@
#+end_src
"
- (progn
- (goto-line 3)
- (org-edit-special)
- (insert "blah")
- (org-edit-src-exit)
- (should (equal (buffer-string) "
+ (goto-line 2)
+ (org-edit-special)
+ (insert "blah")
+ (org-edit-src-exit)
+ (should (equal (buffer-string) "
#+begin_src emacs-lisp
blah
#+end_src
-")))))
+"))))
(provide 'test-org-src)
;;; test-org-src.el ends here
diff --git a/testing/lisp/test-org-table.el b/testing/lisp/test-org-table.el
index de5d5e9..8b59114 100644
--- a/testing/lisp/test-org-table.el
+++ b/testing/lisp/test-org-table.el
@@ -72,12 +72,11 @@
| |
#+TBLFM: $1=vsum(@1..@-1)
"
- (progn
- (re-search-forward (regexp-quote "#+tblname: simple-formula") nil t)
- (forward-line 1)
- (should (org-at-table-p))
- (should (org-table-recalculate 'all))
- (should (string= "10" (first (nth 5 (org-table-to-lisp))))))))
+ (re-search-forward (regexp-quote "#+tblname: simple-formula") nil t)
+ (forward-line 1)
+ (should (org-at-table-p))
+ (should (org-table-recalculate 'all))
+ (should (string= "10" (first (nth 5 (org-table-to-lisp)))))))
(provide 'test-org-table)
diff --git a/testing/org-test.el b/testing/org-test.el
index 8a4fc1a..8270be0 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -42,7 +42,7 @@
(setq load-path (cons org-lisp-dir load-path))
(require 'org)
(require 'org-id)
- (org-babel-do-load-languages
+ (org-babel-do-load-languages
'org-babel-load-languages '((sh . t) (org . t))))
(let* ((load-path (cons
@@ -214,7 +214,7 @@ otherwise place the point at the beginning of the inserted text."
(with-temp-file ,file (insert ,inside-text))
(find-file ,file)
(org-mode)
- (setq ,results ,@body)
+ (setq ,results (progn ,@body))
(save-buffer) (kill-buffer (current-buffer))
(delete-file ,file)
,results)))
@@ -300,7 +300,7 @@ otherwise place the point at the beginning of the inserted text."
(rld path)
(condition-case err
(when (string-match "^[A-Za-z].*\\.el$"
- (file-name-nondirectory path))
+ (file-name-nondirectory path))
(load-file path))
(missing-test-dependency
(let ((name (intern