thought of another way to break prop_idempotent_key_decode
This commit is contained in:
parent
e8ab82390e
commit
7f9a0c153b
1 changed files with 9 additions and 1 deletions
10
Types/Key.hs
10
Types/Key.hs
|
@ -97,4 +97,12 @@ prop_idempotent_key_encode :: Key -> Bool
|
|||
prop_idempotent_key_encode k = Just k == (file2key . key2file) k
|
||||
|
||||
prop_idempotent_key_decode :: FilePath -> Bool
|
||||
prop_idempotent_key_decode f = maybe True (\k -> key2file k == f) (file2key f)
|
||||
prop_idempotent_key_decode f
|
||||
| normalfieldorder = maybe True (\k -> key2file k == f) (file2key f)
|
||||
| otherwise = True
|
||||
where
|
||||
-- file2key will accept the fields in any order, so don't
|
||||
-- try the test unless the fields are in the normal order
|
||||
normalfieldorder = fields `isPrefixOf` "sm"
|
||||
fields = map (f !!) $ filter (< length f) $ map succ $
|
||||
elemIndices fieldSep f
|
||||
|
|
Loading…
Add table
Reference in a new issue