Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test invalid floats without integer parts #1343

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ group :test do
gem 'rubocop-performance', require: false

platform :mri, :truffleruby do
gem 'liquid-c', github: 'Shopify/liquid-c', ref: 'master'
gem 'liquid-c', github: 'Shopify/liquid-c', ref: 'pz-fix-invalid-float'
end
end
12 changes: 12 additions & 0 deletions test/integration/parsing_quirks_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,16 @@ def test_lookup_on_var_with_literal_name
def test_contains_in_id
assert_template_result(' YES ', '{% if containsallshipments == true %} YES {% endif %}', 'containsallshipments' => true)
end

def test_invalid_float_with_no_leading_integer
with_error_mode(:lax) do
assert_template_result("", "{{ -.1 }}")
assert_template_result("", "{{ .1 }}")
end

with_error_mode(:strict) do
assert_raises(SyntaxError) { Template.parse("{{ -.1 }}") }
assert_raises(SyntaxError) { Template.parse("{{ .1 }}") }
end
end
end # ParsingQuirksTest