aboutsummaryrefslogtreecommitdiff
path: root/tests/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Tests')
-rw-r--r--tests/Tests/Old.hs2
-rw-r--r--tests/Tests/Readers/Docx.hs10
-rw-r--r--tests/Tests/Readers/HTML.hs5
-rw-r--r--tests/Tests/Readers/Org.hs12
-rw-r--r--tests/Tests/Writers/TEI.hs43
5 files changed, 65 insertions, 7 deletions
diff --git a/tests/Tests/Old.hs b/tests/Tests/Old.hs
index c6b22af50..36bb3398e 100644
--- a/tests/Tests/Old.hs
+++ b/tests/Tests/Old.hs
@@ -162,7 +162,7 @@ tests = [ testGroup "markdown"
[ test "reader" ["-r", "twiki", "-w", "native", "-s"]
"twiki-reader.twiki" "twiki-reader.native" ]
, testGroup "other writers" $ map (\f -> testGroup f $ writerTests f)
- [ "opendocument" , "context" , "texinfo", "icml"
+ [ "opendocument" , "context" , "texinfo", "icml", "tei"
, "man" , "plain" , "rtf", "org", "asciidoc"
]
, testGroup "writers-lang-and-dir"
diff --git a/tests/Tests/Readers/Docx.hs b/tests/Tests/Readers/Docx.hs
index 086d3f964..e09d56529 100644
--- a/tests/Tests/Readers/Docx.hs
+++ b/tests/Tests/Readers/Docx.hs
@@ -111,6 +111,10 @@ tests = [ testGroup "inlines"
"docx/links.docx"
"docx/links.native"
, testCompare
+ "normalizing adjacent hyperlinks"
+ "docx/adjacent_links.docx"
+ "docx/adjacent_links.native"
+ , testCompare
"inline image"
"docx/image.docx"
"docx/image_no_embed.native"
@@ -165,10 +169,14 @@ tests = [ testGroup "inlines"
"docx/already_auto_ident.docx"
"docx/already_auto_ident.native"
, testCompare
- "numbered headers automatically made into list"
+ "single numbered item not made into list"
"docx/numbered_header.docx"
"docx/numbered_header.native"
, testCompare
+ "enumerated headers not made into numbered list"
+ "docx/enumerated_headings.docx"
+ "docx/enumerated_headings.native"
+ , testCompare
"i18n blocks (headers and blockquotes)"
"docx/i18n_blocks.docx"
"docx/i18n_blocks.native"
diff --git a/tests/Tests/Readers/HTML.hs b/tests/Tests/Readers/HTML.hs
index 2eb87a2f3..ff27b8aed 100644
--- a/tests/Tests/Readers/HTML.hs
+++ b/tests/Tests/Readers/HTML.hs
@@ -15,11 +15,14 @@ html = handleError . readHtml def
tests :: [Test]
tests = [ testGroup "base tag"
[ test html "simple" $
- "<head><base href=\"http://www.w3schools.com/images\" ></head><body><img src=\"stickman.gif\" alt=\"Stickman\"></head>" =?>
+ "<head><base href=\"http://www.w3schools.com/images/foo\" ></head><body><img src=\"stickman.gif\" alt=\"Stickman\"></head>" =?>
plain (image "http://www.w3schools.com/images/stickman.gif" "" (text "Stickman"))
, test html "slash at end of base" $
"<head><base href=\"http://www.w3schools.com/images/\" ></head><body><img src=\"stickman.gif\" alt=\"Stickman\"></head>" =?>
plain (image "http://www.w3schools.com/images/stickman.gif" "" (text "Stickman"))
+ , test html "slash at beginning of href" $
+ "<head><base href=\"http://www.w3schools.com/images/\" ></head><body><img src=\"/stickman.gif\" alt=\"Stickman\"></head>" =?>
+ plain (image "http://www.w3schools.com/stickman.gif" "" (text "Stickman"))
, test html "absolute URL" $
"<head><base href=\"http://www.w3schools.com/images/\" ></head><body><img src=\"http://example.com/stickman.gif\" alt=\"Stickman\"></head>" =?>
plain (image "http://example.com/stickman.gif" "" (text "Stickman"))
diff --git a/tests/Tests/Readers/Org.hs b/tests/Tests/Readers/Org.hs
index bb3bffe22..b095ac60a 100644
--- a/tests/Tests/Readers/Org.hs
+++ b/tests/Tests/Readers/Org.hs
@@ -190,6 +190,10 @@ tests =
"[[./sunset.jpg]]" =?>
(para $ image "./sunset.jpg" "" "")
+ , "Image with explicit file: prefix" =:
+ "[[file:sunrise.jpg]]" =?>
+ (para $ image "sunrise.jpg" "" "")
+
, "Explicit link" =:
"[[http://zeitlens.com/][pseudo-random /nonsense/]]" =?>
(para $ link "http://zeitlens.com/" ""
@@ -635,11 +639,11 @@ tests =
] =?>
para (image "edward.jpg" "fig:goodguy" "A very courageous man.")
- , "Unnamed figure" =:
- unlines [ "#+caption: A great whistleblower."
- , "[[snowden.png]]"
+ , "Figure with no name" =:
+ unlines [ "#+caption: I've been through the desert on this"
+ , "[[horse.png]]"
] =?>
- para (image "snowden.png" "" "A great whistleblower.")
+ para (image "horse.png" "fig:" "I've been through the desert on this")
, "Figure with `fig:` prefix in name" =:
unlines [ "#+caption: Used as a metapher in evolutionary biology."
diff --git a/tests/Tests/Writers/TEI.hs b/tests/Tests/Writers/TEI.hs
new file mode 100644
index 000000000..56764db9f
--- /dev/null
+++ b/tests/Tests/Writers/TEI.hs
@@ -0,0 +1,43 @@
+{-# LANGUAGE OverloadedStrings #-}
+module Tests.Writers.TEI (tests) where
+
+import Test.Framework
+import Text.Pandoc.Builder
+import Text.Pandoc
+import Tests.Helpers
+import Tests.Arbitrary()
+
+{-
+ "my test" =: X =?> Y
+
+is shorthand for
+
+ test html "my test" $ X =?> Y
+
+which is in turn shorthand for
+
+ test html "my test" (X,Y)
+-}
+
+infix 4 =:
+(=:) :: (ToString a, ToPandoc a)
+ => String -> (a, String) -> Test
+(=:) = test (writeTEI def . toPandoc)
+
+tests :: [Test]
+tests = [ testGroup "block elements"
+ ["para" =: para "Lorem ipsum cetera."
+ =?> "<p>Lorem ipsum cetera.</p>"
+ ]
+ , testGroup "inlines"
+ [
+ "Emphasis" =: emph ("emphasized")
+ =?> "<p><hi rendition=\"simple:italic\">emphasized</hi></p>"
+ ,"SingleQuoted" =: singleQuoted (text "quoted material")
+ =?> "<p><quote>quoted material</quote></p>"
+ ,"DoubleQuoted" =: doubleQuoted (text "quoted material")
+ =?> "<p><quote>quoted material</quote></p>"
+ ,"NestedQuoted" =: doubleQuoted (singleQuoted (text "quoted material"))
+ =?> "<p><quote><quote>quoted material</quote></quote></p>"
+ ]
+ ]