summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib/IOExts/hTell001.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/lib/IOExts/hTell001.hs')
-rw-r--r--testsuite/tests/lib/IOExts/hTell001.hs63
1 files changed, 0 insertions, 63 deletions
diff --git a/testsuite/tests/lib/IOExts/hTell001.hs b/testsuite/tests/lib/IOExts/hTell001.hs
deleted file mode 100644
index 6b26eecb97..0000000000
--- a/testsuite/tests/lib/IOExts/hTell001.hs
+++ /dev/null
@@ -1,63 +0,0 @@
--- !!! Testing hGetPosn and hSetPosn
-module Main(main) where
-
-import System.IO
-
-getPosnAndPrint h = do
- x <- hTell h
- v <- hGetChar h
- putStrLn ("At position: " ++ show x ++ ", found: " ++ show v)
- return x
-
-recordDoAndRepos h a = do
- x <- getPosnAndPrint h
- a
- hSeek h AbsoluteSeek x
- getPosnAndPrint h
- return ()
-
-recordDoAndRepos2 h a = do
- x <- getPosnAndPrint h
- a
- hSeek h AbsoluteSeek x
- getPosnAndPrint h
- return ()
-
-recordDoAndRepos3 h a = do
- x <- getPosnAndPrint h
- a
- hSeek h SeekFromEnd (negate (x + 1))
- getPosnAndPrint h
- return ()
-
-file = "hTell001.hs"
-
-main :: IO ()
-main = do
- h <- openBinaryFile file ReadMode
- recordDoAndRepos h $
- recordDoAndRepos h $
- recordDoAndRepos h $
- recordDoAndRepos h $
- recordDoAndRepos h $
- putStrLn ""
- hClose h
- putStrLn "\nUsing hSeek/AbsoluteSeek: "
- h <- openBinaryFile file ReadMode
- recordDoAndRepos2 h $
- recordDoAndRepos2 h $
- recordDoAndRepos2 h $
- recordDoAndRepos2 h $
- recordDoAndRepos2 h $
- putStrLn ""
-
- hClose h
- putStrLn "\nUsing hSeek/SeekFromEnd: "
- putStrLn "(Don't worry if you're seeing differing numbers here, it might be down to '\\n' vs '\\r\\n')"
- h <- openBinaryFile file ReadMode
- recordDoAndRepos3 h $
- recordDoAndRepos3 h $
- recordDoAndRepos3 h $
- recordDoAndRepos3 h $
- recordDoAndRepos3 h $
- putStrLn ""