test-ob-scheme.el 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. ;;; test-ob-scheme.el --- Tests for Babel scheme -*- lexical-binding: t; -*-
  2. ;; Copyright (C) 2017 Nicolas Goaziou
  3. ;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
  4. ;; This program is free software; you can redistribute it and/or modify
  5. ;; it under the terms of the GNU General Public License as published by
  6. ;; the Free Software Foundation, either version 3 of the License, or
  7. ;; (at your option) any later version.
  8. ;; This program is distributed in the hope that it will be useful,
  9. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. ;; GNU General Public License for more details.
  12. ;; You should have received a copy of the GNU General Public License
  13. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. ;;; Commentary:
  15. ;; Unit tests for Org Babel Scheme.
  16. ;;; Code:
  17. (unless (featurep 'ob-scheme)
  18. (signal 'missing-test-dependency "Support for Scheme code blocks"))
  19. (ert-deftest test-ob-scheme/tables ()
  20. "Test table output."
  21. (equal "#+begin_src scheme
  22. '(1 2 3)
  23. #+end_src
  24. #+RESULTS:
  25. | 1 | 2 | 3 |
  26. "
  27. (org-test-with-temp-text "#+begin_src scheme\n'(1 2 3)\n#+end_src"
  28. (org-babel-execute-maybe)
  29. (buffer-string))))
  30. (ert-deftest test-ob-scheme/prologue ()
  31. "Test :prologue parameter."
  32. (equal "#+begin_src scheme :prologue \"(define x 2)\"
  33. x
  34. #+end_src
  35. #+RESULTS:
  36. : 2
  37. "
  38. (org-test-with-temp-text
  39. "#+begin_src scheme :prologue \"(define x 2)\"\nx\n#+end_src"
  40. (org-babel-execute-maybe)
  41. (buffer-string)))
  42. (equal
  43. "#+begin_src scheme :prologue \"(define x 2)\" :var y=1
  44. x
  45. #+end_src
  46. #+RESULTS:
  47. : 2
  48. "
  49. (org-test-with-temp-text
  50. "#+begin_src scheme :prologue \"(define x 2)\" :var y=1\nx\n#+end_src"
  51. (org-babel-execute-maybe)
  52. (buffer-string))))
  53. (provide 'test-ob-scheme)
  54. ;;; test-ob-scheme.el ends here