summaryrefslogtreecommitdiff
path: root/Types
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-03-26 16:40:52 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-03-26 16:40:52 -0400
commitf2ecf753ca62c284a68ca0272b65b5092e346abf (patch)
treead477e43a731180cecd1ba8fd778ba2bbdca15ac /Types
parentac0f0416b501f4a1d1332a1b78634df0f0d1ae8b (diff)
avoid generating arbitrary MetaData with illegal fields
Diffstat (limited to 'Types')
-rw-r--r--Types/MetaData.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Types/MetaData.hs b/Types/MetaData.hs
index 706d037bc..8df56734d 100644
--- a/Types/MetaData.hs
+++ b/Types/MetaData.hs
@@ -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