1 ;;;; texinfo.serialize.test -*- scheme -*-
3 ;;;; Copyright (C) 2010, 2013 Free Software Foundation, Inc.
5 ;;;; This library is free software; you can redistribute it and/or
6 ;;;; modify it under the terms of the GNU Lesser General Public
7 ;;;; License as published by the Free Software Foundation; either
8 ;;;; version 3 of the License, or (at your option) any later version.
10 ;;;; This library is distributed in the hope that it will be useful,
11 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ;;;; Lesser General Public License for more details.
15 ;;;; You should have received a copy of the GNU Lesser General Public
16 ;;;; License along with this library; if not, write to the Free Software
17 ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 ;; Unit tests for (texinfo serialize).
25 (define-module (test-suite texinfo-serialize)
26 #:use-module (test-suite lib)
27 #:use-module (texinfo serialize))
29 (with-test-prefix "test-serialize"
30 (define (assert-serialize stexi str)
31 (pass-if str (equal? str (stexi->texi stexi))))
33 (assert-serialize '(para)
38 (assert-serialize '(para "foo")
43 (assert-serialize '(var "foo")
47 ;; i don't remember why braces exists, but as long as it does, a test
49 (assert-serialize '(*braces* "foo")
52 (assert-serialize '(value (% (key "foo")))
55 (assert-serialize '(ref (% (node "foo")))
57 (assert-serialize '(ref (% (node "foo") (name "bar")))
59 (assert-serialize '(ref (% (node "foo") (name "bar")
60 (section "qux") (info-file "xyzzy")
62 "@ref{foo,bar,qux,xyzzy,zarg}")
63 (assert-serialize '(ref (% (section "qux") (info-file "xyzzy")
64 (node "foo") (name "bar")
66 "@ref{foo,bar,qux,xyzzy,zarg}")
67 (assert-serialize '(ref (% (node "foo")
71 (assert-serialize '(dots) "@dots{}")
73 (assert-serialize '(node (% (name "foo")))
77 (assert-serialize '(node (% (name "foo bar")))
80 (assert-serialize '(node (% (name "foo bar") (next "baz")))
84 (assert-serialize '(title "Foo")
87 (assert-serialize '(title "Foo is a " (var "bar"))
88 "@title Foo is a @var{bar}
91 (assert-serialize '(title "Foo is a " (var "bar") " baz")
92 "@title Foo is a @var{bar} baz
95 (assert-serialize '(cindex (% (entry "Bar baz, foo")))
99 ;; there is a space after @iftex, doesn't matter tho
100 (assert-serialize '(iftex
101 (para "This is only for tex.")
104 This is only for tex.
112 (assert-serialize '(defun (% (name "frob"))
121 (assert-serialize '(defun (% (name "frob") (arguments "bar"))
130 (assert-serialize '(defun (% (name "frob") (arguments "bar" " " "baz"))
139 (assert-serialize '(defun (% (name "frob") (arguments (var "bar")))
141 "@defun frob @var{bar}
148 (assert-serialize '(defunx (% (name "frob") (arguments (var "bar"))))
149 "@defunx frob @var{bar}
152 (assert-serialize '(table (% (formatter (var)))
153 (entry (% (heading "Foo bar " (code "baz")))
157 @item Foo bar @code{baz}
166 (assert-serialize '(verbatim "foo")
173 (assert-serialize '(deffnx (% (name "foo") (category "bar")))
177 (assert-serialize '(deffnx (% (name "foo") (category "bar") (arguments "x" " " "y")))
181 (assert-serialize '(deffnx (% (name "foo") (category "bar") (arguments "(" "x" " " (code "int") ")")))
182 "@deffnx bar foo (x @code{int})