From 862eeb912f4cfa1371ea29bfcba8beac289160e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 12 Oct 2015 12:06:56 +0200 Subject: Cleanup ErlyDTL test --- test/plugin_erlydtl.mk | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'test/plugin_erlydtl.mk') diff --git a/test/plugin_erlydtl.mk b/test/plugin_erlydtl.mk index 53eded3..2cae220 100644 --- a/test/plugin_erlydtl.mk +++ b/test/plugin_erlydtl.mk @@ -1,10 +1,10 @@ -# ErlyDTL plugin +# ErlyDTL plugin. -ERLYDTL_CASES = test +ERLYDTL_CASES = compile ERLYDTL_TARGETS = $(addprefix erlydtl-,$(ERLYDTL_CASES)) ERLYDTL_CLEAN_TARGETS = $(addprefix clean-,$(ERLYDTL_TARGETS)) -.PHONY: erlydtl clean-erlydtl +.PHONY: erlydtl $(ERLYDTL_TARGETS) clean-erlydtl $(ERLYDTL_CLEAN_TARGETS) clean-erlydtl: $(ERLYDTL_CLEAN_TARGETS) @@ -13,29 +13,30 @@ $(ERLYDTL_CLEAN_TARGETS): erlydtl: $(ERLYDTL_TARGETS) -erlydtl-test: build clean-erlydtl-test - $i "Bootstrap a new OTP application named $(APP)" +erlydtl-compile: build clean-erlydtl-compile + + $i "Bootstrap a new OTP library named $(APP)" $t mkdir $(APP)/ $t cp ../erlang.mk $(APP)/ - $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v + $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v + + $i "Add ErlyDTL to the list of dependencies" + $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = erlydtl\n"}' $(APP)/Makefile + + $i "Generate ErlyDTL templates" $t mkdir $(APP)/templates - $t touch $(APP)/templates/$(APP)_template.dtl - $t touch $(APP)/templates/$(APP)_template2.dtl - $t echo "PROJECT = $(APP)" > $(APP)/Makefile - $t echo "DEPS = erlydtl" >> $(APP)/Makefile - $t echo "include erlang.mk" >> $(APP)/Makefile + $t touch $(APP)/templates/$(APP)_one.dtl + $t touch $(APP)/templates/$(APP)_two.dtl $i "Build the application" $t $(MAKE) -C $(APP) $v $i "Check that ErlyDTL templates are compiled" - $t test -f $(APP)/ebin/$(APP)_template_dtl.beam - $t test -f $(APP)/ebin/$(APP)_template2_dtl.beam + $t test -f $(APP)/ebin/$(APP)_one_dtl.beam + $t test -f $(APP)/ebin/$(APP)_one_dtl.beam $i "Check that ErlyDTL generated modules are included in .app file" $t $(ERL) -pa $(APP)/ebin/ -eval " \ ok = application:load($(APP)), \ - {ok, Modules} = application:get_key($(APP), modules), \ - true = lists:member($(APP)_template_dtl, Modules), \ - true = lists:member($(APP)_template2_dtl, Modules), \ + {ok, [$(APP_)_one_dtl, $(APP)_two_dtl]} = application:get_key($(APP), modules), \ halt()" -- cgit v1.2.3