fix quirky negative sign expression markup parsing

This commit is contained in:
Michael Go
2025-01-07 14:32:07 -04:00
parent 1de6025362
commit 0b1dc295ff
3 changed files with 16 additions and 3 deletions
+13 -1
View File
@@ -23,7 +23,7 @@ class ExpressionTest < Minitest::Test
end
def test_float
assert_template_result("-17.42", "{{ -17.42 }}")
assert_template_result("-17.42", "{{ -17.42 }}")
assert_template_result("2.5", "{{ 2.5 }}")
assert_expression_result(1.5, "1.5")
end
@@ -42,6 +42,18 @@ class ExpressionTest < Minitest::Test
)
end
def test_quirky_negative_sign_expression_markup
result = Expression.parse("-")
assert(result.is_a?(VariableLookup))
assert_equal("-", result.name)
# for this template, the expression markup is "-"
assert_template_result(
"",
"{{ - 'theme.css' - }}",
)
end
private
def assert_expression_result(expect, markup, **assigns)