git.iko.soy/typeable/pandoc
on master help sign in
Tests.Arbitrary: Added instances for Inlines, Blocks.
d86d926John MacFarlane
tests/Tests/Arbitrary.hs+8
@@ -1,4 +1,5 @@
1{-# OPTIONS_GHC -fno-warn-orphans #-}
1{-# OPTIONS_GHC -fno-warn-orphans #-}
2+{-# LANGUAGE TypeSynonymInstances #-}
2-- provides Arbitrary instance for Pandoc types
3-- provides Arbitrary instance for Pandoc types
3module Tests.Arbitrary ()
4module Tests.Arbitrary ()
4where
5where
@@ -7,6 +8,7 @@ import Test.QuickCheck.Arbitrary
7import Control.Monad (liftM, liftM2)
8import Control.Monad (liftM, liftM2)
8import Text.Pandoc
9import Text.Pandoc
9import Text.Pandoc.Shared
10import Text.Pandoc.Shared
11+import Text.Pandoc.Builder
10
12
11realString :: Gen String
13realString :: Gen String
12realString = elements wordlist
14realString = elements wordlist
@@ -14,6 +16,12 @@ realString = elements wordlist
14wordlist :: [String]
16wordlist :: [String]
15wordlist = ["foo","Bar","baz","\\","/",":","\"","'","féé"]
17wordlist = ["foo","Bar","baz","\\","/",":","\"","'","féé"]
16
18
19+instance Arbitrary Inlines where
20+ arbitrary = liftM fromList arbitrary
21+
22+instance Arbitrary Blocks where
23+ arbitrary = liftM fromList arbitrary
24+
17instance Arbitrary Inline where
25instance Arbitrary Inline where
18 arbitrary = resize 3 $ arbInline 3
26 arbitrary = resize 3 $ arbInline 3
19
27