File 1177-dialyzer-remove-license-from-expected-result.patch of Package erlang

From 7bf07d34e9eb30cb8fd7267c92e1152ccc1aa112 Mon Sep 17 00:00:00 2001
From: Kiko Fernandez-Reyes <kiko@erlang.org>
Date: Tue, 14 Jan 2025 11:03:53 +0100
Subject: [PATCH] dialyzer: remove license from expected result

Removes the license comment in expected results to not be considered
part of the expected output. In case of tests programs, one must either
add the license at the end or increment the line number of the results
by 2 (one line the copyright, and one line the license)
---
 lib/dialyzer/test/file_utils.erl               | 10 +++++++++-
 lib/dialyzer/test/small_SUITE_data/results/abs |  2 ++
 lib/dialyzer/test/small_SUITE_data/src/abs.erl |  3 +++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/lib/dialyzer/test/file_utils.erl b/lib/dialyzer/test/file_utils.erl
index e1314ec8de..154653d43f 100644
--- a/lib/dialyzer/test/file_utils.erl
+++ b/lib/dialyzer/test/file_utils.erl
@@ -151,5 +151,13 @@ file_to_lines(File, Acc) ->
     case io:get_line(File, "") of
 	{error, _}=Error -> Error;
 	eof              -> Acc;
-	A                -> file_to_lines(File, [A|Acc])
+	A                ->
+            case A of
+                "%% SPDX-License-Identifier:"++_ ->
+                    file_to_lines(File, Acc);
+                "%% SPDX-FileCopyrightText:"++_ ->
+                    file_to_lines(File, Acc);
+                _ ->
+                    file_to_lines(File, [A|Acc])
+            end
     end.
diff --git a/lib/dialyzer/test/small_SUITE_data/results/abs b/lib/dialyzer/test/small_SUITE_data/results/abs
index a4ca39fe61..887c4398ff 100644
--- a/lib/dialyzer/test/small_SUITE_data/results/abs
+++ b/lib/dialyzer/test/small_SUITE_data/results/abs
@@ -1,3 +1,5 @@
+%% SPDX-License-Identifier: Apache-2.0
+%% SPDX-FileCopyrightText: 2024 Erlang/OTP and its contributors
 
 abs.erl:12:1: Function i1/0 has no local return
 abs.erl:16:5: The pattern 'true' can never match the type 'false'
diff --git a/lib/dialyzer/test/small_SUITE_data/src/abs.erl b/lib/dialyzer/test/small_SUITE_data/src/abs.erl
index 0e38c3dbb7..c9f36b20f1 100644
--- a/lib/dialyzer/test/small_SUITE_data/src/abs.erl
+++ b/lib/dialyzer/test/small_SUITE_data/src/abs.erl
@@ -76,3 +76,6 @@ int() ->
 
 float() ->
     math:sqrt(1.0).
+
+%% SPDX-License-Identifier: Apache-2.0
+%% SPDX-FileCopyrightText: 2024 Erlang/OTP and its contributors
-- 
2.43.0

openSUSE Build Service is sponsored by