Skip to content

Commit

Permalink
dialyzer: remove license from expected result
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
kikofernandez committed Jan 14, 2025
1 parent 5674bfc commit 7bf07d3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/dialyzer/test/file_utils.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions lib/dialyzer/test/small_SUITE_data/results/abs
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
3 changes: 3 additions & 0 deletions lib/dialyzer/test/small_SUITE_data/src/abs.erl
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,6 @@ int() ->

float() ->
math:sqrt(1.0).

%% SPDX-License-Identifier: Apache-2.0
%% SPDX-FileCopyrightText: 2024 Erlang/OTP and its contributors

0 comments on commit 7bf07d3

Please sign in to comment.