aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Tests/Arbitrary.hs6
-rw-r--r--tests/Tests/Writers/Native.hs20
-rw-r--r--tests/test-pandoc.hs2
3 files changed, 24 insertions, 4 deletions
diff --git a/tests/Tests/Arbitrary.hs b/tests/Tests/Arbitrary.hs
index 825902e4c..af882889f 100644
--- a/tests/Tests/Arbitrary.hs
+++ b/tests/Tests/Arbitrary.hs
@@ -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
diff --git a/tests/Tests/Writers/Native.hs b/tests/Tests/Writers/Native.hs
new file mode 100644
index 000000000..234fe938a
--- /dev/null
+++ b/tests/Tests/Writers/Native.hs
@@ -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
+ ]
diff --git a/tests/test-pandoc.hs b/tests/test-pandoc.hs
index faa2735c9..e8f792e2d 100644
--- a/tests/test-pandoc.hs
+++ b/tests/test-pandoc.hs
@@ -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
]
]