Skip to content

Run code formatter on lib/ex_unit/lib/ex_unit/formatter.ex #6863

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

Merged
merged 1 commit into from
Oct 11, 2017

Conversation

jknipp
Copy link
Contributor

@jknipp jknipp commented Oct 11, 2017

No description provided.

Enum.map_join(Enum.with_index(failures), "", fn {{kind, reason, stack}, index} ->
{text, stack} = format_kind_reason(test_module, kind, reason, stack, width, formatter)
failure_header(failures, index) <> text <> format_stacktrace(stack, name, nil, formatter)
end)
end

defp format_kind_reason(test, :error, %ExUnit.AssertionError{} = struct, stack, width, formatter) do
defp format_kind_reason(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks out of place to have a multi-line function head, with a single line function. Suggestions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case it's fine since there's no straightforward way to avoid it (we'd have to maybe make the arguments into a map or something like this but let's keep that for after the formatting craze is over).


"Finished in #{format_us(total_us)} seconds (#{format_us(load_us)}s on load, #{
format_us(run_us)
}s on tests)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please split this message into more than one string and concatenate through <> so that we don't get the ugly split in #{. This is described in example 4 (which I just added) of #6643.

Enum.map_join(Enum.with_index(failures), "", fn {{kind, reason, stack}, index} ->
{text, stack} = format_kind_reason(test_module, kind, reason, stack, width, formatter)
failure_header(failures, index) <> text <> format_stacktrace(stack, name, nil, formatter)
end)
end

defp format_kind_reason(test, :error, %ExUnit.AssertionError{} = struct, stack, width, formatter) do
defp format_kind_reason(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case it's fine since there's no straightforward way to avoid it (we'd have to maybe make the arguments into a map or something like this but let's keep that for after the formatting craze is over).

@josevalim josevalim merged commit 0a3786a into elixir-lang:master Oct 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants