Skip to content

common_test: empty heading resulting with no heading #10051

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

Open
wants to merge 1 commit into
base: maint
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion lib/common_test/src/ct_logs.erl
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,12 @@ tc_print(Category,Importance,Format,Args,Opts) ->
undefined -> atom_to_list(Category);
Hd -> Hd
end,
Str = lists:flatten([get_header(Heading),Format,"\n\n"]),
Parts =
case Heading of
"" -> [Format, "\n"];
_ -> [get_header(Heading),Format,"\n\n"]
Comment on lines +553 to +554
Copy link
Preview

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

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

The hardcoded line break pattern creates inconsistency. Consider defining constants or using a more systematic approach to handle line break variations, as this logic may need to be maintained consistently across similar formatting functions.

Suggested change
"" -> [Format, "\n"];
_ -> [get_header(Heading),Format,"\n\n"]
"" -> [Format, ?LINE_BREAK];
_ -> [get_header(Heading),Format,?LINE_BREAK, ?LINE_BREAK]

Copilot uses AI. Check for mistakes.

end,
Str = lists:flatten(Parts),
try
io:format(?def_gl, Str, Args)
catch
Expand Down
Loading