Current section
Files
Jump to
Current section
Files
src/startest@cli.erl
-module(startest@cli).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([run/1]).
-spec test_name_filter_flag() -> glint@flag:flag_builder(binary()).
test_name_filter_flag() ->
_pipe = glint@flag:string(),
_pipe@1 = glint@flag:default(_pipe, <<""/utf8>>),
glint@flag:description(
_pipe@1,
<<"Filter down tests just to those whose names match the filter"/utf8>>
).
-spec run(startest@config:config()) -> nil.
run(Config) ->
_pipe = glint:new(),
_pipe@1 = glint:with_name(_pipe, <<"Startest"/utf8>>),
_pipe@2 = glint:with_pretty_help(_pipe@1, glint:default_pretty_help()),
_pipe@5 = glint:add(
_pipe@2,
[],
begin
_pipe@4 = glint:command(
fun(Input) ->
_assert_subject = glint@flag:get_string(
erlang:element(3, Input),
<<"filter"/utf8>>
),
{ok, Filter} = case _assert_subject of
{ok, _} -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Assertion pattern match failed"/utf8>>,
value => _assert_fail,
module => <<"startest/cli"/utf8>>,
function => <<"run"/utf8>>,
line => 20})
end,
Config@1 = begin
_pipe@3 = Config,
startest@config:with_test_name_pattern(
_pipe@3,
case Filter of
<<""/utf8>> ->
none;
Filter@1 ->
{some, Filter@1}
end
)
end,
Ctx = {context, Config@1, logger},
startest@internal@runner:run_tests(Ctx)
end
),
glint:flag(_pipe@4, <<"filter"/utf8>>, test_name_filter_flag())
end
),
glint:run(_pipe@5, erlang:element(4, argv:load())).