Skip to content

Commit 9add1b7

Browse files
committed
Add CustomFormat, modify JATS sub-format relation
1 parent 5ccd7ba commit 9add1b7

File tree

3 files changed

+258
-146
lines changed

3 files changed

+258
-146
lines changed

src/Text/Pandoc/Arbitrary.hs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,16 @@ instance Arbitrary ListNumberDelim where
401401
3 -> return TwoParens
402402
_ -> error "FATAL ERROR: Arbitrary instance, logic bug"
403403

404-
instance Arbitrary F.Format where
404+
instance Arbitrary F.KnownFormat where
405405
arbitrary = arbitraryBoundedEnum
406406

407+
instance Arbitrary F.Format where
408+
arbitrary = frequency $ [(80, F.KnownFormat <$> arbitrary)
409+
,(20, F.CustomFormat . T.pack <$> arbitrary)]
410+
shrink F.KnownFormat{} = []
411+
shrink (F.CustomFormat t) = F.CustomFormat <$> shrinkText t
412+
407413
instance Arbitrary F.Formats where
408414
arbitrary = F.exactly <$> arbitrary
409-
shrink (F.Formats s) = F.exactly <$> shrink (Set.toList s)
415+
shrink (F.OneOfFormats s) = F.exactly <$> shrink (Set.toList s)
416+
shrink (F.NoneOfFormats s) = F.exactlyNone <$> shrink (Set.toList s)

0 commit comments

Comments
 (0)