diff --git a/Gemfile b/Gemfile index 14537c6..70c4e93 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/test/integration/parsing_quirks_test.rb b/test/integration/parsing_quirks_test.rb index 5851795..30950ab 100644 --- a/test/integration/parsing_quirks_test.rb +++ b/test/integration/parsing_quirks_test.rb @@ -131,4 +131,16 @@ class ParsingQuirksTest < Minitest::Test 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