Added native writer tests.

This commit is contained in:
John MacFarlane 2011-01-22 12:28:30 -08:00
parent 209b300d6a
commit 373d05601a
4 changed files with 25 additions and 4 deletions

View file

@ -349,4 +349,5 @@ Executable test-pandoc
Tests.Helpers
Tests.Arbitrary
Tests.Readers.LaTeX
Tests.Writers.Native
Tests.Writers.ConTeXt

View file

@ -91,10 +91,8 @@ arbBlock n = frequency $ [ (10, liftM Plain arbitrary)
]
instance Arbitrary Pandoc where
arbitrary
= do x1 <- arbitrary
x2 <- arbitrary
return $ normalize (Pandoc x1 x2)
arbitrary = resize 8 $ liftM normalize
$ liftM2 Pandoc arbitrary arbitrary
{-
instance Arbitrary CitationMode where

View file

@ -0,0 +1,20 @@
module Tests.Writers.Native (tests) where
import Test.Framework
import Text.Pandoc.Builder
import Text.Pandoc
import Tests.Helpers
import Tests.Arbitrary()
p_write_rt :: Pandoc -> Bool
p_write_rt d =
read (writeNative defaultWriterOptions{ writerStandalone = True } d) == d
p_write_blocks_rt :: [Block] -> Bool
p_write_blocks_rt bs =
read (writeNative defaultWriterOptions (Pandoc (Meta [] [] []) bs)) == bs
tests :: [Test]
tests = [ property "p_write_rt" p_write_rt
, property "p_write_blocks_rt" p_write_blocks_rt
]

View file

@ -7,6 +7,7 @@ import Test.Framework
import qualified Tests.Old
import qualified Tests.Readers.LaTeX
import qualified Tests.Writers.ConTeXt
import qualified Tests.Writers.Native
tests :: [Test]
tests = [ testGroup "Old" Tests.Old.tests
@ -15,6 +16,7 @@ tests = [ testGroup "Old" Tests.Old.tests
]
, testGroup "Writers"
[ testGroup "ConTeXt" Tests.Writers.ConTeXt.tests
, testGroup "Native" Tests.Writers.Native.tests
]
]