summaryrefslogtreecommitdiff
path: root/testsuite/tests/stranal/should_run
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2013-02-13 17:41:08 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2013-02-13 17:41:08 +0000
commit8f6af3461e4d63e874f5e681c81b6e257276b506 (patch)
treeda56d0a5b42c7bbefce4aa068435e959107396f1 /testsuite/tests/stranal/should_run
parent9781d940620b82da63b605571fc519a3421b1ef8 (diff)
downloadhaskell-8f6af3461e4d63e874f5e681c81b6e257276b506.tar.gz
Test Trac #7649
Diffstat (limited to 'testsuite/tests/stranal/should_run')
-rw-r--r--testsuite/tests/stranal/should_run/T7649.hs32
-rw-r--r--testsuite/tests/stranal/should_run/T7649.stdout6
-rw-r--r--testsuite/tests/stranal/should_run/all.T2
3 files changed, 39 insertions, 1 deletions
diff --git a/testsuite/tests/stranal/should_run/T7649.hs b/testsuite/tests/stranal/should_run/T7649.hs
new file mode 100644
index 0000000000..cbf3d7177f
--- /dev/null
+++ b/testsuite/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/testsuite/tests/stranal/should_run/T7649.stdout b/testsuite/tests/stranal/should_run/T7649.stdout
new file mode 100644
index 0000000000..56f7f53b59
--- /dev/null
+++ b/testsuite/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/testsuite/tests/stranal/should_run/all.T b/testsuite/tests/stranal/should_run/all.T
index d94a7c492d..0c43aac8c4 100644
--- a/testsuite/tests/stranal/should_run/all.T
+++ b/testsuite/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, [''])