plugin_proper.mk 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # PropEr plugin.
  2. PROPER_TARGETS = $(call list_targets,proper)
  3. .PHONY: proper $(PROPER_TARGETS)
  4. proper: $(PROPER_TARGETS)
  5. proper-test-dir: init
  6. $i "Bootstrap a new OTP application named $(APP)"
  7. $t mkdir $(APP)/
  8. $t cp ../erlang.mk $(APP)/
  9. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  10. $i "Add PropEr to the list of dependencies"
  11. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = proper\n"}' $(APP)/Makefile
  12. $i "Generate a module containing PropEr properties"
  13. $t printf "%s\n" \
  14. "-module($(APP))." \
  15. "-ifdef(TEST)." \
  16. "-include_lib(\"proper/include/proper.hrl\")." \
  17. "prop_foo() -> ?FORALL(_, any(), true)." \
  18. "-endif." > $(APP)/src/$(APP).erl
  19. $i "Generate a module containing PropEr properties in TEST_DIR"
  20. $t mkdir $(APP)/test
  21. $t printf "%s\n" \
  22. "-module($(APP)_tests)." \
  23. "-include_lib(\"proper/include/proper.hrl\")." \
  24. "prop_bar() -> ?FORALL(_, any(), true)." > $(APP)/test/$(APP)_tests.erl
  25. $i "Run the PropEr plugin"
  26. $t $(MAKE) -C $(APP) proper $v > $(APP)/proper.log
  27. $i "Check that both properties were checked"
  28. $t grep -q prop_foo $(APP)/proper.log
  29. $t grep -q prop_bar $(APP)/proper.log