mirror of
https://github.com/Shopify/liquid.git
synced 2026-10-03 09:05:13 -07:00
Support float in variable range
This commit is contained in:
@@ -29,7 +29,7 @@ module Liquid
|
|||||||
case input
|
case input
|
||||||
when Integer
|
when Integer
|
||||||
input
|
input
|
||||||
when NilClass, String
|
when NilClass, String, Float
|
||||||
input.to_i
|
input.to_i
|
||||||
else
|
else
|
||||||
Utils.to_integer(input)
|
Utils.to_integer(input)
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ HERE
|
|||||||
|
|
||||||
def test_for_with_variable_range
|
def test_for_with_variable_range
|
||||||
assert_template_result(' 1 2 3 ', '{%for item in (1..foobar) %} {{item}} {%endfor%}', "foobar" => 3)
|
assert_template_result(' 1 2 3 ', '{%for item in (1..foobar) %} {{item}} {%endfor%}', "foobar" => 3)
|
||||||
|
assert_template_result(' 1 2 3 ', '{%for item in (x..y) %} {{item}} {%endfor%}', "x" => 1.1, "y" => 3.3)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_for_with_hash_value_range
|
def test_for_with_hash_value_range
|
||||||
|
|||||||
Reference in New Issue
Block a user