Skip to content

Commit dfc92f4

Browse files
committed
Fix unique_integer tests
Signed-off-by: Jakub Gonet <jakub.gonet@swmansion.com>
1 parent bccf121 commit dfc92f4

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
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) ->

0 commit comments

Comments
 (0)