on master help sign in
Try I/O in all supported locales
7132962Bryan O'Sullivan
tests/Properties.hs+19−5
@@ -582,13 +582,13 @@ t_builderAssociative s1 s2 s3 = TB.toLazyText (b1 `mappend` (b2 `mappend` b3)) =
582
582
583-- Input and output.
583-- Input and output.
584
584
585−write_read writer reader t = monadicIO $ assert . (==t) =<< run act
585+write_read writer reader locale t = monadicIO $ assert . (==t) =<< run act
586 where act = withTempFile $ \path h -> do
586 where act = withTempFile $ \path h -> do
587− hSetEncoding h utf8
587+ hSetEncoding h locale
588 () <- writer h t
588 () <- writer h t
589 hClose h
589 hClose h
590 bracket (openFile path ReadMode) hClose $ \h' -> do
590 bracket (openFile path ReadMode) hClose $ \h' -> do
591− hSetEncoding h' utf8
591+ hSetEncoding h' locale
592 reader h'
592 reader h'
593
593
594t_write_read = write_read T.hPutStr T.hGetContents
594t_write_read = write_read T.hPutStr T.hGetContents
@@ -987,8 +987,22 @@ tests = [
987 ],
987 ],
988
988
989 testGroup "input-output" [
989 testGroup "input-output" [
990− testProperty "t_write_read" t_write_read,
990+ testProperty "t_write_read_8" $ t_write_read utf8,
991− testProperty "tl_write_read" tl_write_read
991+ testProperty "t_write_read_8bom" $ t_write_read utf8_bom,
992+ testProperty "t_write_read_16" $ t_write_read utf16,
993+ testProperty "t_write_read_16le" $ t_write_read utf16le,
994+ testProperty "t_write_read_16be" $ t_write_read utf16be,
995+ testProperty "t_write_read_32" $ t_write_read utf32,
996+ testProperty "t_write_read_32le" $ t_write_read utf32le,
997+ testProperty "t_write_read_32be" $ t_write_read utf32be,
998+ testProperty "tl_write_read_8" $ tl_write_read utf8,
999+ testProperty "tl_write_read_8bom" $ tl_write_read utf8_bom,
1000+ testProperty "tl_write_read_16" $ tl_write_read utf16,
1001+ testProperty "tl_write_read_16le" $ tl_write_read utf16le,
1002+ testProperty "tl_write_read_16be" $ tl_write_read utf16be,
1003+ testProperty "tl_write_read_32" $ tl_write_read utf32,
1004+ testProperty "tl_write_read_32le" $ tl_write_read utf32le,
1005+ testProperty "tl_write_read_32be" $ tl_write_read utf32be
992 ],
1006 ],
993
1007
994 testGroup "lowlevel" [
1008 testGroup "lowlevel" [