diff options
author | Loïc Hoguin <essen@ninenines.eu> | 2016-10-20 13:46:34 +0200 |
---|---|---|
committer | Loïc Hoguin <essen@ninenines.eu> | 2016-10-20 13:46:34 +0200 |
commit | eee42f35647ea9eb0da33cfdc6735a9bed4faced (patch) | |
tree | 537f80e9c54644d0ce7a367251985b787e20d6f3 | |
parent | 38454657fc33d90333c4d5447fb25bffceb6e80e (diff) | |
download | erlang.mk-eee42f35647ea9eb0da33cfdc6735a9bed4faced.tar.gz erlang.mk-eee42f35647ea9eb0da33cfdc6735a9bed4faced.tar.bz2 erlang.mk-eee42f35647ea9eb0da33cfdc6735a9bed4faced.zip |
Add a test that included templates are relative to the original
-rw-r--r-- | test/plugin_erlydtl.mk | 29 |
1 files changed, 28 insertions, 1 deletions
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)" |