Update copyright years.
[org-mode.git] / testing / lisp / test-ob-R.el
blobe3f13f1fdeabac13c5a18841da2ab5db4e79952a
1 ;;; test-ob-R.el --- tests for ob-R.el
3 ;; Copyright (c) 2011-2014 Eric Schulte
4 ;; Authors: Eric Schulte
6 ;; This file is not part of GNU Emacs.
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ;;; Code:
22 (org-test-for-executable "R")
23 (unless (featurep 'ess)
24 (signal 'missing-test-dependency "ESS"))
25 (unless (featurep 'ob-R)
26 (signal 'missing-test-dependency "Support for R code blocks"))
28 (ert-deftest test-ob-R/simple-session ()
29 (let ((ess-ask-for-ess-directory nil))
30 (org-test-with-temp-text
31 "#+begin_src R :session R\n paste(\"Yep!\")\n#+end_src\n"
32 (should (string= "Yep!" (org-babel-execute-src-block))))))
34 (ert-deftest test-ob-R/colnames-yes-header-argument ()
35 (org-test-with-temp-text "#+name: eg
36 | col |
37 |-----|
38 | a |
39 | b |
41 #+header: :colnames yes
42 #+header: :var x = eg
43 #+begin_src R
45 #+end_src"
46 (org-babel-next-src-block)
47 (should (equal '(("col") hline ("a") ("b"))
48 (org-babel-execute-src-block)))))
50 (ert-deftest test-ob-R/colnames-nil-header-argument ()
51 (org-test-with-temp-text "#+name: eg
52 | col |
53 |-----|
54 | a |
55 | b |
57 #+header: :colnames nil
58 #+header: :var x = eg
59 #+begin_src R
61 #+end_src"
62 (org-babel-next-src-block)
63 (should (equal '(("col") hline ("a") ("b"))
64 (org-babel-execute-src-block)))))
66 (ert-deftest test-ob-R/colnames-no-header-argument ()
67 (org-test-with-temp-text "#+name: eg
68 | col |
69 |-----|
70 | a |
71 | b |
73 #+header: :colnames no
74 #+header: :var x = eg
75 #+begin_src R
77 #+end_src"
78 (org-babel-next-src-block)
79 (should (equal '(("col") ("a") ("b"))
80 (org-babel-execute-src-block)))))
82 (provide 'test-ob-R)
84 ;;; test-ob-R.el ends here