|
@@ -1,13 +1,45 @@
|
|
|
-module(mad_compile_SUITE).
|
|
|
|
|
|
-export([all/0]).
|
|
|
+-export([erl_files/1]).
|
|
|
+-export([app_src_files/1]).
|
|
|
+-export([is_app_src/1]).
|
|
|
+-export([app_src_to_app/1]).
|
|
|
+-export([erl_to_beam/1]).
|
|
|
+-export([is_compiled/1]).
|
|
|
-export([deps/1]).
|
|
|
|
|
|
-import(helper, [get_value/2]).
|
|
|
|
|
|
|
|
|
all() ->
|
|
|
- [deps].
|
|
|
+ [
|
|
|
+ erl_files, app_src_files, is_app_src, app_src_to_app, erl_to_beam, deps,
|
|
|
+ is_compiled
|
|
|
+ ].
|
|
|
+
|
|
|
+erl_files(Config) ->
|
|
|
+ DataDir = get_value(data_dir, Config),
|
|
|
+ SrcDir = filename:join([DataDir, "deps", "one", "src"]),
|
|
|
+ ErlFile = filename:join(SrcDir, "one.erl"),
|
|
|
+ [ErlFile] = mad_compile:erl_files(SrcDir).
|
|
|
+
|
|
|
+app_src_files(Config) ->
|
|
|
+ DataDir = get_value(data_dir, Config),
|
|
|
+ SrcDir = filename:join([DataDir, "deps", "one", "src"]),
|
|
|
+ AppSrcFile = filename:join(SrcDir, "one.app.src"),
|
|
|
+ [AppSrcFile] = mad_compile:app_src_files(SrcDir).
|
|
|
+
|
|
|
+is_app_src(_) ->
|
|
|
+ false = mad_compile:is_app_src("/path/to/file.erl"),
|
|
|
+ true = mad_compile:is_app_src("/path/to/file.app.src").
|
|
|
+
|
|
|
+app_src_to_app(_) ->
|
|
|
+ "file.app" = mad_compile:app_src_to_app("/path/to/file.app.src").
|
|
|
+
|
|
|
+erl_to_beam(_) ->
|
|
|
+ "/path/to/ebin/file.beam" = mad_compile:erl_to_beam("/path/to/ebin",
|
|
|
+ "/path/to/file.erl").
|
|
|
|
|
|
deps(Config) ->
|
|
|
DataDir = get_value(data_dir, Config),
|
|
@@ -19,3 +51,10 @@ deps(Config) ->
|
|
|
ok = application:load(two),
|
|
|
{ok, [one]} = application:get_key(one, modules),
|
|
|
{ok, [two]} = application:get_key(two, modules).
|
|
|
+
|
|
|
+is_compiled(Config) ->
|
|
|
+ DataDir = get_value(data_dir, Config),
|
|
|
+ SrcDir = filename:join([DataDir, "deps", "one", "src"]),
|
|
|
+ EbinDir = filename:join([SrcDir, "..", "ebin"]),
|
|
|
+ false = mad_compile:is_compiled(EbinDir, filename:join(SrcDir, "x.erl")),
|
|
|
+ true = mad_compile:is_compiled(EbinDir, filename:join(SrcDir, "one.erl")).
|