diff options
author | Tristan Sloughter <t@crashfast.com> | 2014-11-29 17:29:42 -0600 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2014-11-29 17:29:42 -0600 |
commit | fc2089aecf94ed018c1c8c60a43a0e3ce323da13 (patch) | |
tree | a63ef9894f620b846a55323ca25a740f3fb61538 | |
parent | 731f05cc3db67ae49d6c7b5d7b5775c928f22691 (diff) |
start of breaking out test code for ease of checks
-rw-r--r-- | test/rebar_compile_SUITE.erl | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/test/rebar_compile_SUITE.erl b/test/rebar_compile_SUITE.erl index 7b17409..2acc64a 100644 --- a/test/rebar_compile_SUITE.erl +++ b/test/rebar_compile_SUITE.erl @@ -35,25 +35,28 @@ all() -> build_basic_app(Config) -> AppDir = proplists:get_value(apps, Config), - State = proplists:get_value(state, Config), Name = create_random_name("app1_"), Vsn = create_random_vsn(), create_app(AppDir, Name, Vsn, [kernel, stdlib]), - ConfigFile = filename:join([AppDir, "rebar.config"]), - write_config(ConfigFile, []), - rebar3:run(rebar_state:new(State, [], AppDir), "compile"), - - %% Verify app was built - [App] = rebar_app_discover:find_apps([AppDir]), - - ?assertEqual(Name, ec_cnv:to_list(rebar_app_info:name(App))). + run_and_check(Config, [], "compile", [{app, Name}]). %%%=================================================================== %%% Helper Functions %%%=================================================================== +run_and_check(Config, RebarConfig, Command, Expect) -> + AppDir = proplists:get_value(apps, Config), + State = proplists:get_value(state, Config), + + rebar3:run(rebar_state:new(State, RebarConfig, AppDir), Command), + + lists:foreach(fun({app, Name}) -> + [App] = rebar_app_discover:find_apps([AppDir]), + ?assertEqual(Name, ec_cnv:to_list(rebar_app_info:name(App))) + end, Expect). + create_app(AppDir, Name, Vsn, Deps) -> write_src_file(AppDir, Name), write_app_src_file(AppDir, Name, Vsn, Deps), |