Raise syntax error on incorrect render identifier type

This commit is contained in:
Julia Boutin
2025-10-30 12:00:44 +01:00
committed by Guilherme Carreiro
parent d4d2237b90
commit 40e45e32ac
3 changed files with 24 additions and 1 deletions
+20
View File
@@ -1511,6 +1511,26 @@ class SnippetTest < Minitest::Test
assert_template_result(expected, template, error_mode: :rigid)
end
def test_render_with_invalid_identifier_type
template = "{% render 123 %}"
exception = assert_raises(SyntaxError) do
Liquid::Template.parse(template, error_mode: :rigid)
end
assert_match("Expected a string or identifier, found 123", exception.message)
end
def test_render_with_no_identifier
template = "{% render %}"
exception = assert_raises(SyntaxError) do
Liquid::Template.parse(template, error_mode: :rigid)
end
assert_match("Expected a string or identifier, found nothing", exception.message)
end
end
class ResourceLimits < SnippetTest