different way to avoid NUL in Arbitrary AssociatedFile
Test case has been intermittently failing, with an AssociatedFile that somehow contains a NUL despite it being filtered out. My guess is something to do with locales. This new approach should prevent any NUL at all, although it does weigh the distribution a bit more toward Nothing.
This commit is contained in:
parent
6d10fecff4
commit
70395659db
1 changed files with 2 additions and 3 deletions
5
Key.hs
5
Key.hs
|
@ -81,10 +81,9 @@ instance Arbitrary KeyData where
|
|||
-- AssociatedFile cannot be empty, and cannot contain a NUL
|
||||
-- (but can be Nothing)
|
||||
instance Arbitrary AssociatedFile where
|
||||
arbitrary = (AssociatedFile . fmap mk <$> arbitrary)
|
||||
arbitrary = (AssociatedFile . fmap toRawFilePath <$> arbitrary)
|
||||
`suchThat` (/= AssociatedFile (Just S.empty))
|
||||
where
|
||||
mk = toRawFilePath . filter (/= '\NUL')
|
||||
`suchThat` (\(AssociatedFile f) -> maybe True (S.notElem 0) f)
|
||||
|
||||
instance Arbitrary Key where
|
||||
arbitrary = mkKey . const <$> arbitrary
|
||||
|
|
Loading…
Reference in a new issue