aboutsummaryrefslogtreecommitdiffstats
path: root/test/plugin_proper.mk
diff options
context:
space:
mode:
Diffstat (limited to 'test/plugin_proper.mk')
-rw-r--r--test/plugin_proper.mk40
1 files changed, 40 insertions, 0 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