From eee42f35647ea9eb0da33cfdc6735a9bed4faced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 20 Oct 2016 13:46:34 +0200 Subject: Add a test that included templates are relative to the original --- test/plugin_erlydtl.mk | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'test/plugin_erlydtl.mk') diff --git a/test/plugin_erlydtl.mk b/test/plugin_erlydtl.mk index 853ba55..fec091a 100644 --- a/test/plugin_erlydtl.mk +++ b/test/plugin_erlydtl.mk @@ -1,6 +1,6 @@ # ErlyDTL plugin. -ERLYDTL_CASES = compile full-path opts path-full-path-suffix suffix +ERLYDTL_CASES = compile full-path include-template opts path-full-path-suffix suffix ERLYDTL_TARGETS = $(addprefix erlydtl-,$(ERLYDTL_CASES)) .PHONY: erlydtl $(ERLYDTL_TARGETS) @@ -63,6 +63,33 @@ erlydtl-full-path: build clean {ok, [deep_$(APP)_two_dtl, $(APP_)_one_dtl]} = application:get_key($(APP), modules), \ halt()" +erlydtl-include-template: build clean + + $i "Bootstrap a new OTP library named $(APP)" + $t mkdir $(APP)/ + $t cp ../erlang.mk $(APP)/ + $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v + + $i "Generate ErlyDTL templates" + $t mkdir -p $(APP)/dtl/foo/ + $t echo '{% include "foo/bar.dtl" %}' > $(APP)/dtl/foo.dtl + $t echo '{% var %}' > $(APP)/dtl/foo/bar.dtl + $t echo '{% extends "bar.dtl" %}' > $(APP)/dtl/foo/baz.dtl + + $i "Build the application" + $t $(MAKE) -C $(APP) DEPS=erlydtl DTL_PATH=dtl DTL_FULL_PATH=1 DTL_SUFFIX= $v + + $i "Check that ErlyDTL templates are compiled" + $t test -f $(APP)/ebin/foo.beam + $t test -f $(APP)/ebin/foo_bar.beam + $t test -f $(APP)/ebin/foo_baz.beam + + $i "Check that ErlyDTL generated modules are included in .app file" + $t $(ERL) -pa $(APP)/ebin/ -eval " \ + ok = application:load($(APP)), \ + {ok, [foo, foo_bar, foo_baz]} = application:get_key($(APP), modules), \ + halt()" + erlydtl-opts: build clean $i "Bootstrap a new OTP library named $(APP)" -- cgit v1.2.3