[commit: ghc] wip/pattern-synonyms: Add test case for explicitly-bidirectional pattern synonym (251b4a8)
git at git.haskell.org
git at git.haskell.org
Sun Jul 27 19:13:14 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/pattern-synonyms
Link : http://ghc.haskell.org/trac/ghc/changeset/251b4a8e26e26844154fe17ddd251f1833be7d5b/ghc
>---------------------------------------------------------------
commit 251b4a8e26e26844154fe17ddd251f1833be7d5b
Author: Dr. ERDI Gergo <gergo at erdi.hu>
Date: Thu Jul 10 10:13:14 2014 +0800
Add test case for explicitly-bidirectional pattern synonym
>---------------------------------------------------------------
251b4a8e26e26844154fe17ddd251f1833be7d5b
testsuite/.gitignore | 1 +
testsuite/tests/patsyn/should_run/all.T | 1 +
testsuite/tests/patsyn/should_run/bidir-explicit.hs | 16 ++++++++++++++++
.../should_run/bidir-explicit.stdout} | 2 ++
4 files changed, 20 insertions(+)
diff --git a/testsuite/.gitignore b/testsuite/.gitignore
index 376318d..ae004e9 100644
--- a/testsuite/.gitignore
+++ b/testsuite/.gitignore
@@ -1058,6 +1058,7 @@ mk/ghcconfig_*_inplace_bin_ghc-stage2.exe.mk
/tests/parser/unicode/1744
/tests/parser/unicode/T1744
/tests/parser/unicode/utf8_024
+/tests/patsyn/should_run/bidir-explicit
/tests/patsyn/should_run/eval
/tests/patsyn/should_run/ex-prov
/tests/patsyn/should_run/ex-prov-run
diff --git a/testsuite/tests/patsyn/should_run/all.T b/testsuite/tests/patsyn/should_run/all.T
index f5936c6..f551da5 100644
--- a/testsuite/tests/patsyn/should_run/all.T
+++ b/testsuite/tests/patsyn/should_run/all.T
@@ -1,3 +1,4 @@
test('eval', normal, compile_and_run, [''])
test('match', normal, compile_and_run, [''])
test('ex-prov-run', normal, compile_and_run, [''])
+test('bidir-explicit', normal, compile_and_run, [''])
diff --git a/testsuite/tests/patsyn/should_run/bidir-explicit.hs b/testsuite/tests/patsyn/should_run/bidir-explicit.hs
new file mode 100644
index 0000000..c5de877
--- /dev/null
+++ b/testsuite/tests/patsyn/should_run/bidir-explicit.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE PatternSynonyms #-}
+module Main where
+
+pattern First x <- x:_ where
+ First x = [x]
+
+pattern First' x <- x:_ where
+ First' x = foo [x, x, x]
+
+foo :: [a] -> [a]
+foo xs@(First x) = replicate (length xs + 1) x
+
+main = do
+ mapM_ print $ First ()
+ putStrLn ""
+ mapM_ print $ First' ()
diff --git a/testsuite/tests/deriving/should_run/T3087.stdout b/testsuite/tests/patsyn/should_run/bidir-explicit.stdout
similarity index 75%
copy from testsuite/tests/deriving/should_run/T3087.stdout
copy to testsuite/tests/patsyn/should_run/bidir-explicit.stdout
index 35735b4..4625e61 100644
--- a/testsuite/tests/deriving/should_run/T3087.stdout
+++ b/testsuite/tests/patsyn/should_run/bidir-explicit.stdout
@@ -1,4 +1,6 @@
()
+
+()
()
()
()
More information about the ghc-commits
mailing list