cd8caf6a1576f433f335362111ff32a76aee985e
[ghc-hetmet.git] / ghc / tests / lib / IO / readFile001.stdout
1 -- !!! readFile test
2
3 import IO
4
5 source   = "readFile001.hs"
6 filename = "readFile001.out"
7
8 main = do
9   s <- readFile source
10   h <- openFile filename WriteMode
11   hPutStrLn h s
12   hClose h
13   s <- readFile filename
14
15   -- This open should fail, because the readFile hasn't been forced
16   -- and the file is therefore still locked.  But GHC currently has a
17   -- bug in that the openFile truncates the file before checking
18   -- whether it was locked or not.
19   --    r <- try (openFile filename WriteMode)
20   --    print r
21
22   putStrLn s
23
24   -- should be able to open it for writing now, because we've forced the
25   -- whole file.
26   h <- openFile filename WriteMode
27
28   print h
29
30
31 {loc=readFile001.out,type=writable,binary=False,buffering=block (8192)}