Skip to content

Commit 3e2e1a9

Browse files
committed
Merge pull request #1699 from jgonet/jgonet/fix-test-warnings
Fix tests warnings These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
2 parents 1616e62 + dfc92f4 commit 3e2e1a9

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

tests/erlang_tests/test_funs12.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ check_guard(A, B, A) when is_function(B, A) ->
4141
A;
4242
check_guard(A, _B, A) when A < 0 ->
4343
error;
44-
check_guard(_A, _B, _A) ->
44+
check_guard(_, _, _) ->
4545
false.
4646

4747
discard(_X) ->

tests/erlang_tests/unique.erl

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@
2020

2121
-module(unique).
2222

23-
-export([start/0, id/1, check_error/3]).
23+
-export([start/0, id/1]).
2424

2525
start() ->
2626
ok = unique_0(),
2727
ok = unique_positive(),
2828
ok = unique_monotonic(),
2929
ok = unique_positive_monotonic(),
3030
ok = unique_monotonic_processes(),
31+
ok = invalid_args(),
3132

3233
Self = self(),
3334
N = length([
@@ -39,15 +40,19 @@ start() ->
3940
receive_messages(N),
4041
0.
4142

42-
test_invalid() ->
43-
ok = ?MODULE:check_error(fun() -> erlang:unique_integer(?MODULE:id(5)) end),
44-
ok = ?MODULE:check_error(fun() -> erlang:unique_integer(?MODULE:id([positive | monotonic])) end).
43+
invalid_args() ->
44+
ok = raises(badarg, fun() -> erlang:unique_integer(?MODULE:id(5)) end),
45+
ok = raises(badarg, fun() ->
46+
erlang:unique_integer(?MODULE:id([positive | monotonic]))
47+
end),
48+
ok.
4549

46-
check_error(F, A, B) ->
50+
raises(Reason, F) ->
4751
try F() of
4852
Result -> {unexpected, Result}
4953
catch
50-
A:B -> ok
54+
error:Reason -> ok;
55+
E:R -> {unexpected, E, R}
5156
end.
5257

5358
id(X) ->

tests/libs/exavmlib/Tests.ex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ defmodule Tests do
182182

183183
defp test_enum_chunk_while() do
184184
initial_col = 4
185-
lines_list = '-1234567890\nciao\n12345\nabcdefghijkl\n12'
185+
lines_list = ~c"-1234567890\nciao\n12345\nabcdefghijkl\n12"
186186
columns = 5
187187

188188
chunk_fun = fn char, {count, rchars} ->
@@ -198,7 +198,7 @@ defmodule Tests do
198198
{_count, rchars} -> {:cont, Enum.reverse(rchars), []}
199199
end
200200

201-
['-', '12345', '67890', 'ciao', '12345', 'abcde', 'fghij', 'kl', '12'] =
201+
[~c"-", ~c"12345", ~c"67890", ~c"ciao", ~c"12345", ~c"abcde", ~c"fghij", ~c"kl", ~c"12"] =
202202
Enum.chunk_while(lines_list, {initial_col, []}, chunk_fun, after_fun)
203203
end
204204

@@ -291,10 +291,10 @@ defmodule Tests do
291291
"[]" = inspect([])
292292
"[0]" = inspect([0])
293293
"[9, 10]" = inspect([9, 10])
294-
~s'["test"]' = inspect(["test"])
295-
"'hello'" = inspect('hello')
294+
~s(["test"]) = inspect(["test"])
295+
"'hello'" = inspect(~c"hello")
296296
"[127]" = inspect([127])
297-
"[104, 101, 108, 108, 248]" = inspect('hellø')
297+
"[104, 101, 108, 108, 248]" = inspect(~c"hellø")
298298

299299
~s([5 | "hello"]) = inspect([5 | "hello"])
300300

0 commit comments

Comments
 (0)