diff options
author | Joey Hess <joey@kitenet.net> | 2014-03-05 00:23:22 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-03-05 00:23:22 -0400 |
commit | 1bccef7791a0510d11d6d487ce2e116677cccf94 (patch) | |
tree | ff04e22e191839038596a54e05b09c029ac24331 /Types/Key.hs | |
parent | 93405153c154b6ecd02f377757fad06b413eb434 (diff) |
thought of another way to break prop_idempotent_key_decode
Diffstat (limited to 'Types/Key.hs')
-rw-r--r-- | Types/Key.hs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Types/Key.hs b/Types/Key.hs index ea142e4aa..26af6220f 100644 --- a/Types/Key.hs +++ b/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 |