avoid generating arbitrary MetaData with illegal fields

This commit is contained in:
Joey Hess 2014-03-26 16:40:52 -04:00
parent eb3b6b7e09
commit 5c79fa0351
Failed to extract signature
2 changed files with 6 additions and 1 deletions

View file

@ -264,7 +264,9 @@ parseMetaData p = (,)
instance Arbitrary MetaData where
arbitrary = do
size <- arbitrarySizedBoundedIntegral `suchThat` (< 500)
MetaData . M.fromList <$> vector size
MetaData . M.filterWithKey legal . M.fromList <$> vector size
where
legal k _v = legalField $ fromMetaField k
instance Arbitrary MetaValue where
arbitrary = MetaValue <$> arbitrary <*> arbitrary

View file

@ -62,3 +62,6 @@ e s tDse.t
# End of transcript or log.
"""]]
> A sort of windows-specific bug in the test suite. I've fixed it. [[done]]
> --[[Joey]]