git.iko.soy/typeable/pandoc
on master help sign in
Added native writer tests.
373d056John MacFarlane
pandoc.cabal+1
@@ -349,4 +349,5 @@ Executable test-pandoc
349 Tests.Helpers
349 Tests.Helpers
350 Tests.Arbitrary
350 Tests.Arbitrary
351 Tests.Readers.LaTeX
351 Tests.Readers.LaTeX
352+ Tests.Writers.Native
352 Tests.Writers.ConTeXt
353 Tests.Writers.ConTeXt
tests/Tests/Arbitrary.hs+2−4
@@ -91,10 +91,8 @@ arbBlock n = frequency $ [ (10, liftM Plain arbitrary)
91 ]
91 ]
92
92
93instance Arbitrary Pandoc where
93instance Arbitrary Pandoc where
94− arbitrary
94+ arbitrary = resize 8 $ liftM normalize
95− = do x1 <- arbitrary
95+ $ liftM2 Pandoc arbitrary arbitrary
96− x2 <- arbitrary
97− return $ normalize (Pandoc x1 x2)
98
96
99{-
97{-
100instance Arbitrary CitationMode where
98instance Arbitrary CitationMode where
tests/Tests/Writers/Native.hsnew file+20
@@ -0,0 +1,20 @@
1+module Tests.Writers.Native (tests) where
2+
3+import Test.Framework
4+import Text.Pandoc.Builder
5+import Text.Pandoc
6+import Tests.Helpers
7+import Tests.Arbitrary()
8+
9+p_write_rt :: Pandoc -> Bool
10+p_write_rt d =
11+ read (writeNative defaultWriterOptions{ writerStandalone = True } d) == d
12+
13+p_write_blocks_rt :: [Block] -> Bool
14+p_write_blocks_rt bs =
15+ read (writeNative defaultWriterOptions (Pandoc (Meta [] [] []) bs)) == bs
16+
17+tests :: [Test]
18+tests = [ property "p_write_rt" p_write_rt
19+ , property "p_write_blocks_rt" p_write_blocks_rt
20+ ]
tests/test-pandoc.hs+2
@@ -7,6 +7,7 @@ import Test.Framework
7import qualified Tests.Old
7import qualified Tests.Old
8import qualified Tests.Readers.LaTeX
8import qualified Tests.Readers.LaTeX
9import qualified Tests.Writers.ConTeXt
9import qualified Tests.Writers.ConTeXt
10+import qualified Tests.Writers.Native
10
11
11tests :: [Test]
12tests :: [Test]
12tests = [ testGroup "Old" Tests.Old.tests
13tests = [ testGroup "Old" Tests.Old.tests
@@ -15,6 +16,7 @@ tests = [ testGroup "Old" Tests.Old.tests
15 ]
16 ]
16 , testGroup "Writers"
17 , testGroup "Writers"
17 [ testGroup "ConTeXt" Tests.Writers.ConTeXt.tests
18 [ testGroup "ConTeXt" Tests.Writers.ConTeXt.tests
19+ , testGroup "Native" Tests.Writers.Native.tests
18 ]
20 ]
19 ]
21 ]
20
22