Files
gsc/test/gsc_tests.erl
T
2026-06-05 18:33:18 -07:00

44 lines
948 B
Erlang

% dynamic hacky module that loads all the tests
-module(gsc_tests).
-export([
main/0,
cli_args/1
]).
main() ->
cli_args([]),
ok.
cli_args(TestNames) ->
% load ts_utils
TsUtils = zx:get_home() ++ "/test/ts_utils.erl",
case compile:file(TsUtils) of
{ok, ts_utils} -> ok;
Error -> error(Error)
end,
ts_utils:tidily(fun() -> do(TestNames) end).
do(["-h" | _]) -> do_help();
do(["--help" | _]) -> do_help();
do(["-l" | _]) -> do_list();
do(["--list" | _]) -> do_list();
do(["-a" | _]) -> do_all();
do(["--all" | _]) -> do_all();
do(TestNames) ->
lists:foreach(fun ts_utils:run_test_by_name/1, TestNames).
do_help() ->
io:format("go help yourself~n").
do_list() ->
Names = ts_utils:runnable_test_names(),
[io:format("~p~n", [N]) || N <- Names].
do_all() ->
{Gd, _} = ts_utils:runnable_test_mods(),
[begin ts_utils:rmm(G), io:format("~n") end || G <- Gd].