Update copyright years.
[org-mode.git] / testing / lisp / test-ob-perl.el
blob649e111f5ae6999b20a2130eb8a4c5ae58361f9c
1 ;;; test-ob-perl.el --- tests for ob-perl.el
3 ;; Copyright (c) 2013, 2014 Achim Gratz
4 ;; Authors: Achim Gratz
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 "perl")
23 (unless (featurep 'ob-perl)
24 (signal 'missing-test-dependency "Support for perl code blocks"))
26 (ert-deftest test-ob-perl/simple-output ()
27 (org-test-with-temp-text "
28 #+header: :results output
29 #+begin_src perl
30 print qq(Hi Mom!$/I'm home.);
31 #+end_src"
32 (org-babel-next-src-block)
33 (should (equal "Hi Mom!\nI'm home."
34 (org-babel-execute-src-block)))))
36 (ert-deftest test-ob-perl/simple-value ()
37 (org-test-with-temp-text "
38 #+header: :results value
39 #+begin_src perl
40 qq(Hi Mom!$/I'm home.);
41 #+end_src"
42 (org-babel-next-src-block)
43 (should (equal '(("Hi Mom!") ("I'm home."))
44 (org-babel-execute-src-block)))))
46 (ert-deftest test-ob-perl/table-passthrough-colnames-nil ()
47 (org-test-with-temp-text "#+name: eg
48 | col1 | col2 |
49 |------+------|
50 | a | 1 |
51 | b | 2.0 |
53 #+header: :colnames nil
54 #+header: :var x = eg
55 #+begin_src perl
56 #+end_src"
57 (org-babel-next-src-block)
58 (should (equal '(("col1" "col2") hline ("a" 1) ("b" 2.0))
59 (org-babel-execute-src-block)))))
61 (ert-deftest test-ob-perl/table-passthrough-colnames-no ()
62 (org-test-with-temp-text "#+name: eg
63 | col1 | col2 |
64 |------+------|
65 | a | 1 |
66 | b | 2.0 |
68 #+header: :colnames no
69 #+header: :var x = eg
70 #+begin_src perl
71 #+end_src"
72 (org-babel-next-src-block)
73 (should (equal '(("col1" "col2") ("a" 1) ("b" 2.0))
74 (org-babel-execute-src-block)))))
76 (provide 'test-ob-perl)
78 ;;; test-ob-perl.el ends here