aboutsummaryrefslogtreecommitdiffstats
path: root/test/plugin_eunit.mk
diff options
context:
space:
mode:
authorcrownedgrouse <[email protected]>2016-04-05 00:41:59 +0200
committerLoïc Hoguin <[email protected]>2016-04-05 21:57:40 +0200
commite629cf3719227ccb5d685394491e018605e61b24 (patch)
tree36e2c2690c206910a84cf5bd74946be552fc5969 /test/plugin_eunit.mk
parent9ac33437613ee23d555df92ffb5b27dc72e8d641 (diff)
downloaderlang.mk-e629cf3719227ccb5d685394491e018605e61b24.tar.gz
erlang.mk-e629cf3719227ccb5d685394491e018605e61b24.tar.bz2
erlang.mk-e629cf3719227ccb5d685394491e018605e61b24.zip
Add test for eunit accessing priv_dir
Diffstat (limited to 'test/plugin_eunit.mk')
-rw-r--r--test/plugin_eunit.mk20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/plugin_eunit.mk b/test/plugin_eunit.mk
index c25484b..ed002a5 100644
--- a/test/plugin_eunit.mk
+++ b/test/plugin_eunit.mk
@@ -1,6 +1,6 @@
# EUnit plugin.
-EUNIT_CASES = all apps-only check erl-opts fun mod test-dir tests
+EUNIT_CASES = all apps-only check erl-opts fun mod priv test-dir tests
EUNIT_TARGETS = $(addprefix eunit-,$(EUNIT_CASES))
.PHONY: eunit $(EUNIT_TARGETS)
@@ -163,6 +163,24 @@ eunit-mod: build clean
$i "Check that we can run EUnit on a specific module"
$t $(MAKE) -C $(APP) eunit t=$(APP) $v
+eunit-priv: build clean
+
+ $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 "Generate a module containing EUnit tests"
+ $t printf "%s\n" \
+ "-module($(APP))." \
+ "-ifdef(TEST)." \
+ "-include_lib(\"eunit/include/eunit.hrl\")." \
+ "ok_test() -> ?assert(is_list(code:priv_dir($(APP))) =:= true)." \
+ "-endif." > $(APP)/src/$(APP).erl
+
+ $i "Check that EUnit can resolve the priv_dir"
+ $t $(MAKE) -C $(APP) tests | grep -q "Test passed."
+
eunit-test-dir: build clean
$i "Bootstrap a new OTP application named $(APP)"