@@ -93,6 +93,17 @@ tl_utf32LE = forAll genUnicode $ (EL.decodeUtf32LE . EL.encodeUtf32LE) `eq` id
9393t_utf32BE = forAll genUnicode $ (E.decodeUtf32BE . E.encodeUtf32BE) `eq` id
9494tl_utf32BE = forAll genUnicode $ (EL.decodeUtf32BE . EL.encodeUtf32BE) `eq` id
9595
96+t_utf8_incr = do
97+ Positive n <- arbitrary
98+ forAll genUnicode $ recode n `eq` id
99+ where recode n = T.concat . feedChunksOf n (E.decodeUtf8With' strictDecode) . E.encodeUtf8
100+ feedChunksOf :: Int -> (B.ByteString -> E.Decoder) -> B.ByteString -> [T.Text]
101+ feedChunksOf n f bs
102+ | B.null bs = []
103+ | otherwise = let (a,b) = B.splitAt n bs
104+ E.Some t f' = f a
105+ in t : feedChunksOf n f' b
106+
96107-- This is a poor attempt to ensure that the error handling paths on
97108-- decode are exercised in some way. Proper testing would be rather
98109-- more involved.
@@ -771,6 +782,7 @@ tests =
771782 testProperty "tl_latin1" tl_latin1,
772783 testProperty "t_utf8" t_utf8,
773784 testProperty "t_utf8'" t_utf8',
785+ testProperty "t_utf8_incr" t_utf8_incr,
774786 testProperty "tl_utf8" tl_utf8,
775787 testProperty "tl_utf8'" tl_utf8',
776788 testProperty "t_utf16LE" t_utf16LE,