aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Tests/Writers/Docbook.hs199
-rw-r--r--tests/writer.docbook60
2 files changed, 218 insertions, 41 deletions
diff --git a/tests/Tests/Writers/Docbook.hs b/tests/Tests/Writers/Docbook.hs
index e815b4f5a..97126b473 100644
--- a/tests/Tests/Writers/Docbook.hs
+++ b/tests/Tests/Writers/Docbook.hs
@@ -31,22 +31,199 @@ lineblock :: Blocks
lineblock = para ("some text" <> linebreak <>
"and more lines" <> linebreak <>
"and again")
-lineblock_out :: String
-lineblock_out = "<literallayout>some text\n" ++
- "and more lines\n" ++
- "and again</literallayout>"
+lineblock_out :: [String]
+lineblock_out = [ "<literallayout>some text"
+ , "and more lines"
+ , "and again</literallayout>"
+ ]
tests :: [Test]
tests = [ testGroup "line blocks"
[ "none" =: para "This is a test"
- =?> "<para>\n This is a test\n</para>"
+ =?> unlines
+ [ "<para>"
+ , " This is a test"
+ , "</para>"
+ ]
, "basic" =: lineblock
- =?> lineblock_out
+ =?> unlines lineblock_out
, "blockquote" =: blockQuote lineblock
- =?> ("<blockquote>\n" ++ lineblock_out ++ "\n</blockquote>")
- , "footnote" =: para ("This is a test" <> note lineblock <> " of footnotes")
- =?> ("<para>\n This is a test<footnote>\n" ++
- lineblock_out ++
- "\n </footnote> of footnotes\n</para>")
+ =?> unlines
+ ( [ "<blockquote>" ] ++
+ lineblock_out ++
+ [ "</blockquote>" ]
+ )
+ , "footnote" =: para ("This is a test" <>
+ note lineblock <>
+ " of footnotes")
+ =?> unlines
+ ( [ "<para>"
+ , " This is a test<footnote>" ] ++
+ lineblock_out ++
+ [ " </footnote> of footnotes"
+ , "</para>" ]
+ )
+ ]
+ , testGroup "compact lists"
+ [ testGroup "bullet"
+ [ "compact" =: bulletList [plain "a", plain "b", plain "c"]
+ =?> unlines
+ [ "<itemizedlist spacing=\"compact\">"
+ , " <listitem>"
+ , " <para>"
+ , " a"
+ , " </para>"
+ , " </listitem>"
+ , " <listitem>"
+ , " <para>"
+ , " b"
+ , " </para>"
+ , " </listitem>"
+ , " <listitem>"
+ , " <para>"
+ , " c"
+ , " </para>"
+ , " </listitem>"
+ , "</itemizedlist>"
+ ]
+ , "loose" =: bulletList [para "a", para "b", para "c"]
+ =?> unlines
+ [ "<itemizedlist>"
+ , " <listitem>"
+ , " <para>"
+ , " a"
+ , " </para>"
+ , " </listitem>"
+ , " <listitem>"
+ , " <para>"
+ , " b"
+ , " </para>"
+ , " </listitem>"
+ , " <listitem>"
+ , " <para>"
+ , " c"
+ , " </para>"
+ , " </listitem>"
+ , "</itemizedlist>"
+ ]
+ ]
+ , testGroup "ordered"
+ [ "compact" =: orderedList [plain "a", plain "b", plain "c"]
+ =?> unlines
+ [ "<orderedlist spacing=\"compact\">"
+ , " <listitem>"
+ , " <para>"
+ , " a"
+ , " </para>"
+ , " </listitem>"
+ , " <listitem>"
+ , " <para>"
+ , " b"
+ , " </para>"
+ , " </listitem>"
+ , " <listitem>"
+ , " <para>"
+ , " c"
+ , " </para>"
+ , " </listitem>"
+ , "</orderedlist>"
+ ]
+ , "loose" =: orderedList [para "a", para "b", para "c"]
+ =?> unlines
+ [ "<orderedlist>"
+ , " <listitem>"
+ , " <para>"
+ , " a"
+ , " </para>"
+ , " </listitem>"
+ , " <listitem>"
+ , " <para>"
+ , " b"
+ , " </para>"
+ , " </listitem>"
+ , " <listitem>"
+ , " <para>"
+ , " c"
+ , " </para>"
+ , " </listitem>"
+ , "</orderedlist>"
+ ]
+ ]
+ , testGroup "definition"
+ [ "compact" =: definitionList [ ("an", [plain "apple" ])
+ , ("a", [plain "banana"])
+ , ("an", [plain "orange"])]
+ =?> unlines
+ [ "<variablelist spacing=\"compact\">"
+ , " <varlistentry>"
+ , " <term>"
+ , " an"
+ , " </term>"
+ , " <listitem>"
+ , " <para>"
+ , " apple"
+ , " </para>"
+ , " </listitem>"
+ , " </varlistentry>"
+ , " <varlistentry>"
+ , " <term>"
+ , " a"
+ , " </term>"
+ , " <listitem>"
+ , " <para>"
+ , " banana"
+ , " </para>"
+ , " </listitem>"
+ , " </varlistentry>"
+ , " <varlistentry>"
+ , " <term>"
+ , " an"
+ , " </term>"
+ , " <listitem>"
+ , " <para>"
+ , " orange"
+ , " </para>"
+ , " </listitem>"
+ , " </varlistentry>"
+ , "</variablelist>"
+ ]
+ , "loose" =: definitionList [ ("an", [para "apple" ])
+ , ("a", [para "banana"])
+ , ("an", [para "orange"])]
+ =?> unlines
+ [ "<variablelist>"
+ , " <varlistentry>"
+ , " <term>"
+ , " an"
+ , " </term>"
+ , " <listitem>"
+ , " <para>"
+ , " apple"
+ , " </para>"
+ , " </listitem>"
+ , " </varlistentry>"
+ , " <varlistentry>"
+ , " <term>"
+ , " a"
+ , " </term>"
+ , " <listitem>"
+ , " <para>"
+ , " banana"
+ , " </para>"
+ , " </listitem>"
+ , " </varlistentry>"
+ , " <varlistentry>"
+ , " <term>"
+ , " an"
+ , " </term>"
+ , " <listitem>"
+ , " <para>"
+ , " orange"
+ , " </para>"
+ , " </listitem>"
+ , " </varlistentry>"
+ , "</variablelist>"
+ ]
+ ]
]
]
diff --git a/tests/writer.docbook b/tests/writer.docbook
index 9cb9a5359..26dcbadaa 100644
--- a/tests/writer.docbook
+++ b/tests/writer.docbook
@@ -93,7 +93,7 @@ sub status {
<para>
A list:
</para>
- <orderedlist numeration="arabic">
+ <orderedlist numeration="arabic" spacing="compact">
<listitem>
<para>
item one
@@ -156,7 +156,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
<para>
Asterisks tight:
</para>
- <itemizedlist>
+ <itemizedlist spacing="compact">
<listitem>
<para>
asterisk 1
@@ -196,7 +196,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
<para>
Pluses tight:
</para>
- <itemizedlist>
+ <itemizedlist spacing="compact">
<listitem>
<para>
Plus 1
@@ -236,7 +236,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
<para>
Minuses tight:
</para>
- <itemizedlist>
+ <itemizedlist spacing="compact">
<listitem>
<para>
Minus 1
@@ -279,7 +279,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
<para>
Tight:
</para>
- <orderedlist numeration="arabic">
+ <orderedlist numeration="arabic" spacing="compact">
<listitem>
<para>
First
@@ -299,7 +299,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
<para>
and:
</para>
- <orderedlist numeration="arabic">
+ <orderedlist numeration="arabic" spacing="compact">
<listitem>
<para>
One
@@ -383,17 +383,17 @@ These should not be escaped: \$ \\ \&gt; \[ \{
</sect2>
<sect2 id="nested">
<title>Nested</title>
- <itemizedlist>
+ <itemizedlist spacing="compact">
<listitem>
<para>
Tab
</para>
- <itemizedlist>
+ <itemizedlist spacing="compact">
<listitem>
<para>
Tab
</para>
- <itemizedlist>
+ <itemizedlist spacing="compact">
<listitem>
<para>
Tab
@@ -407,7 +407,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
<para>
Here’s another:
</para>
- <orderedlist numeration="arabic">
+ <orderedlist numeration="arabic" spacing="compact">
<listitem>
<para>
First
@@ -417,7 +417,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
<para>
Second:
</para>
- <itemizedlist>
+ <itemizedlist spacing="compact">
<listitem>
<para>
Fee
@@ -454,7 +454,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
<para>
Second:
</para>
- <itemizedlist>
+ <itemizedlist spacing="compact">
<listitem>
<para>
Fee
@@ -508,7 +508,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
</sect2>
<sect2 id="fancy-list-markers">
<title>Fancy list markers</title>
- <orderedlist numeration="arabic">
+ <orderedlist numeration="arabic" spacing="compact">
<listitem override="2">
<para>
begins with 2
@@ -521,7 +521,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
<para>
with a continuation
</para>
- <orderedlist numeration="lowerroman">
+ <orderedlist numeration="lowerroman" spacing="compact">
<listitem override="4">
<para>
sublist with roman numerals, starting with 4
@@ -531,7 +531,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
<para>
more items
</para>
- <orderedlist numeration="upperalpha">
+ <orderedlist numeration="upperalpha" spacing="compact">
<listitem>
<para>
a subsublist
@@ -550,22 +550,22 @@ These should not be escaped: \$ \\ \&gt; \[ \{
<para>
Nesting:
</para>
- <orderedlist numeration="upperalpha">
+ <orderedlist numeration="upperalpha" spacing="compact">
<listitem>
<para>
Upper Alpha
</para>
- <orderedlist numeration="upperroman">
+ <orderedlist numeration="upperroman" spacing="compact">
<listitem>
<para>
Upper Roman.
</para>
- <orderedlist numeration="arabic">
+ <orderedlist numeration="arabic" spacing="compact">
<listitem override="6">
<para>
Decimal start with 6
</para>
- <orderedlist numeration="loweralpha">
+ <orderedlist numeration="loweralpha" spacing="compact">
<listitem override="3">
<para>
Lower alpha with paren
@@ -581,7 +581,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
<para>
Autonumbering:
</para>
- <orderedlist>
+ <orderedlist spacing="compact">
<listitem>
<para>
Autonumber.
@@ -591,7 +591,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
<para>
More.
</para>
- <orderedlist>
+ <orderedlist spacing="compact">
<listitem>
<para>
Nested.
@@ -616,7 +616,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
<para>
Tight using spaces:
</para>
- <variablelist>
+ <variablelist spacing="compact">
<varlistentry>
<term>
apple
@@ -651,7 +651,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
<para>
Tight using tabs:
</para>
- <variablelist>
+ <variablelist spacing="compact">
<varlistentry>
<term>
apple
@@ -757,7 +757,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
<para>
Multiple definitions, tight:
</para>
- <variablelist>
+ <variablelist spacing="compact">
<varlistentry>
<term>
apple
@@ -841,7 +841,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
<para>
orange fruit
</para>
- <orderedlist numeration="arabic">
+ <orderedlist numeration="arabic" spacing="compact">
<listitem>
<para>
sublist
@@ -1051,7 +1051,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
</sect1>
<sect1 id="latex">
<title>LaTeX</title>
- <itemizedlist>
+ <itemizedlist spacing="compact">
<listitem>
<para>
</para>
@@ -1097,7 +1097,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
<para>
These shouldn’t be math:
</para>
- <itemizedlist>
+ <itemizedlist spacing="compact">
<listitem>
<para>
To get the famous equation, write <literal>$e = mc^2$</literal>.
@@ -1130,7 +1130,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
<para>
Here is some unicode:
</para>
- <itemizedlist>
+ <itemizedlist spacing="compact">
<listitem>
<para>
I hat: Î
@@ -1316,7 +1316,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{
With an ampersand:
<ulink url="http://example.com/?foo=1&amp;bar=2">http://example.com/?foo=1&amp;bar=2</ulink>
</para>
- <itemizedlist>
+ <itemizedlist spacing="compact">
<listitem>
<para>
In a list?
@@ -1414,7 +1414,7 @@ or here: &lt;http://example.com/&gt;
</footnote>
</para>
</blockquote>
- <orderedlist numeration="arabic">
+ <orderedlist numeration="arabic" spacing="compact">
<listitem>
<para>
And in list items.<footnote>