[commit: packages/hoopl] master: 1. add an option to enable the test coverage report. 2. fix errors in expected files, and introduced a mismatch in the expected file to test if Travis CI can catch this error. (a08668c)

git at git.haskell.org git at git.haskell.org
Mon Dec 21 22:13:03 UTC 2015


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

On branch  : master
Link       : http://git.haskell.org/packages/hoopl.git/commitdiff/a08668c41a8d8442f0575b73a4bf93714b6252e4

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

commit a08668c41a8d8442f0575b73a4bf93714b6252e4
Author: Ning Wang <email at ningwang.org>
Date:   Tue May 5 16:48:05 2015 -0700

    1. add an option to enable the test coverage report. 2. fix errors in expected files, and introduced a mismatch in the expected file to test if Travis CI can catch this error.


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

a08668c41a8d8442f0575b73a4bf93714b6252e4
 README.md                      |  5 +++++
 hoopl.cabal                    | 11 ++++++++++-
 testing/tests/if-test.expected |  2 +-
 testing/tests/test4.expected   |  6 +++---
 4 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index c648876..383e1d7 100644
--- a/README.md
+++ b/README.md
@@ -25,6 +25,11 @@ To run the tests in the folder testing/, change to the src directory and run
     cabal configure --enable-tests
     cabal test
 
+To run the tests with the test coverage report, change to the src directory and run 
+
+    cabal configure --enable-tests -f testcoverage
+    cabal test
+
 You'll need a Haskell Platform, which should include appropriate
 versions of Cabal and GHC.
 
diff --git a/hoopl.cabal b/hoopl.cabal
index 1059927..aad6bc3 100644
--- a/hoopl.cabal
+++ b/hoopl.cabal
@@ -24,6 +24,12 @@ Source-repository head
   Type:       git
   Location:   http://git.haskell.org/packages/hoopl.git
 
+flag testcoverage {
+  description: Enable test coverage report
+  default: False
+}
+
+
 Library
   Default-Language:  Haskell2010
   Other-Extensions:  CPP
@@ -73,8 +79,11 @@ Test-Suite hoopl-test
   Type:              exitcode-stdio-1.0
   Main-Is:           Main.hs
   Hs-Source-Dirs:    testing src
-  Ghc-Options:       -fhpc -Wall
+  Ghc-Options:       -Wall
   Build-Depends:     base >= 4.3 && < 4.9, 
                      containers >= 0.4 && < 0.6,
                      parsec >= 3.1.7,
                      mtl >= 2.1.3.1
+  if flag(testcoverage) {
+    Ghc-Options: -fhpc
+  }
diff --git a/testing/tests/if-test.expected b/testing/tests/if-test.expected
index 9957111..de9ab62 100644
--- a/testing/tests/if-test.expected
+++ b/testing/tests/if-test.expected
@@ -1,6 +1,6 @@
 f() {
 L0:
-  goto "L1"
+  goto L1
 L1:
   ret (1)
 }
diff --git a/testing/tests/test4.expected b/testing/tests/test4.expected
index e0b9da1..8575f47 100644
--- a/testing/tests/test4.expected
+++ b/testing/tests/test4.expected
@@ -1,9 +1,9 @@
 f(x) {
 L100:
-  goto "L101"
+  goto L101
 L101:
-  goto "L103"
+  goto L103
 L103:
-  ret ((x + 5) + 4)
+  ret ((x + 5) + 3)
 }
 



More information about the ghc-commits mailing list