aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-12-06 18:25:09 +0100
committerLoïc Hoguin <[email protected]>2018-12-06 18:25:09 +0100
commit754bad09421c70034242f4370c633e177a869151 (patch)
tree5d8e4faed1d6f204cd65a537f8f7eb58bacd975e /test
parent44fe1e993f16c98ed41c01e4511c0367e14e9637 (diff)
downloaderlang.mk-754bad09421c70034242f4370c633e177a869151.tar.gz
erlang.mk-754bad09421c70034242f4370c633e177a869151.tar.bz2
erlang.mk-754bad09421c70034242f4370c633e177a869151.zip
Add cover support for PropEr and Triq
Diffstat (limited to 'test')
-rw-r--r--test/plugin_cover.mk56
-rw-r--r--test/plugin_proper.mk2
2 files changed, 57 insertions, 1 deletions
diff --git a/test/plugin_cover.mk b/test/plugin_cover.mk
index b6b3a5d..a5ed295 100644
--- a/test/plugin_cover.mk
+++ b/test/plugin_cover.mk
@@ -141,6 +141,34 @@ cover-eunit-apps-only: build clean
$i "Check that the generated file exists"
$t test -f $(APP)/apps/my_app/cover/eunit.coverdata
+cover-proper: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Add PropEr to the list of dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = proper\n"}' $(APP)/Makefile
+
+ $i "Generate a module containing Proper properties"
+ $t printf "%s\n" \
+ "-module($(APP))." \
+ "-ifdef(TEST)." \
+ "-include_lib(\"proper/include/proper.hrl\")." \
+ "prop_foo() -> ?FORALL(_, any(), true)." \
+ "-endif." > $(APP)/src/$(APP).erl
+
+ $i "Run PropEr with code coverage enabled"
+ $t $(MAKE) -C $(APP) proper COVER=1 $v
+
+ $i "Check that the generated file exists"
+ $t test -f $(APP)/cover/proper.coverdata
+
+ $i "Check that the generated file is removed on clean"
+ $t $(MAKE) -C $(APP) clean $v
+ $t test ! -e $(APP)/cover/proper.coverdata
+
cover-report-and-merge: build clean
$i "Bootstrap a new OTP application named $(APP)"
@@ -188,3 +216,31 @@ cover-report-and-merge: build clean
$i "Check that the cover report is removed on distclean"
$t $(MAKE) -C $(APP) distclean $v
$t test ! -e $(APP)/cover/
+
+cover-triq: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Add Triq to the list of dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = triq\n"}' $(APP)/Makefile
+
+ $i "Generate a module containing Triq properties"
+ $t printf "%s\n" \
+ "-module($(APP))." \
+ "-ifdef(TEST)." \
+ "-include_lib(\"triq/include/triq.hrl\")." \
+ "prop_foo() -> ?FORALL(_, any(), true)." \
+ "-endif." > $(APP)/src/$(APP).erl
+
+ $i "Run Triq with code coverage enabled"
+ $t $(MAKE) -C $(APP) triq COVER=1 $v
+
+ $i "Check that the generated file exists"
+ $t test -f $(APP)/cover/triq.coverdata
+
+ $i "Check that the generated file is removed on clean"
+ $t $(MAKE) -C $(APP) clean $v
+ $t test ! -e $(APP)/cover/triq.coverdata
diff --git a/test/plugin_proper.mk b/test/plugin_proper.mk
index 98a7c99..ca92d91 100644
--- a/test/plugin_proper.mk
+++ b/test/plugin_proper.mk
@@ -16,7 +16,7 @@ proper-test-dir: build clean
$i "Add PropEr to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = proper\n"}' $(APP)/Makefile
- $i "Generate a module containing Proper properties"
+ $i "Generate a module containing PropEr properties"
$t printf "%s\n" \
"-module($(APP))." \
"-ifdef(TEST)." \