[erl-frontend] Add tests for logic operators

Summary: Add tests for `and`, `or`, `not`.

Reviewed By: rgrig

Differential Revision: D29696455

fbshipit-source-id: 1b25b2b79
master
Akos Hajdu 4 years ago committed by Facebook GitHub Bot
parent be8a2e1cac
commit e3685a8d9d

@ -27,3 +27,8 @@ codetoanalyze/erlang/features/src/comparison.erl, test_less_Bad/0, 3, NO_TRUE_BR
codetoanalyze/erlang/features/src/comparison.erl, test_less_Bad2/0, 3, NO_TRUE_BRANCH_IN_IF, no_bucket, ERROR, [no true branch in if expression here]
codetoanalyze/erlang/features/src/comparison.erl, test_not_equal_Bad/0, 3, NO_TRUE_BRANCH_IN_IF, no_bucket, ERROR, [no true branch in if expression here]
codetoanalyze/erlang/features/src/comparison.erl, test_not_equal_Bad2/0, 3, NO_TRUE_BRANCH_IN_IF, no_bucket, ERROR, [no true branch in if expression here]
codetoanalyze/erlang/features/src/logic.erl, test_and00_Bad/0, 1, NO_TRUE_BRANCH_IN_IF, no_bucket, ERROR, [no true branch in if expression here]
codetoanalyze/erlang/features/src/logic.erl, test_and01_Bad/0, 1, NO_TRUE_BRANCH_IN_IF, no_bucket, ERROR, [no true branch in if expression here]
codetoanalyze/erlang/features/src/logic.erl, test_and10_Bad/0, 1, NO_TRUE_BRANCH_IN_IF, no_bucket, ERROR, [no true branch in if expression here]
codetoanalyze/erlang/features/src/logic.erl, test_or00_Bad/0, 1, NO_TRUE_BRANCH_IN_IF, no_bucket, ERROR, [no true branch in if expression here]
codetoanalyze/erlang/features/src/logic.erl, test_unot_Bad/0, 1, NO_TRUE_BRANCH_IN_IF, no_bucket, ERROR, [no true branch in if expression here]

@ -0,0 +1,73 @@
% Copyright (c) Facebook, Inc. and its affiliates.
%
% This source code is licensed under the MIT license found in the
% LICENSE file in the root directory of this source tree.
-module(logic).
% Workaround until we support true/false atoms
-define(T, (1 == 1)).
-define(F, (1 == 0)).
-export([
test_and00_Bad/0,
test_and01_Bad/0,
test_and10_Bad/0,
test_and11_Ok/0,
test_or00_Bad/0,
test_or01_Ok/0,
test_or10_Ok/0,
test_or11_Ok/0,
test_unot_Ok/0,
test_unot_Bad/0
]).
test_and00_Bad() ->
if
?F and ?F -> ok
end.
test_and01_Bad() ->
if
?F and ?T -> ok
end.
test_and10_Bad() ->
if
?T and ?F -> ok
end.
test_and11_Ok() ->
if
?T and ?T -> ok
end.
test_or00_Bad() ->
if
?F or ?F -> ok
end.
test_or01_Ok() ->
if
?F or ?T -> ok
end.
test_or10_Ok() ->
if
?T or ?F -> ok
end.
test_or11_Ok() ->
if
?T or ?T -> ok
end.
test_unot_Ok() ->
if
not ?F -> ok
end.
test_unot_Bad() ->
if
not ?T -> ok
end.
Loading…
Cancel
Save