[commit: ghc] wip/pattern-synonyms: Add test case for explicitly-bidirectional pattern synonym (67d6e49)
git at git.haskell.org
git at git.haskell.org
Mon Jul 28 15:13:59 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/pattern-synonyms
Link : http://ghc.haskell.org/trac/ghc/changeset/67d6e496c39f2f341632e09b7135509492b106a7/ghc
>---------------------------------------------------------------
commit 67d6e496c39f2f341632e09b7135509492b106a7
Author: Dr. ERDI Gergo <gergo at erdi.hu>
Date: Mon Jul 28 17:10:22 2014 +0200
Add test case for explicitly-bidirectional pattern synonym
>---------------------------------------------------------------
67d6e496c39f2f341632e09b7135509492b106a7
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..2cade57
--- /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