aboutsummaryrefslogtreecommitdiffstats
path: root/test/plugin_erlydtl.mk
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-10-12 11:52:05 +0200
committerLoïc Hoguin <[email protected]>2015-10-12 11:52:05 +0200
commit77e3b8d0e63ecc2bfa46b3b3caf75c770b713d7b (patch)
treef23a6eff62fbe49780dc0cd1db4678e116543341 /test/plugin_erlydtl.mk
parent62ac3a5f4e10b6409b5c80a8234e3e680132e111 (diff)
parent9de82c21954044969708ce019618a57aa59b8b53 (diff)
downloaderlang.mk-77e3b8d0e63ecc2bfa46b3b3caf75c770b713d7b.tar.gz
erlang.mk-77e3b8d0e63ecc2bfa46b3b3caf75c770b713d7b.tar.bz2
erlang.mk-77e3b8d0e63ecc2bfa46b3b3caf75c770b713d7b.zip
Merge branch 'fix-plugin-erlydtl' of https://github.com/bullno1/erlang.mk
Diffstat (limited to 'test/plugin_erlydtl.mk')
-rw-r--r--test/plugin_erlydtl.mk41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/plugin_erlydtl.mk b/test/plugin_erlydtl.mk
new file mode 100644
index 0000000..53eded3
--- /dev/null
+++ b/test/plugin_erlydtl.mk
@@ -0,0 +1,41 @@
+# ErlyDTL plugin
+
+ERLYDTL_CASES = test
+ERLYDTL_TARGETS = $(addprefix erlydtl-,$(ERLYDTL_CASES))
+ERLYDTL_CLEAN_TARGETS = $(addprefix clean-,$(ERLYDTL_TARGETS))
+
+.PHONY: erlydtl clean-erlydtl
+
+clean-erlydtl: $(ERLYDTL_CLEAN_TARGETS)
+
+$(ERLYDTL_CLEAN_TARGETS):
+ $t rm -rf $(APP_TO_CLEAN)/
+
+erlydtl: $(ERLYDTL_TARGETS)
+
+erlydtl-test: build clean-erlydtl-test
+ $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
+ $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
+
+ $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
+
+ $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), \
+ halt()"