on master help sign in
Add t_write_hGetContents

--HG-- extra : convert_revision : 9410f635699a52e2880e64bf800267df2c1cc868

commit20edcda6f4d372d1586b9b7a87a1e322dee49e11 authorBryan O'Sullivan <bos@serpentine.com> dateThu 26 Aug 2010, 18:38 (16 years ago) parent9c3ebdd
1 file changed+9−4
tests/Properties.hs+9−4
tests/Properties.hs+9−4
@@ -581,14 +581,18 @@ t_builderAssociative s1 s2 s3 = TB.toLazyText (b1 `mappend` (b2 `mappend` b3)) =
581581
582582-- Input and output.
583583
584−t_write_read (NotEmpty t) = monadicIO $ do
585− r <- run act
586− assert (r == t)
584+t_write_read t = monadicIO $ assert . (==t) =<< run act
587585 where act = withTempFile $ \path h -> do
588586 T.hPutStr h t
589587 hClose h
590588 T.readFile path
591589
590+t_write_hGetContents t = monadicIO $ assert . (==t) =<< run act
591+ where act = withTempFile $ \_path h -> do
592+ T.hPutStr h t
593+ hSeek h AbsoluteSeek 0
594+ T.hGetContents h
595+
592596-- Low-level.
593597
594598t_dropWord16 m t = dropWord16 m t `T.isSuffixOf` t
@@ -981,7 +985,8 @@ tests = [
981985 ],
982986
983987 testGroup "io" [
984− testProperty "t_write_read" t_write_read
988+ testProperty "t_write_read" t_write_read,
989+ testProperty "t_write_hGetContents" t_write_hGetContents
985990 ],
986991
987992 testGroup "lowlevel" [