1 ;;; test-ob-sed.el --- tests for ob-sed.el
3 ;; Copyright (c) 2015 Bjarte Johansen
4 ;; Authors: Bjarte Johansen
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 "sed")
23 (unless (featurep 'ob-sed
)
24 (signal 'missing-test-dependency
"Support for Sed code blocks"))
26 (ert-deftest ob-sed-test
/simple-execution-of-script
()
27 "Test simple execution of script."
28 (org-test-at-id "C7E7CA6A-2601-42C9-B534-4102D62E458D"
29 (org-babel-next-src-block)
30 (should (string= "A processed sentence.\n"
31 (org-babel-execute-src-block)))))
33 (ert-deftest ob-sed-test
/in-file-header-argument
()
34 "Test :in-file header argument."
35 (org-test-at-id "54EC49AA-FE9F-4D58-812E-00FC87FAF562"
36 (let ((default-directory temporary-file-directory
))
38 (insert "A test file.")
39 (write-file "test1.txt"))
40 (org-babel-next-src-block)
41 (should (string= "A tested file.\n"
42 (org-babel-execute-src-block))))))
44 (ert-deftest ob-sed-test
/cmd-line-header-argument
()
45 "Test :cmd-line header argument."
46 (org-test-at-id "E3C6A8BA-39FF-4840-BA8E-90D5C4365AB1"
47 (let ((default-directory temporary-file-directory
))
49 (insert "A test file.")
50 (write-file "test2.txt"))
51 (org-babel-next-src-block)
52 (org-babel-execute-src-block)
53 (should (string= "A tested again file.\n"
55 (insert-file-contents "test2.txt")
60 ;;; test-ob-sed ends here