diff options
author | alisdair sullivan <alisdairsullivan@yahoo.ca> | 2016-08-27 13:50:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-27 13:50:59 -0700 |
commit | c0b5f7f921bed20c65f64b25e3ea2e59095bc05e (patch) | |
tree | ebe507a3b839398660cf688f1b529c6f399a1a4d /test | |
parent | 4347f48e7fc7f0939b37fe984f1286f332735630 (diff) | |
parent | 3beeec9db0880c5e9f57a427796d9d9af9ffa46d (diff) |
Merge pull request #1316 from erlang/reset_coverdata
reset accumulated coverdata on writing out to disk
Diffstat (limited to 'test')
-rw-r--r-- | test/rebar_cover_SUITE.erl | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/test/rebar_cover_SUITE.erl b/test/rebar_cover_SUITE.erl index 1289f19..4192f4a 100644 --- a/test/rebar_cover_SUITE.erl +++ b/test/rebar_cover_SUITE.erl @@ -13,7 +13,8 @@ index_written/1, flag_verbose/1, config_verbose/1, - excl_mods/1]). + excl_mods/1, + coverdata_is_reset_on_write/1]). -include_lib("common_test/include/ct.hrl"). -include_lib("eunit/include/eunit.hrl"). @@ -37,7 +38,7 @@ all() -> root_extra_src_dirs, index_written, flag_verbose, config_verbose, - excl_mods]. + excl_mods, coverdata_is_reset_on_write]. flag_coverdata_written(Config) -> AppDir = ?config(apps, Config), @@ -232,3 +233,20 @@ excl_mods(Config) -> {file, _} = cover:is_compiled(Mod1), false = cover:is_compiled(Mod2). + +coverdata_is_reset_on_write(Config) -> + AppDir = ?config(apps, Config), + + Name = rebar_test_utils:create_random_name("coverdata_is_reset_on_write_"), + Vsn = rebar_test_utils:create_random_vsn(), + rebar_test_utils:create_eunit_app(AppDir, Name, Vsn, [kernel, stdlib]), + + RebarConfig = [{erl_opts, [{d, some_define}]}, {cover_enabled, true}], + rebar_test_utils:run_and_check(Config, + RebarConfig, + ["eunit"], + {ok, [{app, Name}]}), + + Res = lists:map(fun(M) -> cover:analyse(M) end, cover:modules()), + Ok = lists:foldl(fun({ok, R}, Acc) -> R ++ Acc end, [], Res), + [] = lists:filter(fun({_, {0,_}}) -> false; (_) -> true end, Ok). |