File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import qualified Data.Text.Lazy.Encoding as LE
28
28
import qualified Data.Text.Unsafe as T
29
29
import qualified Test.Tasty as F
30
30
import qualified Test.Tasty.HUnit as F
31
+ import System.Directory (removeFile )
31
32
32
33
import Tests.Utils (withTempFile )
33
34
@@ -42,12 +43,15 @@ lazy_encode_crash = withTempFile $ \ _ h ->
42
43
-- encoded file can result in a crash in the RTS (i.e. not merely an
43
44
-- exception).
44
45
hGetContents_crash :: IO ()
45
- hGetContents_crash = withTempFile $ \ path h -> do
46
+ hGetContents_crash = do
47
+ (path, h) <- openTempFile " ." " crashy.txt"
46
48
B. hPut h (B. pack [0x78 , 0xc4 ,0x0a ]) >> hClose h
47
49
h' <- openFile path ReadMode
48
50
hSetEncoding h' utf8
49
51
handle (\ (_:: SomeException ) -> return () ) $
50
52
T. hGetContents h' >> assertFailure " T.hGetContents should crash"
53
+ hClose h'
54
+ removeFile path
51
55
52
56
-- Reported by Ian Lynagh: attempting to allocate a sufficiently large
53
57
-- string (via either Array.new or Text.replicate) could result in an
You can’t perform that action at this time.
0 commit comments