From c478c30529dbb62a13b98ee78a24a59d9e8a69d8 Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 7 Feb 2001 12:29:17 +0000 Subject: [PATCH] [project @ 2001-02-07 12:29:17 by simonmar] Add a test for the bug found in Handle printing yesterday. --- ghc/tests/io/should_run/Makefile | 1 + ghc/tests/io/should_run/io012.hs | 3 +++ ghc/tests/io/should_run/io035.hs | 7 +++++++ ghc/tests/io/should_run/io035.stdout | 10 ++++++++++ 4 files changed, 21 insertions(+) create mode 100644 ghc/tests/io/should_run/io035.hs create mode 100644 ghc/tests/io/should_run/io035.stdout diff --git a/ghc/tests/io/should_run/Makefile b/ghc/tests/io/should_run/Makefile index 74eb4c3..656385f 100644 --- a/ghc/tests/io/should_run/Makefile +++ b/ghc/tests/io/should_run/Makefile @@ -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 diff --git a/ghc/tests/io/should_run/io012.hs b/ghc/tests/io/should_run/io012.hs index 06114c6..8c4ddff 100644 --- a/ghc/tests/io/should_run/io012.hs +++ b/ghc/tests/io/should_run/io012.hs @@ -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 index 0000000..dee7f31 --- /dev/null +++ b/ghc/tests/io/should_run/io035.hs @@ -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 index 0000000..3fe2102 --- /dev/null +++ b/ghc/tests/io/should_run/io035.stdout @@ -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 -- 1.7.10.4