Add shallow validation when unquoting AST (#13950)

This commit is contained in:
Jean Klingler
2024-11-03 17:20:33 +09:00
committed by GitHub
parent 9162de7c52
commit cc68ad91cb
7 changed files with 81 additions and 14 deletions
@@ -405,12 +405,16 @@ defmodule Code.Normalizer.QuotedASTTest do
end
test "range" do
assert quoted_to_string(quote(do: unquote(-1..+2))) == "-1..2"
assert quoted_to_string(quote(do: -1..+2)) == "-1..+2"
assert quoted_to_string(quote(do: Foo.integer()..3)) == "Foo.integer()..3"
assert quoted_to_string(quote(do: unquote(-1..+2//-3))) == "-1..2//-3"
assert quoted_to_string(quote(do: -1..+2//-3)) == "-1..+2//-3"
assert quoted_to_string(quote(do: Foo.integer()..3//Bar.bat())) ==
"Foo.integer()..3//Bar.bat()"
# invalid AST
assert quoted_to_string(-1..+2) == "-1..2"
assert quoted_to_string(-1..+2//-3) == "-1..2//-3"
end
test "when" do