Skip to content

Commit 43c1818

Browse files
eksperimentalwhatyouhide
authored andcommitted
Correct a bunch of adjectives in the ExUnit code (#4905)
1 parent 508e1a4 commit 43c1818

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

lib/ex_unit/lib/ex_unit/cli_formatter.ex

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ defmodule ExUnit.CLIFormatter do
1515
trace: opts[:trace],
1616
colors: Keyword.put_new(opts[:colors], :enabled, IO.ANSI.enabled?),
1717
width: get_terminal_width(),
18-
tests_counter: %{},
19-
failures_counter: 0,
18+
test_counter: %{},
19+
failure_counter: 0,
2020
skipped_counter: 0,
21-
invalids_counter: 0
21+
invalid_counter: 0
2222
}
2323
{:ok, config}
2424
end
@@ -43,12 +43,12 @@ defmodule ExUnit.CLIFormatter do
4343
else
4444
IO.write success(".", config)
4545
end
46-
{:ok, %{config | tests_counter: update_tests_counter(config.tests_counter, test)}}
46+
{:ok, %{config | test_counter: update_test_counter(config.test_counter, test)}}
4747
end
4848

4949
def handle_event({:test_finished, %ExUnit.Test{state: {:skip, _}} = test}, config) do
5050
if config.trace, do: IO.puts trace_test_skip(test)
51-
{:ok, %{config | tests_counter: update_tests_counter(config.tests_counter, test),
51+
{:ok, %{config | test_counter: update_test_counter(config.test_counter, test),
5252
skipped_counter: config.skipped_counter + 1}}
5353
end
5454

@@ -59,22 +59,22 @@ defmodule ExUnit.CLIFormatter do
5959
IO.write invalid("?", config)
6060
end
6161

62-
{:ok, %{config | tests_counter: update_tests_counter(config.tests_counter, test),
63-
invalids_counter: config.invalids_counter + 1}}
62+
{:ok, %{config | test_counter: update_test_counter(config.test_counter, test),
63+
invalid_counter: config.invalid_counter + 1}}
6464
end
6565

6666
def handle_event({:test_finished, %ExUnit.Test{state: {:failed, failures}} = test}, config) do
6767
if config.trace do
6868
IO.puts failure(trace_test_result(test), config)
6969
end
7070

71-
formatted = format_test_failure(test, failures, config.failures_counter + 1,
71+
formatted = format_test_failure(test, failures, config.failure_counter + 1,
7272
config.width, &formatter(&1, &2, config))
7373
print_failure(formatted, config)
7474
print_logs(test.logs)
7575

76-
{:ok, %{config | tests_counter: update_tests_counter(config.tests_counter, test),
77-
failures_counter: config.failures_counter + 1}}
76+
{:ok, %{config | test_counter: update_test_counter(config.test_counter, test),
77+
failure_counter: config.failure_counter + 1}}
7878
end
7979

8080
def handle_event({:case_started, %ExUnit.TestCase{name: name}}, config) do
@@ -90,10 +90,10 @@ defmodule ExUnit.CLIFormatter do
9090
end
9191

9292
def handle_event({:case_finished, %ExUnit.TestCase{state: {:failed, failures}} = test_case}, config) do
93-
formatted = format_test_case_failure(test_case, failures, config.failures_counter + 1,
93+
formatted = format_test_case_failure(test_case, failures, config.failure_counter + 1,
9494
config.width, &formatter(&1, &2, config))
9595
print_failure(formatted, config)
96-
{:ok, %{config | failures_counter: config.failures_counter + 1}}
96+
{:ok, %{config | failure_counter: config.failure_counter + 1}}
9797
end
9898

9999
## Tracing
@@ -120,8 +120,8 @@ defmodule ExUnit.CLIFormatter do
120120
end
121121
end
122122

123-
defp update_tests_counter(tests_counter, %{tags: %{type: type}}) do
124-
Map.update(tests_counter, type, 1, &(&1 + 1))
123+
defp update_test_counter(test_counter, %{tags: %{type: type}}) do
124+
Map.update(test_counter, type, 1, &(&1 + 1))
125125
end
126126

127127
## Printing
@@ -132,16 +132,16 @@ defmodule ExUnit.CLIFormatter do
132132

133133
# singular/plural
134134
test_type_counts = format_test_type_counts(config)
135-
failure_pl = pluralize(config.failures_counter, "failure", "failures")
135+
failure_pl = pluralize(config.failure_counter, "failure", "failures")
136136

137137
message =
138-
"#{test_type_counts}#{config.failures_counter} #{failure_pl}"
138+
"#{test_type_counts}#{config.failure_counter} #{failure_pl}"
139139
|> if_true(config.skipped_counter > 0, & &1 <> ", #{config.skipped_counter} skipped")
140-
|> if_true(config.invalids_counter > 0, & &1 <> ", #{config.invalids_counter} invalid")
140+
|> if_true(config.invalid_counter > 0, & &1 <> ", #{config.invalid_counter} invalid")
141141

142142
cond do
143-
config.failures_counter > 0 -> IO.puts failure(message, config)
144-
config.invalids_counter > 0 -> IO.puts invalid(message, config)
143+
config.failure_counter > 0 -> IO.puts failure(message, config)
144+
config.invalid_counter > 0 -> IO.puts invalid(message, config)
145145
true -> IO.puts success(message, config)
146146
end
147147

@@ -170,8 +170,8 @@ defmodule ExUnit.CLIFormatter do
170170
IO.puts formatted
171171
end
172172

173-
defp format_test_type_counts(%{tests_counter: tests_counter} = _config) do
174-
Enum.map tests_counter, fn {type, count} ->
173+
defp format_test_type_counts(%{test_counter: test_counter} = _config) do
174+
Enum.map test_counter, fn {type, count} ->
175175
type_pluralized = pluralize(count, type, ExUnit.plural_rule(type |> to_string()))
176176
"#{count} #{type_pluralized}, "
177177
end

0 commit comments

Comments
 (0)