[commit: ghc] wip/pattern-synonyms: Add test cases for explicitly-bidirectional pattern synonym (f3262fe)

git at git.haskell.org git at git.haskell.org
Tue Jul 29 14:24:31 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/pattern-synonyms
Link       : http://ghc.haskell.org/trac/ghc/changeset/f3262fe82ce7d810809beecabd4257522db4cc55/ghc

>---------------------------------------------------------------

commit f3262fe82ce7d810809beecabd4257522db4cc55
Author: Dr. ERDI Gergo <gergo at erdi.hu>
Date:   Tue Jul 29 08:25:40 2014 +0200

    Add test cases for explicitly-bidirectional pattern synonym


>---------------------------------------------------------------

f3262fe82ce7d810809beecabd4257522db4cc55
 testsuite/.gitignore                                           |  2 ++
 testsuite/tests/patsyn/should_run/all.T                        |  2 ++
 testsuite/tests/patsyn/should_run/bidir-explicit-scope.hs      | 10 ++++++++++
 .../should_run/bidir-explicit-scope.stdout}                    |  0
 testsuite/tests/patsyn/should_run/bidir-explicit.hs            |  7 +++++++
 .../T3207.stdout => patsyn/should_run/bidir-explicit.stdout}   |  0
 6 files changed, 21 insertions(+)

diff --git a/testsuite/.gitignore b/testsuite/.gitignore
index 71fa8d0..e7bb6d5 100644
--- a/testsuite/.gitignore
+++ b/testsuite/.gitignore
@@ -1068,6 +1068,8 @@ 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/bidir-explicit-scope
 /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..b3c6b74 100644
--- a/testsuite/tests/patsyn/should_run/all.T
+++ b/testsuite/tests/patsyn/should_run/all.T
@@ -1,3 +1,5 @@
 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, [''])
+test('bidir-explicit-scope', normal, compile_and_run, [''])
diff --git a/testsuite/tests/patsyn/should_run/bidir-explicit-scope.hs b/testsuite/tests/patsyn/should_run/bidir-explicit-scope.hs
new file mode 100644
index 0000000..390bbb0
--- /dev/null
+++ b/testsuite/tests/patsyn/should_run/bidir-explicit-scope.hs
@@ -0,0 +1,10 @@
+{-# LANGUAGE PatternSynonyms #-}
+module Main where
+
+pattern First x <- x:_ where
+  First x = foo [x, x, x]
+
+foo :: [a] -> [a]
+foo xs@(First x) = replicate (length xs + 1) x
+
+main = mapM_ print $ First ()
diff --git a/testsuite/tests/deriving/should_run/T3087.stdout b/testsuite/tests/patsyn/should_run/bidir-explicit-scope.stdout
similarity index 100%
copy from testsuite/tests/deriving/should_run/T3087.stdout
copy to testsuite/tests/patsyn/should_run/bidir-explicit-scope.stdout
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..d295191
--- /dev/null
+++ b/testsuite/tests/patsyn/should_run/bidir-explicit.hs
@@ -0,0 +1,7 @@
+{-# LANGUAGE PatternSynonyms #-}
+module Main where
+
+pattern First x <- x:_ where
+  First x = [x]
+
+main = mapM_ print $ First ()
diff --git a/testsuite/tests/codeGen/should_run/T3207.stdout b/testsuite/tests/patsyn/should_run/bidir-explicit.stdout
similarity index 100%
copy from testsuite/tests/codeGen/should_run/T3207.stdout
copy to testsuite/tests/patsyn/should_run/bidir-explicit.stdout



More information about the ghc-commits mailing list