[project @ 2001-02-07 12:29:17 by simonmar]
authorsimonmar <unknown>
Wed, 7 Feb 2001 12:29:17 +0000 (12:29 +0000)
committersimonmar <unknown>
Wed, 7 Feb 2001 12:29:17 +0000 (12:29 +0000)
Add a test for the bug found in Handle printing yesterday.

ghc/tests/io/should_run/Makefile
ghc/tests/io/should_run/io012.hs
ghc/tests/io/should_run/io035.hs [new file with mode: 0644]
ghc/tests/io/should_run/io035.stdout [new file with mode: 0644]

index 74eb4c3..656385f 100644 (file)
@@ -15,6 +15,7 @@ io011_HC_OPTS += -fglasgow-exts -package lang
 io018_HC_OPTS += -fglasgow-exts -package lang
 io022_HC_OPTS += -fglasgow-exts -package lang
 io032_HC_OPTS += -fglasgow-exts -package lang
+io035_HC_OPTS += -package lang
 
 io004_RUNTEST_OPTS += -x 42
 io016_RUNTEST_OPTS += io016.hs io016.out
index 06114c6..8c4ddff 100644 (file)
@@ -5,8 +5,11 @@ import IO
 import CPUTime
 
 main = do
+    t <- getCPUTime
+    print t
     print (nfib 30)
     t <- getCPUTime
+    print t
     print (length (show t)) -- printing the CPU time itself is un-cool if you want to diff the output..
 
 nfib :: Integer -> Integer
diff --git a/ghc/tests/io/should_run/io035.hs b/ghc/tests/io/should_run/io035.hs
new file mode 100644 (file)
index 0000000..dee7f31
--- /dev/null
@@ -0,0 +1,7 @@
+
+-- test for a bug in GHC <= 4.08.2: handles were being left locked after
+-- being shown in an error message.
+main = do
+  getContents
+  catch getChar (\e -> print e >> return 'x')
+  catch getChar (\e -> print e >> return 'x')
diff --git a/ghc/tests/io/should_run/io035.stdout b/ghc/tests/io/should_run/io035.stdout
new file mode 100644 (file)
index 0000000..3fe2102
--- /dev/null
@@ -0,0 +1,10 @@
+illegal operation
+Action: hGetChar
+Handle: {loc=stdin,type=semi-closed,buffering=block (8192)}
+
+Reason: handle is closed
+illegal operation
+Action: hGetChar
+Handle: {loc=stdin,type=semi-closed,buffering=block (8192)}
+
+Reason: handle is closed