summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/lib
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2009-02-02 15:40:46 +0000
committerIan Lynagh <igloo@earth.li>2009-02-02 15:40:46 +0000
commit80de94c5aa8aa822fddd222fb4f59df4e6a7d1bc (patch)
tree067fb6b51433e9c989f7c1c7384d4331a226c95d /testsuite/tests/ghc-regress/lib
parentd0754c907ecceb41476aef771f6bcb8651f9e53f (diff)
downloadhaskell-80de94c5aa8aa822fddd222fb4f59df4e6a7d1bc.tar.gz
Add a test for trac #2913
OldException's catch etc should treat new Exception types as DynException's
Diffstat (limited to 'testsuite/tests/ghc-regress/lib')
-rw-r--r--testsuite/tests/ghc-regress/lib/OldException/Makefile4
-rw-r--r--testsuite/tests/ghc-regress/lib/OldException/OldException001.hs22
-rw-r--r--testsuite/tests/ghc-regress/lib/OldException/OldException001.stdout2
-rw-r--r--testsuite/tests/ghc-regress/lib/OldException/all.T3
4 files changed, 31 insertions, 0 deletions
diff --git a/testsuite/tests/ghc-regress/lib/OldException/Makefile b/testsuite/tests/ghc-regress/lib/OldException/Makefile
new file mode 100644
index 0000000000..50191fd8b9
--- /dev/null
+++ b/testsuite/tests/ghc-regress/lib/OldException/Makefile
@@ -0,0 +1,4 @@
+TOP=../../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
diff --git a/testsuite/tests/ghc-regress/lib/OldException/OldException001.hs b/testsuite/tests/ghc-regress/lib/OldException/OldException001.hs
new file mode 100644
index 0000000000..150dc2aba7
--- /dev/null
+++ b/testsuite/tests/ghc-regress/lib/OldException/OldException001.hs
@@ -0,0 +1,22 @@
+
+-- trace #2913
+
+{-# LANGUAGE DeriveDataTypeable #-}
+
+import qualified Control.Exception as New
+import qualified Control.OldException as Old
+
+import Data.Typeable
+
+data MyException = MyException
+ deriving (Eq, Show, Typeable)
+
+instance New.Exception MyException
+
+main :: IO ()
+main = (New.throwIO MyException
+ `Old.catch`
+ (\e -> do putStrLn ("Old got " ++ show e)
+ Old.throw e)
+ ) `New.catch` (\e -> putStrLn ("New got " ++ show (e :: MyException)))
+
diff --git a/testsuite/tests/ghc-regress/lib/OldException/OldException001.stdout b/testsuite/tests/ghc-regress/lib/OldException/OldException001.stdout
new file mode 100644
index 0000000000..db2f38d369
--- /dev/null
+++ b/testsuite/tests/ghc-regress/lib/OldException/OldException001.stdout
@@ -0,0 +1,2 @@
+Old got exception :: GHC.Exception.SomeException
+New got MyException
diff --git a/testsuite/tests/ghc-regress/lib/OldException/all.T b/testsuite/tests/ghc-regress/lib/OldException/all.T
new file mode 100644
index 0000000000..55459823eb
--- /dev/null
+++ b/testsuite/tests/ghc-regress/lib/OldException/all.T
@@ -0,0 +1,3 @@
+
+test('OldException001', normal, compile_and_run, [''])
+