summaryrefslogtreecommitdiff
path: root/testsuite/tests/parser
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/parser')
-rw-r--r--testsuite/tests/parser/should_fail/ParserNoMultiWayIf.hs7
-rw-r--r--testsuite/tests/parser/should_fail/ParserNoMultiWayIf.stderr3
-rw-r--r--testsuite/tests/parser/should_fail/all.T1
-rw-r--r--testsuite/tests/parser/should_run/ParserMultiWayIf.hs15
-rw-r--r--testsuite/tests/parser/should_run/ParserMultiWayIf.stdout1
-rw-r--r--testsuite/tests/parser/should_run/all.T1
6 files changed, 28 insertions, 0 deletions
diff --git a/testsuite/tests/parser/should_fail/ParserNoMultiWayIf.hs b/testsuite/tests/parser/should_fail/ParserNoMultiWayIf.hs
new file mode 100644
index 0000000000..f9ded3dc69
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/ParserNoMultiWayIf.hs
@@ -0,0 +1,7 @@
+module ParserNoMultiWayIf where
+
+x = 123
+y = if | x < 0 -> -1
+ | x == 0 -> 0
+ | otherwise -> 1
+
diff --git a/testsuite/tests/parser/should_fail/ParserNoMultiWayIf.stderr b/testsuite/tests/parser/should_fail/ParserNoMultiWayIf.stderr
new file mode 100644
index 0000000000..1a82362884
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/ParserNoMultiWayIf.stderr
@@ -0,0 +1,3 @@
+
+ParserNoMultiWayIf.hs:4:5:
+ Multi-way if-expressions need -XMultiWayIf turned on
diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T
index 592634d2dd..355961dd4f 100644
--- a/testsuite/tests/parser/should_fail/all.T
+++ b/testsuite/tests/parser/should_fail/all.T
@@ -73,5 +73,6 @@ test('readFailTraditionalRecords1', normal, compile_fail, [''])
test('readFailTraditionalRecords2', normal, compile_fail, [''])
test('readFailTraditionalRecords3', normal, compile_fail, [''])
test('ParserNoLambdaCase', if_compiler_lt('ghc', '7.5', skip), compile_fail, [''])
+test('ParserNoMultiWayIf', if_compiler_lt('ghc', '7.5', skip), compile_fail, [''])
test('T5425', normal, compile_fail, [''])
diff --git a/testsuite/tests/parser/should_run/ParserMultiWayIf.hs b/testsuite/tests/parser/should_run/ParserMultiWayIf.hs
new file mode 100644
index 0000000000..83bd2e94a7
--- /dev/null
+++ b/testsuite/tests/parser/should_run/ParserMultiWayIf.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE MultiWayIf #-}
+
+module Main where
+
+x = 10
+x1 = if | x < 10 -> "< 10" | otherwise -> ""
+x2 = if | x < 10 -> "< 10"
+ | otherwise -> ""
+x3 = if | x < 10 -> "< 10"
+ | otherwise -> ""
+x4 = if | True -> "yes"
+x5 = if | True -> if | False -> 1 | True -> 2
+
+main = print $ x5 == 2
+
diff --git a/testsuite/tests/parser/should_run/ParserMultiWayIf.stdout b/testsuite/tests/parser/should_run/ParserMultiWayIf.stdout
new file mode 100644
index 0000000000..0ca95142bb
--- /dev/null
+++ b/testsuite/tests/parser/should_run/ParserMultiWayIf.stdout
@@ -0,0 +1 @@
+True
diff --git a/testsuite/tests/parser/should_run/all.T b/testsuite/tests/parser/should_run/all.T
index 6bc63d8e80..03951a1edb 100644
--- a/testsuite/tests/parser/should_run/all.T
+++ b/testsuite/tests/parser/should_run/all.T
@@ -5,3 +5,4 @@ test('readRun004', normal, compile_and_run, ['-fobject-code'])
test('T1344', normal, compile_and_run, [''])
test('operator', normal, compile_and_run, [''])
test('operator2', normal, compile_and_run, [''])
+test('ParserMultiWayIf', if_compiler_lt('ghc', '7.5', skip), compile_and_run, [''])