diff options
author | Loïc Hoguin <[email protected]> | 2018-05-14 14:01:36 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-05-14 14:12:47 +0200 |
commit | e0f8b46b0d5a78a10783d0b3a02ce15f3dafbd99 (patch) | |
tree | 7bad1f6a563f6ccf91f5e1ff0222fc0fe675d87e /test | |
parent | e344a3027b7cd5d6510cda8c9d80527de11e24f4 (diff) | |
download | erlang.mk-e0f8b46b0d5a78a10783d0b3a02ce15f3dafbd99.tar.gz erlang.mk-e0f8b46b0d5a78a10783d0b3a02ce15f3dafbd99.tar.bz2 erlang.mk-e0f8b46b0d5a78a10783d0b3a02ce15f3dafbd99.zip |
Add the test directory in the list of paths for proper
Diffstat (limited to 'test')
-rw-r--r-- | test/plugin_proper.mk | 40 | ||||
-rw-r--r-- | test/plugin_triq.mk | 5 |
2 files changed, 43 insertions, 2 deletions
diff --git a/test/plugin_proper.mk b/test/plugin_proper.mk new file mode 100644 index 0000000..70a520c --- /dev/null +++ b/test/plugin_proper.mk @@ -0,0 +1,40 @@ +# PropEr plugin. + +PROPER_CASES = test-dir +PROPER_TARGETS = $(addprefix proper-,$(PROPER_CASES)) + +.PHONY: proper $(PROPER_TARGETS) + +proper: $(PROPER_TARGETS) + +proper-test-dir: 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 $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 "Generate a module containing PropEr properties in TEST_DIR" + $t mkdir $(APP)/test + $t printf "%s\n" \ + "-module($(APP)_tests)." \ + "-include_lib(\"proper/include/proper.hrl\")." \ + "prop_bar() -> ?FORALL(_, any(), true)." > $(APP)/test/$(APP)_tests.erl + + $i "Run the PropEr plugin" + $t $(MAKE) -C $(APP) proper > $(APP)/proper.log + + $i "Check that both properties were checked" + $t grep -q prop_foo $(APP)/proper.log + $t grep -q prop_bar $(APP)/proper.log diff --git a/test/plugin_triq.mk b/test/plugin_triq.mk index 908ce47..a447e25 100644 --- a/test/plugin_triq.mk +++ b/test/plugin_triq.mk @@ -1,4 +1,4 @@ -# Triq plugin +# Triq plugin. TRIQ_CASES = test-dir TRIQ_TARGETS = $(addprefix triq-,$(TRIQ_CASES)) @@ -8,6 +8,7 @@ TRIQ_TARGETS = $(addprefix triq-,$(TRIQ_CASES)) triq: $(TRIQ_TARGETS) triq-test-dir: build clean + $i "Bootstrap a new OTP application named $(APP)" $t mkdir $(APP)/ $t cp ../erlang.mk $(APP)/ @@ -24,7 +25,7 @@ triq-test-dir: build clean "prop_foo() -> ?FORALL(_, any(), true)." \ "-endif." > $(APP)/src/$(APP).erl - $i "Generate a module containing Triq properies in TEST_DIR" + $i "Generate a module containing Triq properties in TEST_DIR" $t mkdir $(APP)/test $t printf "%s\n" \ "-module($(APP)_tests)." \ |