From faf5415163b3ea7e78335ead4c2baf3d7a283be1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 6 Dec 2019 12:14:55 -0400 Subject: [PATCH] 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. --- Git/Filename.hs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Git/Filename.hs b/Git/Filename.hs index 0b0c4c27bf..1fe0d14158 100644 --- a/Git/Filename.hs +++ b/Git/Filename.hs @@ -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