summaryrefslogtreecommitdiff
path: root/inttest
diff options
context:
space:
mode:
authorYuki Ito <yuki@gnnk.net>2014-04-29 18:36:33 +0900
committerYuki Ito <yuki@gnnk.net>2014-05-13 12:53:52 +0900
commitc996e9878b76567b06c83e41bebbe783cced19b5 (patch)
treebf3031b4bc8cf17cbd5b775b16f558f98dccb118 /inttest
parent837df640872d6a5d5d75a7308126e2769d7babad (diff)
Make sure that eunit/qc_compile_opts works fix #245
Diffstat (limited to 'inttest')
-rw-r--r--inttest/eunit/eunit_rt.erl48
-rw-r--r--inttest/eunit/eunit_src/bar.erl6
-rw-r--r--inttest/eunit/rebar-eunit_compile_opts.config1
-rw-r--r--inttest/eunit/src/foo.erl10
4 files changed, 65 insertions, 0 deletions
diff --git a/inttest/eunit/eunit_rt.erl b/inttest/eunit/eunit_rt.erl
new file mode 100644
index 0000000..47f3331
--- /dev/null
+++ b/inttest/eunit/eunit_rt.erl
@@ -0,0 +1,48 @@
+-module(eunit_rt).
+-export([files/0, run/1]).
+
+-include_lib("eunit/include/eunit.hrl").
+
+files() ->
+ [{create, "ebin/foo.app", app(foo)},
+ {copy, "../../rebar", "rebar"},
+ {copy, "src", "src"},
+ {copy, "eunit_src", "eunit_src"},
+ {copy,
+ "rebar-eunit_compile_opts.config",
+ "rebar-eunit_compile_opts.config"}].
+
+run(_Dir) ->
+ ifdef_test(),
+ eunit_compile_opts_test(),
+ ok.
+
+ifdef_test() ->
+ {ok, Output} = retest:sh("./rebar -v eunit"),
+ ?assert(check_output(Output, "foo_test")),
+ ?assertMatch({ok, _}, retest:sh("./rebar clean")).
+
+eunit_compile_opts_test() ->
+ {ok, Output} =
+ retest:sh("./rebar -v -C rebar-eunit_compile_opts.config eunit"),
+ ?assert(check_output(Output, "bar_test")),
+ ?assertMatch(
+ {ok, _},
+ retest:sh("./rebar -C rebar-eunit_compile_opts.config clean")).
+
+check_output(Output, Target) ->
+ lists:any(fun(Line) ->
+ string:str(Line, Target) > 0
+ end, Output).
+
+%%
+%% Generate the contents of a simple .app file
+%%
+app(Name) ->
+ App = {application, Name,
+ [{description, atom_to_list(Name)},
+ {vsn, "1"},
+ {modules, []},
+ {registered, []},
+ {applications, [kernel, stdlib]}]},
+ io_lib:format("~p.\n", [App]).
diff --git a/inttest/eunit/eunit_src/bar.erl b/inttest/eunit/eunit_src/bar.erl
new file mode 100644
index 0000000..6a80dac
--- /dev/null
+++ b/inttest/eunit/eunit_src/bar.erl
@@ -0,0 +1,6 @@
+-module(bar).
+
+-include_lib("eunit/include/eunit.hrl").
+
+bar_test() ->
+ ?assert(true).
diff --git a/inttest/eunit/rebar-eunit_compile_opts.config b/inttest/eunit/rebar-eunit_compile_opts.config
new file mode 100644
index 0000000..13b2d94
--- /dev/null
+++ b/inttest/eunit/rebar-eunit_compile_opts.config
@@ -0,0 +1 @@
+{eunit_compile_opts, [{src_dirs, ["eunit_src"]}]}.
diff --git a/inttest/eunit/src/foo.erl b/inttest/eunit/src/foo.erl
new file mode 100644
index 0000000..a4c91ba
--- /dev/null
+++ b/inttest/eunit/src/foo.erl
@@ -0,0 +1,10 @@
+-module(foo).
+
+-ifdef(TEST).
+
+-include_lib("eunit/include/eunit.hrl").
+
+foo_test() ->
+ ?assert(true).
+
+-endif.