summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib/IO/hGetLine001.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/lib/IO/hGetLine001.hs')
-rw-r--r--testsuite/tests/lib/IO/hGetLine001.hs25
1 files changed, 25 insertions, 0 deletions
diff --git a/testsuite/tests/lib/IO/hGetLine001.hs b/testsuite/tests/lib/IO/hGetLine001.hs
new file mode 100644
index 0000000000..b5950623ea
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetLine001.hs
@@ -0,0 +1,25 @@
+-- !!! testing hGetLine
+
+import System.IO
+
+-- one version of 'cat'
+main = do
+ let loop h = do b <- hIsEOF h
+ if b then return ()
+ else do l <- hGetLine h; putStrLn l; loop h
+ loop stdin
+
+ h <- openFile "hGetLine001.hs" ReadMode
+
+ hSetBinaryMode stdout True
+
+ hSetBuffering h NoBuffering
+ loop h
+
+ hSeek h AbsoluteSeek 0
+ hSetBuffering h LineBuffering
+ loop h
+
+ hSeek h AbsoluteSeek 0
+ hSetBuffering h (BlockBuffering (Just 83))
+ loop h