aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-05-10 15:56:47 +0300
committerLoïc Hoguin <[email protected]>2015-05-10 15:56:47 +0300
commit47eb068a47a4a9a079dfeac5e255b979f5df03ab (patch)
treebd13478c35405ba935170e666468d8299788b2d2
parentce2c8bb340acf419a53b030b2eacbf40a6fcb247 (diff)
downloaderlang.mk-47eb068a47a4a9a079dfeac5e255b979f5df03ab.tar.gz
erlang.mk-47eb068a47a4a9a079dfeac5e255b979f5df03ab.tar.bz2
erlang.mk-47eb068a47a4a9a079dfeac5e255b979f5df03ab.zip
Use an Erlang snippet for Triq
-rw-r--r--plugins/triq.mk24
1 files changed, 18 insertions, 6 deletions
diff --git a/plugins/triq.mk b/plugins/triq.mk
index 2edfdba..f487f8c 100644
--- a/plugins/triq.mk
+++ b/plugins/triq.mk
@@ -8,24 +8,36 @@ ifneq ($(wildcard $(DEPS_DIR)/triq),)
tests:: triq
-define triq_run
-$(ERL) -pa $(CURDIR)/ebin $(DEPS_DIR)/*/ebin \
- -eval "try $(1) of true -> halt(0); _ -> halt(1) catch error:undef -> io:format(\"Undefined property or module~n\"), halt() end."
+define triq_check.erl
+ code:add_pathsa(["$(CURDIR)/ebin", "$(DEPS_DIR)/*/ebin"]),
+ try
+ case $(1) of
+ all -> [true] =:= lists:usort([triq:check(M) || M <- [$(MODULES)]]);
+ module -> triq:check($(2));
+ function -> triq:check($(2))
+ end
+ of
+ true -> halt(0);
+ _ -> halt(1)
+ catch error:undef ->
+ io:format("Undefined property or module~n"),
+ halt(0)
+ end.
endef
ifdef t
ifeq (,$(findstring :,$(t)))
triq: test-build
- @$(call triq_run,triq:check($(t)))
+ @$(call erlang,$(call triq_check.erl,module,$(t)))
else
triq: test-build
@echo Testing $(t)/0
- @$(call triq_run,triq:check($(t)()))
+ @$(call erlang,$(call triq_check.erl,function,$(t)()))
endif
else
triq: test-build
$(eval MODULES := $(shell find ebin -type f -name \*.beam \
| sed "s/ebin\//'/;s/\.beam/',/" | sed '$$s/.$$//'))
- $(gen_verbose) $(call triq_run,[true] =:= lists:usort([triq:check(M) || M <- [$(MODULES)]]))
+ $(gen_verbose) $(call erlang,$(call triq_check.erl,all,undefined))
endif
endif