Commit ce76f539 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Tweak openFile003

It tried opening . for writing, which confused the driver into thinking
it was writing something but not removing it. So changed to use a
different directory instead.
parent 6d22763e
......@@ -70,7 +70,7 @@ test('misc001',
test('openFile001', normal, compile_and_run, [''])
test('openFile002', exit_code(1), compile_and_run, [''])
test('openFile003', normal, compile_and_run, [''])
test('openFile003', extra_clean(['openFile003Dir']), compile_and_run, [''])
test('openFile004', extra_clean(['openFile004.out']), compile_and_run, [''])
test('openFile005',
[if_compiler_type('hugs', expect_fail),
......
import System.Directory
import System.IO
import System.IO.Error
-- !!! Open a directory (should fail)
main = do
r <- tryIOError (openFile "." ReadMode)
let dir = "openFile003Dir"
createDirectoryIfMissing False dir
r <- tryIOError (openFile dir ReadMode)
print r
r <- tryIOError (openFile "." WriteMode)
r <- tryIOError (openFile dir WriteMode)
print r
r <- tryIOError (openFile "." AppendMode)
r <- tryIOError (openFile dir AppendMode)
print r
r <- tryIOError (openFile "." ReadWriteMode)
r <- tryIOError (openFile dir ReadWriteMode)
print r
Left .: openFile: inappropriate type (is a directory)
Left .: openFile: inappropriate type (Is a directory)
Left .: openFile: inappropriate type (Is a directory)
Left .: openFile: inappropriate type (Is a directory)
Left openFile003Dir: openFile: inappropriate type (is a directory)
Left openFile003Dir: openFile: inappropriate type (Is a directory)
Left openFile003Dir: openFile: inappropriate type (Is a directory)
Left openFile003Dir: openFile: inappropriate type (Is a directory)
Left .: openFile: permission denied (Permission denied)
Left .: openFile: permission denied (Permission denied)
Left .: openFile: permission denied (Permission denied)
Left .: openFile: permission denied (Permission denied)
Left openFile003Dir: openFile: permission denied (Permission denied)
Left openFile003Dir: openFile: permission denied (Permission denied)
Left openFile003Dir: openFile: permission denied (Permission denied)
Left openFile003Dir: openFile: permission denied (Permission denied)
Left .: openFile: inappropriate type (is a directory)
Left .: openFile: invalid argument (Invalid argument)
Left .: openFile: invalid argument (Invalid argument)
Left .: openFile: invalid argument (Invalid argument)
Left openFile003Dir: openFile: inappropriate type (is a directory)
Left openFile003Dir: openFile: invalid argument (Invalid argument)
Left openFile003Dir: openFile: invalid argument (Invalid argument)
Left openFile003Dir: openFile: invalid argument (Invalid argument)
Left permission denied
Action: openFile
Reason: Permission denied
File: .
File: openFile003Dir
Left permission denied
Action: openFile
Reason: Permission denied
File: .
File: openFile003Dir
Left permission denied
Action: openFile
Reason: Permission denied
File: .
File: openFile003Dir
Left permission denied
Action: openFile
Reason: Permission denied
File: .
File: openFile003Dir
Left .: openFile: inappropriate type (is a directory)
Left .: openFile: invalid argument (Invalid argument)
Left .: openFile: invalid argument (Invalid argument)
Left .: openFile: invalid argument (Invalid argument)
Left openFile003Dir: openFile: inappropriate type (is a directory)
Left openFile003Dir: openFile: invalid argument (Invalid argument)
Left openFile003Dir: openFile: invalid argument (Invalid argument)
Left openFile003Dir: openFile: invalid argument (Invalid argument)
Left .: openFile: inappropriate type (is a directory)
Left .: openFile: invalid argument (Invalid argument)
Left .: openFile: invalid argument (Invalid argument)
Left .: openFile: invalid argument (Invalid argument)
Left openFile003Dir: openFile: inappropriate type (is a directory)
Left openFile003Dir: openFile: invalid argument (Invalid argument)
Left openFile003Dir: openFile: invalid argument (Invalid argument)
Left openFile003Dir: openFile: invalid argument (Invalid argument)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment