summaryrefslogtreecommitdiff
path: root/testsuite/tests/parser
diff options
context:
space:
mode:
authorMikhail Vorozhtsov <mikhail.vorozhtsov@gmail.com>2012-07-13 20:48:45 +0700
committerSimon Marlow <marlowsd@gmail.com>2012-07-16 11:10:52 +0100
commitb72aa2c9086f39a3d75928da1b7b7e1332509f61 (patch)
treef8f79ba33884f81be9babb25f5424cbd27878192 /testsuite/tests/parser
parent49703b98a01bf2ac3f7fb5cd63334887a3d975ac (diff)
downloadhaskell-b72aa2c9086f39a3d75928da1b7b7e1332509f61.tar.gz
Added LambdaCase tests.
Diffstat (limited to 'testsuite/tests/parser')
-rw-r--r--testsuite/tests/parser/should_compile/ParserLambdaCase.hs12
-rw-r--r--testsuite/tests/parser/should_compile/all.T1
-rw-r--r--testsuite/tests/parser/should_fail/ParserNoLambdaCase.hs4
-rw-r--r--testsuite/tests/parser/should_fail/ParserNoLambdaCase.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/all.T1
5 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/parser/should_compile/ParserLambdaCase.hs b/testsuite/tests/parser/should_compile/ParserLambdaCase.hs
new file mode 100644
index 0000000000..006800788e
--- /dev/null
+++ b/testsuite/tests/parser/should_compile/ParserLambdaCase.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE LambdaCase #-}
+
+module ParserLambdaCase where
+
+f1 = \case "1" -> 1
+f2 = \ {- comment1 {- comment2 -} -} case "1" -> 1; "2" -> 2
+f3 = \ -- comment
+ case "1" -> 1
+ "2" -> 2
+f4 = \casex -> casex
+f5 = \ case { "1" -> 1; "2" -> 2 }
+
diff --git a/testsuite/tests/parser/should_compile/all.T b/testsuite/tests/parser/should_compile/all.T
index 0ac301ede1..083b38c898 100644
--- a/testsuite/tests/parser/should_compile/all.T
+++ b/testsuite/tests/parser/should_compile/all.T
@@ -90,6 +90,7 @@ test('NondecreasingIndentation', normal, compile, [''])
test('mc15', normal, compile, [''])
test('mc16', normal, compile, [''])
test('EmptyDecls', normal, compile, [''])
+test('ParserLambdaCase', if_compiler_lt('ghc', '7.5', skip), compile, [''])
test('T5243', extra_clean(['T5243A.hi', 'T5243A.o']),
multimod_compile, ['T5243',''])
diff --git a/testsuite/tests/parser/should_fail/ParserNoLambdaCase.hs b/testsuite/tests/parser/should_fail/ParserNoLambdaCase.hs
new file mode 100644
index 0000000000..d87f8f0390
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/ParserNoLambdaCase.hs
@@ -0,0 +1,4 @@
+module ParserNoLambdaCase where
+
+f = \case "1" -> 1
+
diff --git a/testsuite/tests/parser/should_fail/ParserNoLambdaCase.stderr b/testsuite/tests/parser/should_fail/ParserNoLambdaCase.stderr
new file mode 100644
index 0000000000..11f087896b
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/ParserNoLambdaCase.stderr
@@ -0,0 +1,2 @@
+
+ParserNoLambdaCase.hs:3:6: parse error on input `case'
diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T
index 0e94f1a6f8..592634d2dd 100644
--- a/testsuite/tests/parser/should_fail/all.T
+++ b/testsuite/tests/parser/should_fail/all.T
@@ -72,5 +72,6 @@ test('NondecreasingIndentationFail', normal, compile_fail, [''])
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('T5425', normal, compile_fail, [''])