Skip to content

Commit 36c4183

Browse files
committed
More tests
1 parent 1406a1e commit 36c4183

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/elixir/test/elixir/module/types/expr_test.exs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,13 +1052,25 @@ defmodule Module.Types.ExprTest do
10521052
end
10531053

10541054
describe "conditionals" do
1055-
test "if does not report on literal booleans" do
1055+
test "if does not report on literal atoms" do
10561056
assert typecheck!(
10571057
if true do
10581058
:ok
10591059
end
10601060
) == atom([:ok, nil])
10611061
end
1062+
1063+
test "and does not report on literal atoms" do
1064+
assert typecheck!(false and true) == boolean()
1065+
end
1066+
1067+
test "and reports on non-atom literals" do
1068+
assert typeerror!(1 and true) == ~l"""
1069+
the following conditional expression will always evaluate to integer():
1070+
1071+
1
1072+
"""
1073+
end
10621074
end
10631075

10641076
describe "receive" do

0 commit comments

Comments
 (0)