[commit: testsuite] master: Test Trac #7649 (38d2e6f)

Simon Peyton Jones simonpj at microsoft.com
Wed Feb 13 18:46:10 CET 2013


Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/38d2e6f158b445d171e4efc1087907fb5839500d

>---------------------------------------------------------------

commit 38d2e6f158b445d171e4efc1087907fb5839500d
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Wed Feb 13 17:41:08 2013 +0000

    Test Trac #7649

>---------------------------------------------------------------

 tests/stranal/should_run/T7649.hs     |   32 ++++++++++++++++++++++++++++++++
 tests/stranal/should_run/T7649.stdout |    6 ++++++
 tests/stranal/should_run/all.T        |    2 +-
 3 files changed, 39 insertions(+), 1 deletions(-)

diff --git a/tests/stranal/should_run/T7649.hs b/tests/stranal/should_run/T7649.hs
new file mode 100644
index 0000000..cbf3d71
--- /dev/null
+++ b/tests/stranal/should_run/T7649.hs
@@ -0,0 +1,32 @@
+{-# LANGUAGE ViewPatterns, BangPatterns #-}
+module Main where
+
+import Control.Exception
+main :: IO ()
+main = do print (f False)
+          print (f True)
+          print (g undefined) `catchE` \_ -> putStrLn "g exception"
+          print (h undefined) `catchE` \_ -> putStrLn "h exception"
+          print (i undefined) `catchE` \_ -> putStrLn "i exception"
+          putStrLn "Done"
+
+catchE :: IO a -> (ErrorCall -> IO a) -> IO a
+catchE = catch
+
+f :: Bool -> String
+f (view -> Nothing) = "Got Nothing"
+f (view -> Just x)  = "Got Just " ++ show x
+
+g :: Bool -> String
+g (view -> x) = "g Got something"
+
+h :: Bool -> String
+h (view -> !x) = "h Got something"
+
+i :: Bool -> String
+i !(view -> x) = "i Got something"
+
+view :: Bool -> Maybe Int
+view False = Nothing
+view True = Just 5
+
diff --git a/tests/stranal/should_run/T7649.stdout b/tests/stranal/should_run/T7649.stdout
new file mode 100644
index 0000000..56f7f53
--- /dev/null
+++ b/tests/stranal/should_run/T7649.stdout
@@ -0,0 +1,6 @@
+"Got Nothing"
+"Got Just 5"
+"g Got something"
+h exception
+i exception
+Done
diff --git a/tests/stranal/should_run/all.T b/tests/stranal/should_run/all.T
index d94a7c4..0c43aac 100644
--- a/tests/stranal/should_run/all.T
+++ b/tests/stranal/should_run/all.T
@@ -6,4 +6,4 @@ test('strun002', exit_code(1), compile_and_run, [''])
 test('strun003', normal, compile_and_run, [''])
 test('strun004', normal, compile_and_run, [''])
 test('T2756b', normal, compile_and_run, [''])
-
+test('T7649', normal, compile_and_run, [''])





More information about the ghc-commits mailing list