File 6631-common_test-empty-heading-resulting-with-no-heading.patch of Package erlang

From 09ea2f4385b6bad64da3a201c3ff71e7c112204d Mon Sep 17 00:00:00 2001
From: Jakub Witczak <kuba@erlang.org>
Date: Fri, 18 Jul 2025 10:32:18 +0200
Subject: [PATCH] common_test: empty heading resulting with no heading

- allow user to actually specify no heading in print output
---
 lib/common_test/src/ct_logs.erl | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/common_test/src/ct_logs.erl b/lib/common_test/src/ct_logs.erl
index 063259a2b4..68fb945064 100644
--- a/lib/common_test/src/ct_logs.erl
+++ b/lib/common_test/src/ct_logs.erl
@@ -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"]
+                end,
+            Str = lists:flatten(Parts),
             try
                 io:format(?def_gl, Str, Args)
             catch
-- 
2.43.0

openSUSE Build Service is sponsored by