2011-09-21 15:31:38 -04:00
|
|
|
;;; test-ob-R.el --- tests for ob-R.el
|
2011-09-21 08:57:07 -04:00
|
|
|
|
|
|
|
;; Copyright (c) 2011 Eric Schulte
|
|
|
|
;; Authors: Eric Schulte
|
|
|
|
|
|
|
|
;; Released under the GNU General Public License version 3
|
|
|
|
;; see: http://www.gnu.org/licenses/gpl-3.0.html
|
|
|
|
|
2011-09-21 18:34:43 -04:00
|
|
|
(org-test-for-executable "R")
|
|
|
|
(unless (featurep 'ess)
|
2011-11-13 14:30:25 -05:00
|
|
|
(signal 'missing-test-dependency "ESS"))
|
2011-09-21 18:34:43 -04:00
|
|
|
|
2011-09-21 08:57:07 -04:00
|
|
|
(let ((load-path (cons (expand-file-name
|
|
|
|
".." (file-name-directory
|
|
|
|
(or load-file-name buffer-file-name)))
|
|
|
|
load-path)))
|
|
|
|
(require 'org-test)
|
|
|
|
(require 'org-test-ob-consts))
|
|
|
|
|
2011-09-21 15:31:38 -04:00
|
|
|
(require 'ob-R)
|
2011-09-21 08:57:07 -04:00
|
|
|
|
|
|
|
(ert-deftest test-ob-R/simple-session ()
|
|
|
|
(org-test-with-temp-text
|
|
|
|
"#+begin_src R :session R\n paste(\"Yep!\")\n#+end_src\n"
|
|
|
|
(should (string= "Yep!" (org-babel-execute-src-block)))))
|
|
|
|
|
2011-11-28 03:55:28 -05:00
|
|
|
(ert-deftest test-ob-R/colnames-yes-header-argument ()
|
|
|
|
(org-test-with-temp-text "#+name: eg
|
|
|
|
| col |
|
|
|
|
|-----|
|
|
|
|
| a |
|
|
|
|
| b |
|
|
|
|
|
|
|
|
#+header: :colnames yes
|
|
|
|
#+header: :var x = eg
|
|
|
|
#+begin_src R
|
|
|
|
x
|
|
|
|
#+end_src"
|
|
|
|
(org-babel-next-src-block)
|
|
|
|
(should (equal '(("col") hline ("a") ("b"))
|
|
|
|
(org-babel-execute-src-block)))))
|
|
|
|
|
|
|
|
(ert-deftest test-ob-R/colnames-nil-header-argument ()
|
|
|
|
(org-test-with-temp-text "#+name: eg
|
|
|
|
| col |
|
|
|
|
|-----|
|
|
|
|
| a |
|
|
|
|
| b |
|
|
|
|
|
|
|
|
#+header: :colnames nil
|
|
|
|
#+header: :var x = eg
|
|
|
|
#+begin_src R
|
|
|
|
x
|
|
|
|
#+end_src"
|
|
|
|
(org-babel-next-src-block)
|
|
|
|
(should (equal '(("col") hline ("a") ("b"))
|
|
|
|
(org-babel-execute-src-block)))))
|
|
|
|
|
|
|
|
(ert-deftest test-ob-R/colnames-no-header-argument ()
|
|
|
|
(org-test-with-temp-text "#+name: eg
|
|
|
|
| col |
|
|
|
|
|-----|
|
|
|
|
| a |
|
|
|
|
| b |
|
|
|
|
|
|
|
|
#+header: :colnames no
|
|
|
|
#+header: :var x = eg
|
|
|
|
#+begin_src R
|
|
|
|
x
|
|
|
|
#+end_src"
|
|
|
|
(org-babel-next-src-block)
|
|
|
|
(should (equal '(("col") ("a") ("b"))
|
|
|
|
(org-babel-execute-src-block)))))
|
|
|
|
|
2011-09-21 15:31:38 -04:00
|
|
|
(provide 'test-ob-R)
|
2011-09-21 08:57:07 -04:00
|
|
|
|
2011-09-21 15:31:38 -04:00
|
|
|
;;; test-ob-R.el ends here
|