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

git at git.haskell.org git at git.haskell.org
Tue Jul 29 09:18:18 UTC 2014


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

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

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

commit 4b5cdba6e7a065a64fd10a3c8f0aaacd5d0f0188
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


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

4b5cdba6e7a065a64fd10a3c8f0aaacd5d0f0188
 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 376318d..7b4395e 100644
--- a/testsuite/.gitignore
+++ b/testsuite/.gitignore
@@ -1058,6 +1058,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