avoid whitespace in Arbitrary UUID and empty UUID

This commit is contained in:
Joey Hess 2019-03-06 14:57:36 -04:00
parent 6ef38df881
commit c6c5f6336b
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -90,4 +90,8 @@ instance Arbitrary UUID where
-- Avoid non-ascii because fully arbitrary
-- strings may not be encoded using the filesystem
-- encoding, which is normally applied to all input.
arb = encodeBS <$> arbitrary `suchThat` all isAscii
-- Avoid whitespace because UUIDs are used in log files.
-- Avoid empty because that's NoUUID
arb = encodeBS . getNonEmpty <$> arbitrary
`suchThat` (all isAscii . getNonEmpty)
`suchThat` (all (not . isSpace) . getNonEmpty)