git.iko.soy/typeable/pandoc
on master help sign in
Added Cite to Arbitrary instance.
f8a34f1John MacFarlane
tests/Tests/Arbitrary.hs+4−5
@@ -64,6 +64,7 @@ arbInline n = frequency $ [ (60, liftM Str realString)
64 x3 <- realString
64 x3 <- realString
65 x2 <- liftM escapeURI realString
65 x2 <- liftM escapeURI realString
66 return $ Image x1 (x2,x3))
66 return $ Image x1 (x2,x3))
67+ , (2, liftM2 Cite arbitrary (arbInlines 1))
67 , (2, liftM Note $ resize 3 $ listOf1 $ arbBlock (n-1))
68 , (2, liftM Note $ resize 3 $ listOf1 $ arbBlock (n-1))
68 ]
69 ]
69
70
@@ -111,7 +112,6 @@ instance Arbitrary Pandoc where
111 arbitrary = resize 8 $ liftM normalize
112 arbitrary = resize 8 $ liftM normalize
112 $ liftM2 Pandoc arbitrary arbitrary
113 $ liftM2 Pandoc arbitrary arbitrary
113
114
114−{-
115instance Arbitrary CitationMode where
115instance Arbitrary CitationMode where
116 arbitrary
116 arbitrary
117 = do x <- choose (0 :: Int, 2)
117 = do x <- choose (0 :: Int, 2)
@@ -123,14 +123,13 @@ instance Arbitrary CitationMode where
123
123
124instance Arbitrary Citation where
124instance Arbitrary Citation where
125 arbitrary
125 arbitrary
126− = do x1 <- liftM (filter (`notElem` ",;]@ \t\n")) arbitrary
126+ = do x1 <- listOf $ elements $ ['a'..'z'] ++ ['0'..'9'] ++ ['_']
127− x2 <- arbitrary
127+ x2 <- arbInlines 1
128− x3 <- arbitrary
128+ x3 <- arbInlines 1
129 x4 <- arbitrary
129 x4 <- arbitrary
130 x5 <- arbitrary
130 x5 <- arbitrary
131 x6 <- arbitrary
131 x6 <- arbitrary
132 return (Citation x1 x2 x3 x4 x5 x6)
132 return (Citation x1 x2 x3 x4 x5 x6)
133−-}
134
133
135instance Arbitrary MathType where
134instance Arbitrary MathType where
136 arbitrary
135 arbitrary