Copy tests from GHC testsuite; part of #1161.
[packages/base.git] / tests / IO / openFile003.hs
1 import System.Directory
2 import System.IO
3 import System.IO.Error
4
5 -- !!! Open a directory (should fail)
6
7 main = do
8 let dir = "openFile003Dir"
9 createDirectoryIfMissing False dir
10 r <- tryIOError (openFile dir ReadMode)
11 print r
12 r <- tryIOError (openFile dir WriteMode)
13 print r
14 r <- tryIOError (openFile dir AppendMode)
15 print r
16 r <- tryIOError (openFile dir ReadWriteMode)
17 print r