Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile ltest using rebar3 LFE plugin #76

Merged
merged 11 commits into from
Feb 19, 2024
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ you may use the most recent rebar2-compatible release of ltest: 0.6.3.

## EUnit Compatibility [↟](#contents)

The tests created with ltest are compatible with EUnit ane can be run from
The tests created with ltest are compatible with EUnit and can be run from
either Erlang or LFE, using the standard EUnit listener or the ltest
listener (test runner).

Expand All @@ -51,7 +51,8 @@ listener (test runner).
* `(deftest ...)` for standard unit tests
* `(deftestgen ...)` for writing tests with generators, including the
standard EUnit test fixtures (see naming caveat below)
* `(deftestskip ...)` for skipping unit tests; note that for a test to show up as skipped in the test runner, it has to be `export`ed in the module
* `(deftestskip ...)` for skipping unit tests; note that for a test to show up
as skipped in the test runner, it has to be `export`ed in the module
* `(list ...)`-wrapped tests (of arbitrary depth) for use as test sets
* `(tuple ...)`-wrapped tests for naming/describing tests (first element
of tuple)
Expand Down
7 changes: 1 addition & 6 deletions priv/make/code.mk
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
compile:
@$(REBAR3) compile

# repl:
# $(REBAR3) as $(REBAR_PROFILE) compile
# $(LFE) -pa `$(REBAR3) as $(REBAR_PROFILE) path -s " -pa "`

repl:
@$(REBAR3) as repl compile
@$(REBAR3) as repl lfe repl
@$(REBAR3) lfe repl

shell:
@$(REBAR3) shell
Expand Down
48 changes: 8 additions & 40 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@
]}.

{deps, [
{lfe, "2.1.2"},
{erlang_color, "1.0.0"}
{lfe, "~> 2.1"},
{color, "~> 1.0", {pkg, erlang_color}}
]}.

{plugins, [
{rebar3_lfe, "~> 0.4.8"},
{rebar_cmd, "0.2.6"}
]}.

{provider_hooks, [
{pre, [{compile, {lfe, compile}}]}
]}.

{xref_checks,[
undefined_function_calls,undefined_functions,locals_not_used,
deprecated_function_calls,deprecated_functions
Expand All @@ -22,47 +27,10 @@
{warnings, [unknown]}
]}.

{pre_hooks, [
%% DEBUG:
%% {"(linux|darwin|solaris|freebsd|netbsd|openbsd)", compile,
%% "echo REBAR_DEPS_DIR = $REBAR_DEPS_DIR"},
{app_compile,
"$REBAR_DEPS_DIR/lfe/bin/lfescript $REBAR_DEPS_DIR/lfe/bin/lfec"
" -o $REBAR_DEPS_DIR/ltest/ebin"
" src/*.lfe"}
]}.

{profiles, [
{test, [
{eunit_opts, [verbose]},
{erl_opts, [
{src_dirs, ["src", "test"]}
]},
{pre_hooks, [
{"(linux|darwin|solaris|freebsd|netbsd|openbsd)", app_compile,
"$REBAR_DEPS_DIR/lfe/bin/lfescript $REBAR_DEPS_DIR/lfe/bin/lfec "
"-o $REBAR_DEPS_DIR/ltest/ebin "
"src/*.lfe"},
{"(linux|darwin|solaris|freebsd|netbsd|openbsd)", app_compile,
"$REBAR_DEPS_DIR/lfe/bin/lfescript $REBAR_DEPS_DIR/lfe/bin/lfec "
"-o $REBAR_DEPS_DIR/ltest/ebin "
"test/*.lfe"}
]}
]},
{repl, [
{pre_hooks, [
{"(linux|darwin|solaris|freebsd|netbsd|openbsd)", app_compile,
"$REBAR_DEPS_DIR/lfe/bin/lfescript $REBAR_DEPS_DIR/lfe/bin/lfec "
"-o $REBAR_DEPS_DIR/ltest/ebin "
"src/*.lfe"},
{"(linux|darwin|solaris|freebsd|netbsd|openbsd)", app_compile,
"$REBAR_DEPS_DIR/lfe/bin/lfescript $REBAR_DEPS_DIR/lfe/bin/lfec "
"-o $REBAR_DEPS_DIR/ltest/ebin "
"test/*.lfe"}
]},
{plugins, [
{rebar3_lfe, {git, "https://github.com/lfe-rebar3/rebar3_lfe.git", {branch, "release/0.3.x"}}}
]}
{erl_opts, [{src_dirs, ["src", "test"]}]}
]}
]}.

Expand Down
12 changes: 6 additions & 6 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{"1.2.0",
[{<<"erlang_color">>,{pkg,<<"erlang_color">>,<<"1.0.0">>},0},
{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.1">>},0}]}.
[{<<"color">>,{pkg,<<"erlang_color">>,<<"1.0.0">>},0},
{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}.
[
{pkg_hash,[
{<<"erlang_color">>, <<"145FE1D2E65C4516E4F03FEFCA6C2F47EBAD5899D978D70382A5CFE643E4AC9E">>},
{<<"lfe">>, <<"4A888B26172D198DC7A5AFEB897E8248AF7D56E1638D9C8249AAF933AE811B96">>}]},
{<<"color">>, <<"145FE1D2E65C4516E4F03FEFCA6C2F47EBAD5899D978D70382A5CFE643E4AC9E">>},
{<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]},
{pkg_hash_ext,[
{<<"erlang_color">>, <<"6B17E5E589C8FEF540574C9EA32B67CEC2C8A44283AAFE474D6E5818FB3EE038">>},
{<<"lfe">>, <<"C484D3B655D40DED58BC41B17B22F173711C681BF36063A234A9BAA9506947E1">>}]}
{<<"color">>, <<"6B17E5E589C8FEF540574C9EA32B67CEC2C8A44283AAFE474D6E5818FB3EE038">>},
{<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]}
].
Loading