aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2011-01-26 09:10:39 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2011-01-26 17:23:56 -0800
commit066cbbad76a71c3c782216066de3d32fce79af72 (patch)
tree16733b09977b8c1384729f320ab318586a20fa57
parentc5384a33c0488d7e1274ba5579a24cf733eee934 (diff)
downloadpandoc-066cbbad76a71c3c782216066de3d32fce79af72.tar.gz
Added RST reader tests.
-rw-r--r--pandoc.cabal1
-rw-r--r--tests/Tests/Readers/RST.hs46
-rw-r--r--tests/test-pandoc.hs2
3 files changed, 49 insertions, 0 deletions
diff --git a/pandoc.cabal b/pandoc.cabal
index c441a9439..e35c2e638 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -354,5 +354,6 @@ Executable test-pandoc
Tests.Helpers
Tests.Arbitrary
Tests.Readers.LaTeX
+ Tests.Readers.RST
Tests.Writers.Native
Tests.Writers.ConTeXt
diff --git a/tests/Tests/Readers/RST.hs b/tests/Tests/Readers/RST.hs
new file mode 100644
index 000000000..d404ef0ce
--- /dev/null
+++ b/tests/Tests/Readers/RST.hs
@@ -0,0 +1,46 @@
+{-# 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 defaultParserState{ stateStandalone = True }
+
+infix 5 =:
+(=:) :: ToString c
+ => String -> (String, c) -> Test
+(=:) = test rst
+
+tests :: [Test]
+tests = [ "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
+|] =?> ( setAuthors ["Me","Myself","I"]
+ $ setDate "2001-08-16"
+ $ doc
+ $ definitionList [ (str "Hostname", [plain "media08"])
+ , (str "IP address", [plain "10.0.0.19"])
+ , (str "Size", [plain "3ru"])
+ , (str "Version", [plain "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", [plain "integer"])
+ ])
+ ]
+
diff --git a/tests/test-pandoc.hs b/tests/test-pandoc.hs
index 157f755c4..d5e42f4d0 100644
--- a/tests/test-pandoc.hs
+++ b/tests/test-pandoc.hs
@@ -6,6 +6,7 @@ import Test.Framework
import qualified Tests.Old
import qualified Tests.Readers.LaTeX
+import qualified Tests.Readers.RST
import qualified Tests.Writers.ConTeXt
import qualified Tests.Writers.Native
@@ -17,6 +18,7 @@ tests = [ testGroup "Old" Tests.Old.tests
]
, testGroup "Readers"
[ testGroup "LaTeX" Tests.Readers.LaTeX.tests
+ , testGroup "RST" Tests.Readers.RST.tests
]
]