org.el: New command `org-redisplay-inline-images'
[org-mode.git] / testing / lisp / test-ob-R.el
blob0ebf4d9b449a679ff2688f5e997b75e37d96508c
1 ;;; test-ob-R.el --- tests for ob-R.el
3 ;; Copyright (c) 2011-2012 Eric Schulte
4 ;; Authors: Eric Schulte
6 ;; Released under the GNU General Public License version 3
7 ;; see: http://www.gnu.org/licenses/gpl-3.0.html
9 ;;; Code:
10 (org-test-for-executable "R")
11 (unless (featurep 'ess)
12 (signal 'missing-test-dependency "ESS"))
13 (unless (featurep 'ob-R)
14 (signal 'missing-test-dependency "Support for R code blocks"))
16 (ert-deftest test-ob-R/simple-session ()
17 (org-test-with-temp-text
18 "#+begin_src R :session R\n paste(\"Yep!\")\n#+end_src\n"
19 (should (string= "Yep!" (org-babel-execute-src-block)))))
21 (ert-deftest test-ob-R/colnames-yes-header-argument ()
22 (org-test-with-temp-text "#+name: eg
23 | col |
24 |-----|
25 | a |
26 | b |
28 #+header: :colnames yes
29 #+header: :var x = eg
30 #+begin_src R
32 #+end_src"
33 (org-babel-next-src-block)
34 (should (equal '(("col") hline ("a") ("b"))
35 (org-babel-execute-src-block)))))
37 (ert-deftest test-ob-R/colnames-nil-header-argument ()
38 (org-test-with-temp-text "#+name: eg
39 | col |
40 |-----|
41 | a |
42 | b |
44 #+header: :colnames nil
45 #+header: :var x = eg
46 #+begin_src R
48 #+end_src"
49 (org-babel-next-src-block)
50 (should (equal '(("col") hline ("a") ("b"))
51 (org-babel-execute-src-block)))))
53 (ert-deftest test-ob-R/colnames-no-header-argument ()
54 (org-test-with-temp-text "#+name: eg
55 | col |
56 |-----|
57 | a |
58 | b |
60 #+header: :colnames no
61 #+header: :var x = eg
62 #+begin_src R
64 #+end_src"
65 (org-babel-next-src-block)
66 (should (equal '(("col") ("a") ("b"))
67 (org-babel-execute-src-block)))))
69 (provide 'test-ob-R)
71 ;;; test-ob-R.el ends here