1 ;;; test-ob-awk.el --- tests for ob-awk.el
3 ;; Copyright (c) 2010-2014 Sergey Litvinov
4 ;; Authors: Sergey Litvinov
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/>.
22 (org-test-for-executable "awk")
23 (unless (featurep 'ob-awk
)
24 (signal 'missing-test-dependency
"Support for Awk code blocks"))
26 (ert-deftest ob-awk
/input-none
()
27 "Test with no input file"
28 (org-test-at-id "9e998b2a-3581-43fe-b26d-07d3c507b86a"
29 (org-babel-next-src-block)
30 (should (= 42 (org-babel-execute-src-block)))))
32 (ert-deftest ob-awk
/input-src-block-1
()
33 "Test a code block as an input"
34 (org-test-at-id "9e998b2a-3581-43fe-b26d-07d3c507b86a"
35 (org-babel-next-src-block 2)
36 (should (= 43 (org-babel-execute-src-block)))))
38 (ert-deftest ob-awk
/input-src-block-2
()
39 "Test a code block as an input"
40 (org-test-at-id "9e998b2a-3581-43fe-b26d-07d3c507b86a"
41 (org-babel-next-src-block 3)
42 (should (= 150 (org-babel-execute-src-block)))))
44 (ert-deftest ob-awk
/tabular-input
()
45 "Test a code block as an input"
46 (org-test-at-id "9e998b2a-3581-43fe-b26d-07d3c507b86a"
47 (org-babel-next-src-block 4)
48 (should (equal '(("a" "b" "c")) (org-babel-execute-src-block)))))