git.iko.soy/typeable/pandoc
on master help sign in
Added RST reader tests.
commit066cbbad76a71c3c782216066de3d32fce79af72 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 26 Jan 2011, 09:10 (16 years ago) parentc5384a3
3 files changed+49
pandoc.cabal+1 tests/Tests/Readers/RST.hs+46 tests/test-pandoc.hs+2
pandoc.cabal+1
@@ -354,5 +354,6 @@ Executable test-pandoc
354354 Tests.Helpers
355355 Tests.Arbitrary
356356 Tests.Readers.LaTeX
357+ Tests.Readers.RST
357358 Tests.Writers.Native
358359 Tests.Writers.ConTeXt
tests/Tests/Readers/RST.hsnew file+46
@@ -0,0 +1,46 @@
1+{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
2+module Tests.Readers.RST (tests) where
3+
4+import Text.Pandoc.Definition
5+import Test.Framework
6+import Tests.Helpers
7+import Tests.Arbitrary()
8+import Text.Pandoc.Builder
9+import Text.Pandoc
10+
11+rst :: String -> Pandoc
12+rst = readRST defaultParserState{ stateStandalone = True }
13+
14+infix 5 =:
15+(=:) :: ToString c
16+ => String -> (String, c) -> Test
17+(=:) = test rst
18+
19+tests :: [Test]
20+tests = [ "field list" =:
21+ [_LIT|
22+:Hostname: media08
23+:IP address: 10.0.0.19
24+:Size: 3ru
25+:Date: 2001-08-16
26+:Version: 1
27+:Authors: - Me
28+ - Myself
29+ - I
30+:Indentation: Since the field marker may be quite long, the second
31+ and subsequent lines of the field body do not have to line up
32+ with the first line, but they must be indented relative to the
33+ field name marker, and they must line up with each other.
34+:Parameter i: integer
35+|] =?> ( setAuthors ["Me","Myself","I"]
36+ $ setDate "2001-08-16"
37+ $ doc
38+ $ definitionList [ (str "Hostname", [plain "media08"])
39+ , (str "IP address", [plain "10.0.0.19"])
40+ , (str "Size", [plain "3ru"])
41+ , (str "Version", [plain "1"])
42+ , (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."])
43+ , (str "Parameter i", [plain "integer"])
44+ ])
45+ ]
46+
tests/test-pandoc.hs+2
@@ -6,6 +6,7 @@ import Test.Framework
66
77import qualified Tests.Old
88import qualified Tests.Readers.LaTeX
9+import qualified Tests.Readers.RST
910import qualified Tests.Writers.ConTeXt
1011import qualified Tests.Writers.Native
1112
@@ -17,6 +18,7 @@ tests = [ testGroup "Old" Tests.Old.tests
1718 ]
1819 , testGroup "Readers"
1920 [ testGroup "LaTeX" Tests.Readers.LaTeX.tests
21+ , testGroup "RST" Tests.Readers.RST.tests
2022 ]
2123 ]
2224