summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib/IO/hGetLine002.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/lib/IO/hGetLine002.hs')
-rw-r--r--testsuite/tests/lib/IO/hGetLine002.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/tests/lib/IO/hGetLine002.hs b/testsuite/tests/lib/IO/hGetLine002.hs
new file mode 100644
index 0000000000..5c08b716d1
--- /dev/null
+++ b/testsuite/tests/lib/IO/hGetLine002.hs
@@ -0,0 +1,16 @@
+-- !!! testing hGetLine on a file without a final '\n'.
+
+-- According to the Haskell 98 report, getLine should discard a line without a
+-- closing newline character (see implementation of getLine).
+--
+-- However, we don't believe that this is the right behaviour.
+
+import System.IO
+
+main = catch loop (\e -> print e)
+
+loop = do
+ hSetBuffering stdin LineBuffering
+ l <- hGetLine stdin
+ putStrLn l
+ loop