Merge branch 'maint'
[org-mode/org-tableheadings.git] / testing / lisp / test-ob-scheme.el
bloba3406d309916d46ed79342019158a405111e423a
1 ;;; test-ob-scheme.el --- Tests for Babel scheme -*- lexical-binding: t; -*-
3 ;; Copyright (C) 2017 Nicolas Goaziou
5 ;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
7 ;; This program is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation, either version 3 of the License, or
10 ;; (at your option) any later version.
12 ;; This program is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ;;; Commentary:
22 ;; Unit tests for Org Babel Scheme.
24 ;;; Code:
26 (unless (featurep 'ob-scheme)
27 (signal 'missing-test-dependency "Support for Scheme code blocks"))
29 (ert-deftest test-ob-scheme/tables ()
30 "Test table output."
31 (equal "#+begin_src scheme
32 '(1 2 3)
33 #+end_src
35 #+RESULTS:
36 | 1 | 2 | 3 |
38 (org-test-with-temp-text "#+begin_src scheme\n'(1 2 3)\n#+end_src"
39 (org-babel-execute-maybe)
40 (buffer-string))))
42 (ert-deftest test-ob-scheme/prologue ()
43 "Test :prologue parameter."
44 (should
45 (equal "#+begin_src scheme :prologue \"(define x 2)\"
47 #+end_src
49 #+RESULTS:
50 : 2
52 (org-test-with-temp-text
53 "#+begin_src scheme :prologue \"(define x 2)\"\nx\n#+end_src"
54 (org-babel-execute-maybe)
55 (buffer-string))))
56 (should
57 (equal
58 "#+begin_src scheme :prologue \"(define x 2)\" :var y=1
60 #+end_src
62 #+RESULTS:
63 : 2
65 (org-test-with-temp-text
66 "#+begin_src scheme :prologue \"(define x 2)\" :var y=1\nx\n#+end_src"
67 (org-babel-execute-maybe)
68 (buffer-string)))))
70 (ert-deftest test-ob-scheme/unspecified ()
71 "Test <#unspecified> return value."
72 (should
73 (equal "#+begin_src scheme
74 \(define (mysquare x)
75 (* x x))
76 #+end_src
78 #+RESULTS:
79 : #<unspecified>
81 (org-test-with-temp-text
82 "#+begin_src scheme
83 (define (mysquare x)
84 (* x x))
85 #+end_src"
86 (org-babel-execute-maybe)
87 (buffer-string)))))
90 (provide 'test-ob-scheme)
91 ;;; test-ob-scheme.el ends here