From fc2089aecf94ed018c1c8c60a43a0e3ce323da13 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sat, 29 Nov 2014 17:29:42 -0600 Subject: start of breaking out test code for ease of checks --- test/rebar_compile_SUITE.erl | 21 ++++++++++++--------- 1 file 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), -- cgit v1.1