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

Adopt erlfmt #11

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@ clean: $(REBAR)
$(REBAR) clean

test: $(REBAR)
$(REBAR) fmt --check
$(REBAR) eunit skip_deps=true

format: $(REBAR)
$(REBAR) fmt
22 changes: 17 additions & 5 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
%%-*- mode: erlang -*-
{cover_enabled, true}.

{erl_opts, [debug_info, fail_on_warning,
{parse_transform, lager_transform}]}.
{erl_opts, [
debug_info,
fail_on_warning,
{parse_transform, lager_transform}
]}.

{deps, [
{lager, "3.9.2"},
dns_erlang
]}.
{lager, "3.9.2"},
dns_erlang
]}.

{project_plugins, [
erlfmt
]}.

{erlfmt, [
write,
{print_width, 140}
]}.
29 changes: 16 additions & 13 deletions src/dnstest.app.src
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{application, dnstest,
[{description, "Conformance tests for DNS servers"},
{vsn, git},
{modules, [dnstest,
dnstest_app,
dnstest_harness]},
{registered, [dnstest_harness]},
{mod, { dnstest_app, []}},
{applications, [kernel,
stdlib,
lager]}]}.


{application, dnstest, [
{description, "Conformance tests for DNS servers"},
{vsn, git},
{modules, [
dnstest,
dnstest_app,
dnstest_harness
]},
{registered, [dnstest_harness]},
{mod, {dnstest_app, []}},
{applications, [
kernel,
stdlib,
lager
]}
]}.
38 changes: 19 additions & 19 deletions src/dnstest.erl
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@
-export([start/0, stop/0, run/0, run/1]).

start() ->
application:ensure_all_started(dnstest),
case init:get_plain_arguments() of
[] -> run([]);
Names -> run(Names)
end.
application:ensure_all_started(dnstest),
case init:get_plain_arguments() of
[] -> run([]);
Names -> run(Names)
end.

stop() ->
application:stop(dnstest).
application:stop(dnstest).

run() -> run([]).

run(Name) when is_atom(Name) ->
run([atom_to_list(Name)]);
run([atom_to_list(Name)]);
run([]) ->
dnstest_metrics:start(),
lager:info("Running all tests (#~p)", [dnstest_metrics:run_number()]),
DefinitionsModule = definitions_module(),
gen_server:cast(dnstest_harness, {run, DefinitionsModule:definitions()});
dnstest_metrics:start(),
lager:info("Running all tests (#~p)", [dnstest_metrics:run_number()]),
DefinitionsModule = definitions_module(),
gen_server:cast(dnstest_harness, {run, DefinitionsModule:definitions()});
run(Names) ->
dnstest_metrics:start(),
lager:info("Running targeted tests: ~p (#~p)", [Names, dnstest_metrics:run_number()]),
DefinitionsModule = definitions_module(),
gen_server:cast(dnstest_harness, {run_target, DefinitionsModule:definitions(), Names}).
dnstest_metrics:start(),
lager:info("Running targeted tests: ~p (#~p)", [Names, dnstest_metrics:run_number()]),
DefinitionsModule = definitions_module(),
gen_server:cast(dnstest_harness, {run_target, DefinitionsModule:definitions(), Names}).

definitions_module() ->
case application:get_env(dnstest, definitions) of
{ok, Module} -> Module;
_ -> dnstest_definitions
end.
case application:get_env(dnstest, definitions) of
{ok, Module} -> Module;
_ -> dnstest_definitions
end.
8 changes: 4 additions & 4 deletions src/dnstest_app.erl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
-export([start/2, stop/1]).

start(Type, Args) ->
lager:info("~p:start(~p, ~p)", [?MODULE, Type, Args]),
dnstest_sup:start_link().
lager:info("~p:start(~p, ~p)", [?MODULE, Type, Args]),
dnstest_sup:start_link().

stop(State) ->
lager:info("~p:stop(~p)~n", [?MODULE, State]),
ok.
lager:info("~p:stop(~p)~n", [?MODULE, State]),
ok.
Loading