add back lost filtering of multibyte chars in prop_encode_decode_roundtrip

I had thought using ByteString would avoid the problem, but the
quickcheck property is still taking Arbitrary String input, so the use
of ByteString internally doesn't matter.
This commit is contained in:
Joey Hess 2019-12-06 12:14:55 -04:00
parent 3266ad3ff7
commit faf5415163
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -35,6 +35,13 @@ decode b = case S.uncons b of
encode :: RawFilePath -> S.ByteString
encode s = encodeBS $ "\"" ++ encode_c (decodeBS s) ++ "\""
{- For quickcheck. -}
{- For quickcheck.
-
- See comment on Utility.Format.prop_encode_c_decode_c
-_roundtrip for
- why this only tests chars < 256
-}
prop_encode_decode_roundtrip :: FilePath -> Bool
prop_encode_decode_roundtrip s = s == fromRawFilePath (decode (encode (toRawFilePath s)))
prop_encode_decode_roundtrip s = s' == fromRawFilePath (decode (encode (toRawFilePath s')))
where
s' = filter (\c -> ord c < 256) s