test-ob-awk.el 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ;;; test-ob-awk.el --- tests for ob-awk.el
  2. ;; Copyright (c) 2010-2014 Sergey Litvinov
  3. ;; Authors: Sergey Litvinov
  4. ;; This file is not part of GNU Emacs.
  5. ;; This program is free software; you can redistribute it and/or modify
  6. ;; it under the terms of the GNU General Public License as published by
  7. ;; the Free Software Foundation, either version 3 of the License, or
  8. ;; (at your option) any later version.
  9. ;; This program is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. ;;; Code:
  16. (org-test-for-executable "awk")
  17. (unless (featurep 'ob-awk)
  18. (signal 'missing-test-dependency "Support for Awk code blocks"))
  19. (ert-deftest ob-awk/input-none ()
  20. "Test with no input file"
  21. (org-test-at-id "9e998b2a-3581-43fe-b26d-07d3c507b86a"
  22. (org-babel-next-src-block)
  23. (should (= 42 (org-babel-execute-src-block)))))
  24. (ert-deftest ob-awk/input-src-block-1 ()
  25. "Test a code block as an input"
  26. (org-test-at-id "9e998b2a-3581-43fe-b26d-07d3c507b86a"
  27. (org-babel-next-src-block 2)
  28. (should (= 43 (org-babel-execute-src-block)))))
  29. (ert-deftest ob-awk/input-src-block-2 ()
  30. "Test a code block as an input"
  31. (org-test-at-id "9e998b2a-3581-43fe-b26d-07d3c507b86a"
  32. (org-babel-next-src-block 3)
  33. (should (= 150 (org-babel-execute-src-block)))))
  34. (ert-deftest ob-awk/tabular-input ()
  35. "Test a code block as an input"
  36. (org-test-at-id "9e998b2a-3581-43fe-b26d-07d3c507b86a"
  37. (org-babel-next-src-block 4)
  38. (should (equal '(("a" "b" "c")) (org-babel-execute-src-block)))))