summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/lib
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-02-05 17:00:55 +0000
committerIan Lynagh <igloo@earth.li>2011-02-05 17:00:55 +0000
commitd421a688c35b4796ea0a957363f5ddd00c1e2691 (patch)
treec82de027f9204e0519cd5e21fa99445cee20498f /testsuite/tests/ghc-regress/lib
parent32bdc52e856797c4e28501d5374de8133b682f28 (diff)
downloadhaskell-d421a688c35b4796ea0a957363f5ddd00c1e2691.tar.gz
Remove the haskell98 dependency from the lib/IO tests
Diffstat (limited to 'testsuite/tests/ghc-regress/lib')
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/IOError002.hs2
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/countReaders001.hs5
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/hClose001.hs5
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/hDuplicateTo001.hs2
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/hFileSize001.hs2
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/hFileSize001.stdout2
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/hFileSize002.hs6
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/hFlush001.hs6
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/hGetBuffering001.hs2
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/hGetChar001.hs2
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/hGetLine002.hs2
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/hGetLine003.hs2
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/hIsEOF001.hs2
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/hSetBuffering002.hs2
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/hSetBuffering002.stdout2
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/hSetBuffering003.hs2
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/isEOF001.hs2
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/misc001.hs8
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/openFile001.hs5
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/openFile002.hs4
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/openFile003.hs11
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/openFile004.hs8
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/openFile005.hs13
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/openFile006.hs2
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/openFile007.hs7
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/readFile001.hs5
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/readFile001.stdout5
27 files changed, 62 insertions, 54 deletions
diff --git a/testsuite/tests/ghc-regress/lib/IO/IOError002.hs b/testsuite/tests/ghc-regress/lib/IO/IOError002.hs
index 56a82ef06c..144e62783b 100644
--- a/testsuite/tests/ghc-regress/lib/IO/IOError002.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/IOError002.hs
@@ -1,5 +1,5 @@
-- !!! IOErrors should have Eq defined
-import IO
+import System.IO
main = print (userError "urk" == userError "urk")
diff --git a/testsuite/tests/ghc-regress/lib/IO/countReaders001.hs b/testsuite/tests/ghc-regress/lib/IO/countReaders001.hs
index 7917060657..2648ae77ae 100644
--- a/testsuite/tests/ghc-regress/lib/IO/countReaders001.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/countReaders001.hs
@@ -2,7 +2,8 @@
-- there are rather than closing the first read handle causing the
-- lock to be released.
-import IO
+import System.IO
+import System.IO.Error
file = "countReaders001.txt"
@@ -12,5 +13,5 @@ main = do
h1 <- openFile file ReadMode
h2 <- openFile file ReadMode
hClose h1
- try (openFile file AppendMode) >>= print
+ tryIOError (openFile file AppendMode) >>= print
diff --git a/testsuite/tests/ghc-regress/lib/IO/hClose001.hs b/testsuite/tests/ghc-regress/lib/IO/hClose001.hs
index b630fdc317..8d31447e95 100644
--- a/testsuite/tests/ghc-regress/lib/IO/hClose001.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/hClose001.hs
@@ -1,7 +1,8 @@
-import IO
+import System.IO
+import System.IO.Error
main = do
h <- openFile "hClose001.tmp" WriteMode
hPutStr h "junk"
hClose h
- hPutStr h "junk" `catch` \ err -> if isIllegalOperation err then putStr "Okay\n" else error "Not okay\n"
+ hPutStr h "junk" `catchIOError` \ err -> if isIllegalOperation err then putStr "Okay\n" else error "Not okay\n"
diff --git a/testsuite/tests/ghc-regress/lib/IO/hDuplicateTo001.hs b/testsuite/tests/ghc-regress/lib/IO/hDuplicateTo001.hs
index f21ca86a4b..5a1484a012 100644
--- a/testsuite/tests/ghc-regress/lib/IO/hDuplicateTo001.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/hDuplicateTo001.hs
@@ -1,6 +1,6 @@
import GHC.Handle
import GHC.IOBase
-import IO
+import System.IO
import Control.Concurrent.MVar
import Data.Typeable
import qualified GHC.IO.FD as FD
diff --git a/testsuite/tests/ghc-regress/lib/IO/hFileSize001.hs b/testsuite/tests/ghc-regress/lib/IO/hFileSize001.hs
index 6326425095..62b3e88b9c 100644
--- a/testsuite/tests/ghc-regress/lib/IO/hFileSize001.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/hFileSize001.hs
@@ -1,4 +1,4 @@
-import IO
+import System.IO
-- !!! test hFileSize
diff --git a/testsuite/tests/ghc-regress/lib/IO/hFileSize001.stdout b/testsuite/tests/ghc-regress/lib/IO/hFileSize001.stdout
index d136d6a714..94361d49fd 100644
--- a/testsuite/tests/ghc-regress/lib/IO/hFileSize001.stdout
+++ b/testsuite/tests/ghc-regress/lib/IO/hFileSize001.stdout
@@ -1 +1 @@
-125
+132
diff --git a/testsuite/tests/ghc-regress/lib/IO/hFileSize002.hs b/testsuite/tests/ghc-regress/lib/IO/hFileSize002.hs
index d2213bfc4a..6c1ad2f57a 100644
--- a/testsuite/tests/ghc-regress/lib/IO/hFileSize002.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/hFileSize002.hs
@@ -1,9 +1,9 @@
-- !!! Testing IO.hFileSize
module Main(main) where
-import IO
-import Directory ( removeFile, doesFileExist )
-import Monad
+import Control.Monad
+import System.Directory ( removeFile, doesFileExist )
+import System.IO
main = do
sz <- hFileSize stdin `catch` (\ _ -> return (-1))
diff --git a/testsuite/tests/ghc-regress/lib/IO/hFlush001.hs b/testsuite/tests/ghc-regress/lib/IO/hFlush001.hs
index 059b3adc1a..78c7b7eeb3 100644
--- a/testsuite/tests/ghc-regress/lib/IO/hFlush001.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/hFlush001.hs
@@ -1,9 +1,9 @@
-- !!! Flushing
module Main(main) where
-import IO
-import Directory ( removeFile, doesFileExist )
-import Monad
+import Control.Monad
+import System.Directory ( removeFile, doesFileExist )
+import System.IO
main = do
hFlush stdin `catch` \ _ -> putStrLn "No can do - flushing read-only handles isn't legal"
diff --git a/testsuite/tests/ghc-regress/lib/IO/hGetBuffering001.hs b/testsuite/tests/ghc-regress/lib/IO/hGetBuffering001.hs
index 9b956b0073..83188b2796 100644
--- a/testsuite/tests/ghc-regress/lib/IO/hGetBuffering001.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/hGetBuffering001.hs
@@ -1,4 +1,4 @@
-import IO
+import System.IO
main =
sequence (map hIsOpen [stdin, stdout, stderr]) >>= \ opens ->
diff --git a/testsuite/tests/ghc-regress/lib/IO/hGetChar001.hs b/testsuite/tests/ghc-regress/lib/IO/hGetChar001.hs
index 18ba4fe40b..f5ca666828 100644
--- a/testsuite/tests/ghc-regress/lib/IO/hGetChar001.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/hGetChar001.hs
@@ -1,4 +1,4 @@
-import IO
+import System.IO
main = do
hSetBuffering stdout NoBuffering
diff --git a/testsuite/tests/ghc-regress/lib/IO/hGetLine002.hs b/testsuite/tests/ghc-regress/lib/IO/hGetLine002.hs
index 80404d21db..5c08b716d1 100644
--- a/testsuite/tests/ghc-regress/lib/IO/hGetLine002.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/hGetLine002.hs
@@ -5,7 +5,7 @@
--
-- However, we don't believe that this is the right behaviour.
-import IO
+import System.IO
main = catch loop (\e -> print e)
diff --git a/testsuite/tests/ghc-regress/lib/IO/hGetLine003.hs b/testsuite/tests/ghc-regress/lib/IO/hGetLine003.hs
index b69fff8f47..cc03c604aa 100644
--- a/testsuite/tests/ghc-regress/lib/IO/hGetLine003.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/hGetLine003.hs
@@ -1,4 +1,4 @@
-import IO
+import System.IO
main = f stdin
where f h = do p <- hIsEOF h
diff --git a/testsuite/tests/ghc-regress/lib/IO/hIsEOF001.hs b/testsuite/tests/ghc-regress/lib/IO/hIsEOF001.hs
index b63c1d41db..2e5dbdcb0a 100644
--- a/testsuite/tests/ghc-regress/lib/IO/hIsEOF001.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/hIsEOF001.hs
@@ -1,6 +1,6 @@
-- !!! hIsEOF (on stdout)
-import IO ( hIsEOF, stdout )
+import System.IO ( hIsEOF, stdout )
main = do
flg <- hIsEOF stdout `catch` \ _ -> putStrLn "hIsEOF failed" >> return False
diff --git a/testsuite/tests/ghc-regress/lib/IO/hSetBuffering002.hs b/testsuite/tests/ghc-regress/lib/IO/hSetBuffering002.hs
index 396d4353c9..3f553029da 100644
--- a/testsuite/tests/ghc-regress/lib/IO/hSetBuffering002.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/hSetBuffering002.hs
@@ -1,4 +1,4 @@
-import IO
+import System.IO
main =
hSetBuffering stdin NoBuffering >>
diff --git a/testsuite/tests/ghc-regress/lib/IO/hSetBuffering002.stdout b/testsuite/tests/ghc-regress/lib/IO/hSetBuffering002.stdout
index 396d4353c9..3f553029da 100644
--- a/testsuite/tests/ghc-regress/lib/IO/hSetBuffering002.stdout
+++ b/testsuite/tests/ghc-regress/lib/IO/hSetBuffering002.stdout
@@ -1,4 +1,4 @@
-import IO
+import System.IO
main =
hSetBuffering stdin NoBuffering >>
diff --git a/testsuite/tests/ghc-regress/lib/IO/hSetBuffering003.hs b/testsuite/tests/ghc-regress/lib/IO/hSetBuffering003.hs
index 424be16465..74d399e4ff 100644
--- a/testsuite/tests/ghc-regress/lib/IO/hSetBuffering003.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/hSetBuffering003.hs
@@ -1,7 +1,7 @@
-- !!! Reconfiguring the buffering of a handle
module Main(main) where
-import IO
+import System.IO
queryBuffering :: String -> Handle -> IO ()
queryBuffering handle_nm handle = do
diff --git a/testsuite/tests/ghc-regress/lib/IO/isEOF001.hs b/testsuite/tests/ghc-regress/lib/IO/isEOF001.hs
index c5f552f6b7..bb205703f8 100644
--- a/testsuite/tests/ghc-regress/lib/IO/isEOF001.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/isEOF001.hs
@@ -1,3 +1,3 @@
-import IO
+import System.IO
main = isEOF >>= print
diff --git a/testsuite/tests/ghc-regress/lib/IO/misc001.hs b/testsuite/tests/ghc-regress/lib/IO/misc001.hs
index c536f7d03a..9f9f3e98d0 100644
--- a/testsuite/tests/ghc-regress/lib/IO/misc001.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/misc001.hs
@@ -1,8 +1,8 @@
-import IO
+import System.IO
-import System (getArgs)
-import Char (toUpper)
-import Directory (removeFile, doesFileExist)
+import Data.Char (toUpper)
+import System.Directory (removeFile, doesFileExist)
+import System.Environment (getArgs)
main = do
[f1,f2] <- getArgs
diff --git a/testsuite/tests/ghc-regress/lib/IO/openFile001.hs b/testsuite/tests/ghc-regress/lib/IO/openFile001.hs
index 02e14034aa..f34f093d38 100644
--- a/testsuite/tests/ghc-regress/lib/IO/openFile001.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/openFile001.hs
@@ -1,10 +1,11 @@
-- !!! test that a file opened in ReadMode can't be written to
-import IO
+import System.IO
+import System.IO.Error
main = do
hIn <- openFile "openFile001.hs" ReadMode
- hPutStr hIn "test" `catch` \ err ->
+ hPutStr hIn "test" `catchIOError` \ err ->
if isIllegalOperation err
then putStrLn "ok."
else error "Oh dear\n"
diff --git a/testsuite/tests/ghc-regress/lib/IO/openFile002.hs b/testsuite/tests/ghc-regress/lib/IO/openFile002.hs
index 615947e20e..83822621f6 100644
--- a/testsuite/tests/ghc-regress/lib/IO/openFile002.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/openFile002.hs
@@ -1,5 +1,5 @@
-import Char
-import IO
+import Data.Char
+import System.IO
-- !!! Open a non-existent file for reading (should fail)
diff --git a/testsuite/tests/ghc-regress/lib/IO/openFile003.hs b/testsuite/tests/ghc-regress/lib/IO/openFile003.hs
index 77900f04c1..81b69c40ec 100644
--- a/testsuite/tests/ghc-regress/lib/IO/openFile003.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/openFile003.hs
@@ -1,13 +1,14 @@
-import IO
+import System.IO
+import System.IO.Error
-- !!! Open a directory (should fail)
main = do
- r <- try (openFile "." ReadMode)
+ r <- tryIOError (openFile "." ReadMode)
print r
- r <- try (openFile "." WriteMode)
+ r <- tryIOError (openFile "." WriteMode)
print r
- r <- try (openFile "." AppendMode)
+ r <- tryIOError (openFile "." AppendMode)
print r
- r <- try (openFile "." ReadWriteMode)
+ r <- tryIOError (openFile "." ReadWriteMode)
print r
diff --git a/testsuite/tests/ghc-regress/lib/IO/openFile004.hs b/testsuite/tests/ghc-regress/lib/IO/openFile004.hs
index da6443f014..4124abb0de 100644
--- a/testsuite/tests/ghc-regress/lib/IO/openFile004.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/openFile004.hs
@@ -1,9 +1,9 @@
-- !!! Open a non-existent file for writing
-import Char
-import IO
-import Directory
-import Monad
+import Control.Monad
+import Data.Char
+import System.Directory
+import System.IO
file = "openFile004.out"
diff --git a/testsuite/tests/ghc-regress/lib/IO/openFile005.hs b/testsuite/tests/ghc-regress/lib/IO/openFile005.hs
index e75e5b8c64..d8a8f83453 100644
--- a/testsuite/tests/ghc-regress/lib/IO/openFile005.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/openFile005.hs
@@ -1,6 +1,7 @@
-- !!! test multiple-reader single-writer locking semantics
-import IO
+import System.IO
+import System.IO.Error
file1 = "openFile005.out1"
file2 = "openFile005.out2"
@@ -8,27 +9,27 @@ file2 = "openFile005.out2"
main = do
putStrLn "two writes (should fail)"
h <- openFile file1 WriteMode
- try (openFile file1 WriteMode) >>= print
+ tryIOError (openFile file1 WriteMode) >>= print
hClose h
putStrLn "write and an append (should fail)"
h <- openFile file1 WriteMode
- try (openFile file1 AppendMode) >>= print
+ tryIOError (openFile file1 AppendMode) >>= print
hClose h
putStrLn "read/write and a write (should fail)"
h <- openFile file1 ReadWriteMode
- try (openFile file1 WriteMode) >>= print
+ tryIOError (openFile file1 WriteMode) >>= print
hClose h
putStrLn "read and a read/write (should fail)"
h <- openFile file1 ReadMode
- try (openFile file1 ReadWriteMode) >>= print
+ tryIOError (openFile file1 ReadWriteMode) >>= print
hClose h
putStrLn "write and a read (should fail)"
h <- openFile file1 WriteMode
- try (openFile file1 ReadMode) >>= print
+ tryIOError (openFile file1 ReadMode) >>= print
hClose h
putStrLn "two writes, different files (silly, but should succeed)"
diff --git a/testsuite/tests/ghc-regress/lib/IO/openFile006.hs b/testsuite/tests/ghc-regress/lib/IO/openFile006.hs
index 0b9eafc158..63cfea1a87 100644
--- a/testsuite/tests/ghc-regress/lib/IO/openFile006.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/openFile006.hs
@@ -1,6 +1,6 @@
-- !!! opening a file in WriteMode better truncate it
-import IO
+import System.IO
main = do
h <- openFile "openFile006.out" AppendMode
diff --git a/testsuite/tests/ghc-regress/lib/IO/openFile007.hs b/testsuite/tests/ghc-regress/lib/IO/openFile007.hs
index 9c3f8be440..e39ed6538f 100644
--- a/testsuite/tests/ghc-regress/lib/IO/openFile007.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/openFile007.hs
@@ -1,7 +1,8 @@
-- !!! check that we don't truncate files if the open fails
-import IO
-import Monad
+import Control.Monad
+import System.IO
+import System.IO.Error
tmp = "openFile007.out"
@@ -10,7 +11,7 @@ main = do
hPutStrLn h "hello, world"
-- second open in write mode better fail, but better not truncate the file
- try (openFile tmp WriteMode) >>= print
+ tryIOError (openFile tmp WriteMode) >>= print
hClose h
s <- readFile tmp -- make sure our "hello, world" is still there
diff --git a/testsuite/tests/ghc-regress/lib/IO/readFile001.hs b/testsuite/tests/ghc-regress/lib/IO/readFile001.hs
index 6ce87ed3b3..e4a2b34cb7 100644
--- a/testsuite/tests/ghc-regress/lib/IO/readFile001.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/readFile001.hs
@@ -1,6 +1,7 @@
-- !!! readFile test
-import IO
+import System.IO
+import System.IO.Error
source = "readFile001.hs"
filename = "readFile001.out"
@@ -14,7 +15,7 @@ main = do
-- This open should fail, because the readFile hasn't been forced
-- and the file is therefore still locked.
- try (openFile filename WriteMode) >>= print
+ tryIOError (openFile filename WriteMode) >>= print
putStrLn s
diff --git a/testsuite/tests/ghc-regress/lib/IO/readFile001.stdout b/testsuite/tests/ghc-regress/lib/IO/readFile001.stdout
index 17e16ec0b3..cfb75708f9 100644
--- a/testsuite/tests/ghc-regress/lib/IO/readFile001.stdout
+++ b/testsuite/tests/ghc-regress/lib/IO/readFile001.stdout
@@ -1,7 +1,8 @@
Left readFile001.out: openFile: resource busy (file is locked)
-- !!! readFile test
-import IO
+import System.IO
+import System.IO.Error
source = "readFile001.hs"
filename = "readFile001.out"
@@ -15,7 +16,7 @@ main = do
-- This open should fail, because the readFile hasn't been forced
-- and the file is therefore still locked.
- try (openFile filename WriteMode) >>= print
+ tryIOError (openFile filename WriteMode) >>= print
putStrLn s