summaryrefslogtreecommitdiff
path: root/tests/Tests/Readers/RST.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2012-07-26 08:37:36 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2012-07-26 08:37:36 -0700
commit45e4c123a45b83d666088967c25b91cf9bb5db72 (patch)
treeb3662354ccacd88b0d9238b3d0c049c4c876abc4 /tests/Tests/Readers/RST.hs
parent3053267280bfd7b255f3bf47480e4a8a97ec2915 (diff)
Moved tests to tests/, modified cabal file so lib isn't recompiled.
Diffstat (limited to 'tests/Tests/Readers/RST.hs')
-rw-r--r--tests/Tests/Readers/RST.hs60
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/Tests/Readers/RST.hs b/tests/Tests/Readers/RST.hs
new file mode 100644
index 000000000..fdce7c8f6
--- /dev/null
+++ b/tests/Tests/Readers/RST.hs
@@ -0,0 +1,60 @@
+{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
+module Tests.Readers.RST (tests) where
+
+import Text.Pandoc.Definition
+import Test.Framework
+import Tests.Helpers
+import Tests.Arbitrary()
+import Text.Pandoc.Builder
+import Text.Pandoc
+
+rst :: String -> Pandoc
+rst = readRST def
+
+infix 4 =:
+(=:) :: ToString c
+ => String -> (String, c) -> Test
+(=:) = test rst
+
+tests :: [Test]
+tests = [ "line block with blank line" =:
+ "| a\n|\n| b" =?> para (str "a" <> linebreak <>
+ linebreak <> str " " <> str "b")
+ , "field list" =:
+ [_LIT|
+:Hostname: media08
+:IP address: 10.0.0.19
+:Size: 3ru
+:Date: 2001-08-16
+:Version: 1
+:Authors: - Me
+ - Myself
+ - I
+:Indentation: Since the field marker may be quite long, the second
+ and subsequent lines of the field body do not have to line up
+ with the first line, but they must be indented relative to the
+ field name marker, and they must line up with each other.
+:Parameter i: integer
+:Final: item
+ on two lines
+|] =?> ( setAuthors ["Me","Myself","I"]
+ $ setDate "2001-08-16"
+ $ doc
+ $ definitionList [ (str "Hostname", [para "media08"])
+ , (str "IP address", [para "10.0.0.19"])
+ , (str "Size", [para "3ru"])
+ , (str "Version", [para "1"])
+ , (str "Indentation", [para "Since the field marker may be quite long, the second and subsequent lines of the field body do not have to line up with the first line, but they must be indented relative to the field name marker, and they must line up with each other."])
+ , (str "Parameter i", [para "integer"])
+ , (str "Final", [para "item on two lines"])
+ ])
+ , "URLs with following punctuation" =:
+ ("http://google.com, http://yahoo.com; http://foo.bar.baz.\n" ++
+ "http://foo.bar/baz_(bam) (http://foo.bar)") =?>
+ para (link "http://google.com" "" "http://google.com" <> ", " <>
+ link "http://yahoo.com" "" "http://yahoo.com" <> "; " <>
+ link "http://foo.bar.baz" "" "http://foo.bar.baz" <> ". " <>
+ link "http://foo.bar/baz_(bam)" "" "http://foo.bar/baz_(bam)"
+ <> " (" <> link "http://foo.bar" "" "http://foo.bar" <> ")")
+ ]
+