[commit: ghc] wip/T9732: Tests (a946c7d)

git at git.haskell.org git at git.haskell.org
Sat Nov 8 14:06:28 UTC 2014


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

On branch  : wip/T9732
Link       : http://ghc.haskell.org/trac/ghc/changeset/a946c7d4ea0bf472fc8f7201b690e43654f9fe73/ghc

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

commit a946c7d4ea0bf472fc8f7201b690e43654f9fe73
Author: Dr. ERDI Gergo <gergo at erdi.hu>
Date:   Sat Nov 8 17:01:05 2014 +0800

    Tests


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

a946c7d4ea0bf472fc8f7201b690e43654f9fe73
 testsuite/.gitignore                                |  1 +
 testsuite/tests/patsyn/should_compile/T9732.hs      |  4 ++++
 testsuite/tests/patsyn/should_compile/all.T         |  1 +
 testsuite/tests/patsyn/should_fail/all.T            |  1 +
 .../{unboxed-bind.hs => unboxed-wrapper-naked.hs}   |  6 ++----
 .../patsyn/should_fail/unboxed-wrapper-naked.stderr |  3 +++
 testsuite/tests/patsyn/should_run/all.T             |  2 ++
 testsuite/tests/patsyn/should_run/match-unboxed.hs  | 21 +++++++++++++++++++++
 .../should_run/match-unboxed.stdout}                |  2 ++
 .../tests/patsyn/should_run/unboxed-wrapper.hs      |  9 +++++++++
 .../should_run/unboxed-wrapper.stdout}              |  0
 11 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/testsuite/.gitignore b/testsuite/.gitignore
index 3a5d816..a07a376 100644
--- a/testsuite/.gitignore
+++ b/testsuite/.gitignore
@@ -1098,6 +1098,7 @@ mk/ghcconfig*_inplace_bin_ghc-stage2.exe.mk
 /tests/patsyn/should_run/ex-prov-run
 /tests/patsyn/should_run/match
 /tests/patsyn/should_run/match-unboxed
+/tests/patsyn/should_run/unboxed-wrapper
 /tests/perf/compiler/T1969.comp.stats
 /tests/perf/compiler/T3064.comp.stats
 /tests/perf/compiler/T3294.comp.stats
diff --git a/testsuite/tests/patsyn/should_compile/T9732.hs b/testsuite/tests/patsyn/should_compile/T9732.hs
new file mode 100644
index 0000000..7fd0515
--- /dev/null
+++ b/testsuite/tests/patsyn/should_compile/T9732.hs
@@ -0,0 +1,4 @@
+{-# LANGUAGE PatternSynonyms, MagicHash #-}
+module ShouldCompile where
+
+pattern P = 0#
diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T
index 94950a1..55e3b83 100644
--- a/testsuite/tests/patsyn/should_compile/all.T
+++ b/testsuite/tests/patsyn/should_compile/all.T
@@ -11,3 +11,4 @@ test('export', normal, compile, [''])
 test('T8966', normal, compile, [''])
 test('T9023', normal, compile, [''])
 test('unboxed-bind-bang', normal, compile, [''])
+test('T9732', normal, compile, [''])
diff --git a/testsuite/tests/patsyn/should_fail/all.T b/testsuite/tests/patsyn/should_fail/all.T
index ee5768c..b38776e 100644
--- a/testsuite/tests/patsyn/should_fail/all.T
+++ b/testsuite/tests/patsyn/should_fail/all.T
@@ -8,3 +8,4 @@ test('T9161-2', normal, compile_fail, [''])
 test('T9705-1', normal, compile_fail, [''])
 test('T9705-2', normal, compile_fail, [''])
 test('unboxed-bind', normal, compile_fail, [''])
+test('unboxed-wrapper-naked', normal, compile_fail, [''])
diff --git a/testsuite/tests/patsyn/should_fail/unboxed-bind.hs b/testsuite/tests/patsyn/should_fail/unboxed-wrapper-naked.hs
similarity index 52%
copy from testsuite/tests/patsyn/should_fail/unboxed-bind.hs
copy to testsuite/tests/patsyn/should_fail/unboxed-wrapper-naked.hs
index ef1b070..6e7cc94 100644
--- a/testsuite/tests/patsyn/should_fail/unboxed-bind.hs
+++ b/testsuite/tests/patsyn/should_fail/unboxed-wrapper-naked.hs
@@ -3,8 +3,6 @@ module ShouldFail where
 
 import GHC.Base
 
-data Foo = MkFoo Int# Int#
+pattern P1 = 42#
 
-pattern P x = MkFoo 0# x
-
-f x = let P arg = x in arg
+x = P1
diff --git a/testsuite/tests/patsyn/should_fail/unboxed-wrapper-naked.stderr b/testsuite/tests/patsyn/should_fail/unboxed-wrapper-naked.stderr
new file mode 100644
index 0000000..e8d8950
--- /dev/null
+++ b/testsuite/tests/patsyn/should_fail/unboxed-wrapper-naked.stderr
@@ -0,0 +1,3 @@
+
+unboxed-wrapper-naked.hs:8:1:
+    Top-level bindings for unlifted types aren't allowed: x = P1
diff --git a/testsuite/tests/patsyn/should_run/all.T b/testsuite/tests/patsyn/should_run/all.T
index 9c3f16b..40ec3e3 100644
--- a/testsuite/tests/patsyn/should_run/all.T
+++ b/testsuite/tests/patsyn/should_run/all.T
@@ -4,3 +4,5 @@ test('ex-prov-run', normal, compile_and_run, [''])
 test('bidir-explicit', normal, compile_and_run, [''])
 test('bidir-explicit-scope', normal, compile_and_run, [''])
 test('T9783', normal, compile_and_run, [''])
+test('match-unboxed', normal, compile_and_run, [''])
+test('unboxed-wrapper', normal, compile_and_run, [''])
diff --git a/testsuite/tests/patsyn/should_run/match-unboxed.hs b/testsuite/tests/patsyn/should_run/match-unboxed.hs
new file mode 100644
index 0000000..ec6de0c
--- /dev/null
+++ b/testsuite/tests/patsyn/should_run/match-unboxed.hs
@@ -0,0 +1,21 @@
+{-# LANGUAGE PatternSynonyms, MagicHash #-}
+module Main where
+
+import GHC.Base
+
+pattern P1 <- 0#
+pattern P2 <- 1#
+
+f :: Int# -> Int#
+f P1 = 42#
+f P2 = 44#
+
+g :: Int# -> Int
+g P1 = 42
+g P2 = 44
+
+main = do
+    print $ I# (f 0#)
+    print $ I# (f 1#)
+    print $ g 0#
+    print $ g 1#
diff --git a/testsuite/tests/array/should_run/arr020.stdout b/testsuite/tests/patsyn/should_run/match-unboxed.stdout
similarity index 50%
copy from testsuite/tests/array/should_run/arr020.stdout
copy to testsuite/tests/patsyn/should_run/match-unboxed.stdout
index daaac9e..da4a47e 100644
--- a/testsuite/tests/array/should_run/arr020.stdout
+++ b/testsuite/tests/patsyn/should_run/match-unboxed.stdout
@@ -1,2 +1,4 @@
 42
+44
 42
+44
diff --git a/testsuite/tests/patsyn/should_run/unboxed-wrapper.hs b/testsuite/tests/patsyn/should_run/unboxed-wrapper.hs
new file mode 100644
index 0000000..367c8cc
--- /dev/null
+++ b/testsuite/tests/patsyn/should_run/unboxed-wrapper.hs
@@ -0,0 +1,9 @@
+{-# LANGUAGE PatternSynonyms, MagicHash #-}
+module Main where
+
+import GHC.Base
+
+pattern P1 = 42#
+
+main = do
+    print $ I# P1
diff --git a/testsuite/tests/codeGen/should_run/cgrun002.stdout b/testsuite/tests/patsyn/should_run/unboxed-wrapper.stdout
similarity index 100%
copy from testsuite/tests/codeGen/should_run/cgrun002.stdout
copy to testsuite/tests/patsyn/should_run/unboxed-wrapper.stdout



More information about the ghc-commits mailing list