[commit: testsuite] master: Add a test for #5327 (c9819d4)
Ian Lynagh
igloo at earth.li
Thu Nov 17 18:13:34 CET 2011
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/c9819d410da69c75ed14c582a8909137c3172687
>---------------------------------------------------------------
commit c9819d410da69c75ed14c582a8909137c3172687
Author: Ian Lynagh <igloo at earth.li>
Date: Thu Nov 17 17:12:28 2011 +0000
Add a test for #5327
>---------------------------------------------------------------
tests/simplCore/should_compile/Makefile | 5 +++++
tests/simplCore/should_compile/T5327.hs | 12 ++++++++++++
.../should_compile/T5327.stdout} | 0
tests/simplCore/should_compile/all.T | 1 +
4 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/tests/simplCore/should_compile/Makefile b/tests/simplCore/should_compile/Makefile
index f39673c..d8eaebc 100644
--- a/tests/simplCore/should_compile/Makefile
+++ b/tests/simplCore/should_compile/Makefile
@@ -56,3 +56,8 @@ simpl021:
'$(TEST_HC)' -c Simpl021A.hs -O
'$(TEST_HC)' -c Simpl021B.hs -O
+.PHONY: T5327
+T5327:
+ $(RM) -f T5327.hi T5327.o
+ '$(TEST_HC)' -c T5327.hs -O -ddump-simpl | grep -c "GHC.Prim.># 34 "
+
diff --git a/tests/simplCore/should_compile/T5327.hs b/tests/simplCore/should_compile/T5327.hs
new file mode 100644
index 0000000..a2d9c01
--- /dev/null
+++ b/tests/simplCore/should_compile/T5327.hs
@@ -0,0 +1,12 @@
+module T5327 where
+
+newtype Size = Size Int
+
+{-# INLINABLE val2 #-}
+val2 = Size 17
+
+-- In the core, we should see a comparison against 34#, i.e. constant
+-- folding should have happened. We actually see it twice: Once in f's
+-- definition, and once in its unfolding.
+f n = case val2 of Size s -> s + s > n
+
diff --git a/tests/concurrent/should_run/3279.stdout b/tests/simplCore/should_compile/T5327.stdout
similarity index 100%
copy from tests/concurrent/should_run/3279.stdout
copy to tests/simplCore/should_compile/T5327.stdout
diff --git a/tests/simplCore/should_compile/all.T b/tests/simplCore/should_compile/all.T
index df42e6b..ce6549c 100644
--- a/tests/simplCore/should_compile/all.T
+++ b/tests/simplCore/should_compile/all.T
@@ -133,3 +133,4 @@ test('simpl021',
'Simpl021B.hi', 'Simpl021B.o']),
run_command,
['$MAKE -s --no-print-directory simpl021'])
+test('T5327', normal, run_command, ['$MAKE -s --no-print-directory T5327'])
More information about the Cvs-ghc
mailing list