From 48aac66dc4329513632d896d6a2664b06eaa7f44 Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Wed, 27 Aug 2014 23:27:50 -0400 Subject: [PATCH] Add make target for eunit tests --- Makefile | 11 ++++++++++- test/eunit_SUITE.erl | 17 +++++++++++++++++ test/riichi_tests.erl | 2 +- test/riichi_yaku_tests.erl | 2 -- 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 test/eunit_SUITE.erl diff --git a/Makefile b/Makefile index 8517a0b..d37a845 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,15 @@ PROJECT = riichi -DEPS = reloader +DEPS = reloader eunit_formatters dep_reloader = git https://github.com/oinksoft/reloader.git master +dep_eunit_formatters = git https://github.com/seancribbs/eunit_formatters.git master include erlang.mk + +ifneq ($(wildcard test/),) +ebin/$(PROJECT).app:: $(shell find test -type f -name \*_tests.erl) + $(if $(strip $?),$(call compile_erl,$?)) +endif + +eunit: clean deps app + $(gen_verbose) erl -noshell -pa ebin -eval 'eunit:test({application, $(PROJECT)}, [no_tty, {report, {eunit_progress, [colored, profile]}}])' -s init stop diff --git a/test/eunit_SUITE.erl b/test/eunit_SUITE.erl new file mode 100644 index 0000000..ca411b8 --- /dev/null +++ b/test/eunit_SUITE.erl @@ -0,0 +1,17 @@ +-module(eunit_SUITE). + +-include_lib("common_test/include/ct.hrl"). + +%% ct. +-export([all/0]). + +%% Tests. +-export([eunit/1]). + +%% ct. + +all() -> + [eunit]. + +eunit(_) -> + ok = eunit:test({application, riichi}). diff --git a/test/riichi_tests.erl b/test/riichi_tests.erl index 54e42bc..db3606b 100644 --- a/test/riichi_tests.erl +++ b/test/riichi_tests.erl @@ -1,6 +1,6 @@ -module(riichi_tests). --include("riichi.hrl"). +-include("../include/riichi.hrl"). -include_lib("eunit/include/eunit.hrl"). valid_tile_dragon_test_() -> diff --git a/test/riichi_yaku_tests.erl b/test/riichi_yaku_tests.erl index 4105002..c118501 100644 --- a/test/riichi_yaku_tests.erl +++ b/test/riichi_yaku_tests.erl @@ -1,7 +1,5 @@ -module(riichi_yaku_tests). --compile(export_all). - -include("../include/riichi.hrl"). -include_lib("eunit/include/eunit.hrl").