From 1624b70fe633229ce71e70dd3a7be5dcb8c47583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 24 Dec 2015 15:26:45 +0100 Subject: Add EUNIT_ERL_OPTS variable --- test/plugin_eunit.mk | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'test/plugin_eunit.mk') 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)" -- cgit v1.2.3