-module(startest@cli). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([run/1]). -spec run(startest@config:config()) -> nil. run(Config) -> _pipe = glint:new(), _pipe@1 = glint:name(_pipe, <<"gleam test --"/utf8>>), _pipe@2 = glint:pretty_help(_pipe@1, glint:default_pretty_help()), _pipe@8 = glint:add( _pipe@2, [], begin Package_name = begin _pipe@3 = startest@internal@gleam_toml:read_name(), gleam@result:unwrap(_pipe@3, <<"my_project"/utf8>>) end, glint:command_help( gleam@string:concat( [<<"Runs the tests."/utf8>>, <<"\n\n"/utf8>>, <<"Accepts zero or more filepath patterns as `ARGS` to filter down which tests are run. For example:"/utf8>>, <<"\n\n"/utf8>>, <<" - `"/utf8>>, gleam_community@ansi:cyan( <<"gleam test -- example"/utf8>> ), <<"` will run the tests in all files that have \"example\" in their name"/utf8>>, <<"\n"/utf8>>, <<" - `"/utf8>>, gleam_community@ansi:cyan( <<<<"gleam test -- test/"/utf8, Package_name/binary>>/binary, "_test.gleam"/utf8>> ), <<"` will run just the tests in that specific file"/utf8>>] ), fun() -> glint:flag( <<"test-name-filter"/utf8>>, begin _pipe@4 = glint:string(), _pipe@5 = glint:default(_pipe@4, <<""/utf8>>), glint:flag_help( _pipe@5, <<"Filter down tests just to those whose names match the filter"/utf8>> ) end, fun(Test_name_filter) -> glint:command( fun(_, Args, Flags) -> Filters = Args, _assert_subject = Test_name_filter(Flags), {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 => 53} ) end, Config@1 = begin _pipe@6 = Config, _pipe@7 = startest@config:with_filters( _pipe@6, Filters ), startest@config:with_test_name_pattern( _pipe@7, case Filter of <<""/utf8>> -> none; Filter@1 -> {some, Filter@1} end ) end, Clock = bigben@clock:new(), Ctx = {context, Config@1, Clock, logger, bigben@clock:now(Clock)}, startest@internal@runner:run_tests(Ctx) end ) end ) end ) end ), glint:run(_pipe@8, erlang:element(4, argv:load())).