diff options
Diffstat (limited to 'testsuite/tests/lib/IO/openFile001.hs')
-rw-r--r-- | testsuite/tests/lib/IO/openFile001.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/testsuite/tests/lib/IO/openFile001.hs b/testsuite/tests/lib/IO/openFile001.hs new file mode 100644 index 0000000000..f34f093d38 --- /dev/null +++ b/testsuite/tests/lib/IO/openFile001.hs @@ -0,0 +1,11 @@ +-- !!! test that a file opened in ReadMode can't be written to + +import System.IO +import System.IO.Error + +main = do + hIn <- openFile "openFile001.hs" ReadMode + hPutStr hIn "test" `catchIOError` \ err -> + if isIllegalOperation err + then putStrLn "ok." + else error "Oh dear\n" |