diff options
author | Loïc Hoguin <[email protected]> | 2015-12-24 15:26:45 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2015-12-24 15:26:45 +0100 |
commit | 1624b70fe633229ce71e70dd3a7be5dcb8c47583 (patch) | |
tree | 3acdbfca707d1f279df0aa2c641cc0a59156eae5 /test | |
parent | 3669bd9d3680ee5a353cad9a938b593248babba0 (diff) | |
download | erlang.mk-1624b70fe633229ce71e70dd3a7be5dcb8c47583.tar.gz erlang.mk-1624b70fe633229ce71e70dd3a7be5dcb8c47583.tar.bz2 erlang.mk-1624b70fe633229ce71e70dd3a7be5dcb8c47583.zip |
Add EUNIT_ERL_OPTS variable
Diffstat (limited to 'test')
-rw-r--r-- | test/plugin_eunit.mk | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/test/plugin_eunit.mk b/test/plugin_eunit.mk index 26c0997..61f0e92 100644 --- a/test/plugin_eunit.mk +++ b/test/plugin_eunit.mk @@ -1,6 +1,6 @@ # EUnit plugin. -EUNIT_CASES = all apps-only check fun mod test-dir tests +EUNIT_CASES = all apps-only check erl-opts fun mod test-dir tests EUNIT_TARGETS = $(addprefix eunit-,$(EUNIT_CASES)) EUNIT_CLEAN_TARGETS = $(addprefix clean-,$(EUNIT_TARGETS)) @@ -103,6 +103,27 @@ eunit-check: build clean-eunit-check $i "Check that EUnit runs on 'make check'" $t $(MAKE) -C $(APP) check | grep -q "Test passed." +eunit-erl-opts: build clean-eunit-erl-opts + + $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 + + $i "Set EUNIT_ERL_OPTS in the Makefile" + $t perl -ni.bak -e 'print;if ($$.==1) {print "EUNIT_ERL_OPTS = -eval \"erlang:display(hello).\" \n"}' $(APP)/Makefile + + $i "Generate a module containing EUnit tests" + $t printf "%s\n" \ + "-module($(APP))." \ + "-ifdef(TEST)." \ + "-include_lib(\"eunit/include/eunit.hrl\")." \ + "ok_test() -> ok." \ + "-endif." > $(APP)/src/$(APP).erl + + $i "Check that EUnit uses EUNIT_ERL_OPTS" + $t $(MAKE) -C $(APP) eunit | grep -q "hello" + eunit-fun: build clean-eunit-fun $i "Bootstrap a new OTP application named $(APP)" |