Skip to content

Commit

Permalink
[erlang] Simplify guard tests
Browse files Browse the repository at this point in the history
Summary: Tests were matching variable against variable but that's irrelevant for testing the functionality of guards. It's simpler to match constant against constant because that doesn't depend on equality model.

Reviewed By: rgrig

Differential Revision: D62235162

fbshipit-source-id: cc45016fa1c7a361b80be3380af221cd17554bf5
  • Loading branch information
hajduakos authored and facebook-github-bot committed Sep 6, 2024
1 parent cb602a7 commit cde94d1
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
]).

accepts_positive(X) ->
case X of
X when X > 0 -> ok
case 1 of
1 when X > 0 -> ok
end.

accepts_positive2(X) ->
case X of
X when 1 =:= 1, 1 =:= 0; X > 0 -> ok
case 1 of
1 when 1 =:= 1, 1 =:= 0; X > 0 -> ok
end.

accepts_all(X) ->
case X of
X when X > 0 -> ok;
X when not (X > 0) -> ok
case 1 of
1 when X > 0 -> ok;
1 when not (X > 0) -> ok
end.

test_accepts_positive_Bad() ->
Expand Down

0 comments on commit cde94d1

Please sign in to comment.