plugin_triq.mk 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # Triq plugin.
  2. TRIQ_TARGETS = $(call list_targets,triq)
  3. .PHONY: triq $(TRIQ_TARGETS)
  4. triq: $(TRIQ_TARGETS)
  5. triq-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 Triq to the list of dependencies"
  11. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = triq\n"}' $(APP)/Makefile
  12. $i "Generate a module containing Triq properties"
  13. $t printf "%s\n" \
  14. "-module($(APP))." \
  15. "-ifdef(TEST)." \
  16. "-include_lib(\"triq/include/triq.hrl\")." \
  17. "prop_foo() -> ?FORALL(_, any(), true)." \
  18. "-endif." > $(APP)/src/$(APP).erl
  19. $i "Generate a module containing Triq properties in TEST_DIR"
  20. $t mkdir $(APP)/test
  21. $t printf "%s\n" \
  22. "-module($(APP)_tests)." \
  23. "-include_lib(\"triq/include/triq.hrl\")." \
  24. "prop_bar() -> ?FORALL(_, any(), true)." > $(APP)/test/$(APP)_tests.erl
  25. $i "Run the Triq plugin"
  26. $t $(MAKE) -C $(APP) triq $v > $(APP)/triq.log
  27. $i "Check that both properties were checked"
  28. $t grep -q prop_foo $(APP)/triq.log
  29. $t grep -q prop_bar $(APP)/triq.log