add an extra test that correct utf8 doesn't disappear
authorKubo Kovac <kuko@fb.com>
Mon, 22 May 2017 16:58:43 +0000 (17:58 +0100)
committerJakub Kovac <kuko@localhost.localdomain>
Wed, 5 Jul 2017 12:47:04 +0000 (14:47 +0200)
tests/Tests/Properties.hs

index 04156d9..ec9a1fd 100644 (file)
@@ -203,6 +203,10 @@ t_decode_with_error4' =
   case E.streamDecodeUtf8With (\_ _ -> Just 'x') (B.pack [0xC2, 97, 97, 97]) of
     E.Some x _ _ -> x === "xaaa"
 
+t_infix_concat bs1 text bs2 rep =
+  text `T.isInfixOf`
+    E.decodeUtf8With (\_ _ -> rep) (B.concat [bs1, E.encodeUtf8 text, bs2])
+
 s_Eq s            = (s==)    `eq` ((S.streamList s==) . S.streamList)
     where _types = s :: String
 sf_Eq p s =
@@ -985,7 +989,8 @@ tests =
         testProperty "t_decode_with_error4" t_decode_with_error4,
         testProperty "t_decode_with_error2'" t_decode_with_error2',
         testProperty "t_decode_with_error3'" t_decode_with_error3',
-        testProperty "t_decode_with_error4'" t_decode_with_error4'
+        testProperty "t_decode_with_error4'" t_decode_with_error4',
+        testProperty "t_infix_concat" t_infix_concat
       ]
     ],