git.iko.soy/typeable/pandoc
on master help sign in
Added Cite to Arbitrary instance.

See #1269. This reveals some test failures.

commitf8a34f1694c9fda3319fcface155eed97608ded1 authorJohn MacFarlane <jgm@berkeley.edu> dateTue 29 Apr 2014, 18:32 (13 years ago) parentb6ae5d5
1 file changed+4−5
tests/Tests/Arbitrary.hs+4−5
tests/Tests/Arbitrary.hs+4−5
@@ -64,6 +64,7 @@ arbInline n = frequency $ [ (60, liftM Str realString)
6464 x3 <- realString
6565 x2 <- liftM escapeURI realString
6666 return $ Image x1 (x2,x3))
67+ , (2, liftM2 Cite arbitrary (arbInlines 1))
6768 , (2, liftM Note $ resize 3 $ listOf1 $ arbBlock (n-1))
6869 ]
6970
@@ -111,7 +112,6 @@ instance Arbitrary Pandoc where
111112 arbitrary = resize 8 $ liftM normalize
112113 $ liftM2 Pandoc arbitrary arbitrary
113114
114−{-
115115instance Arbitrary CitationMode where
116116 arbitrary
117117 = do x <- choose (0 :: Int, 2)
@@ -123,14 +123,13 @@ instance Arbitrary CitationMode where
123123
124124instance Arbitrary Citation where
125125 arbitrary
126− = do x1 <- liftM (filter (`notElem` ",;]@ \t\n")) arbitrary
127− x2 <- arbitrary
128− x3 <- arbitrary
126+ = do x1 <- listOf $ elements $ ['a'..'z'] ++ ['0'..'9'] ++ ['_']
127+ x2 <- arbInlines 1
128+ x3 <- arbInlines 1
129129 x4 <- arbitrary
130130 x5 <- arbitrary
131131 x6 <- arbitrary
132132 return (Citation x1 x2 x3 x4 x5 x6)
133−-}
134133
135134instance Arbitrary MathType where
136135 arbitrary