[project @ 2000-07-25 15:48:16 by simonmar]
[ghc-hetmet.git] / ghc / tests / io / should_run / io033.hs
1 --- !!! test for bug in handle finalization fixed in 
2 --- !!!  1.60      +1 -2      fptools/ghc/lib/std/PrelHandle.lhs
3 --- !!!  1.15      +4 -10     fptools/ghc/lib/std/PrelIO.lhs
4
5 module Main (main) where
6
7 import IO
8 import System
9
10 doTest :: IO ()
11 doTest = do
12   sd <- openFile "io033.hs" ReadWriteMode
13   result <- hGetContents sd
14   slurp result
15   hClose sd
16   if "" `elem` lines (filter (/= '\r') result)
17    then
18     putStrLn "ok"
19    else
20     putStrLn "fail"
21
22 slurp :: String -> IO ()
23 slurp [] = return ()
24 slurp (x:xs) = x `seq` slurp xs
25
26 main :: IO ()
27 main = sequence_ (take 50 (repeat doTest))