mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-19 10:52:48 -07:00
Merge pull request #1354 from Shopify/pz-instrument-for-offset-continue
Instrument usage of offset:continue in for loops
This commit is contained in:
@@ -198,6 +198,7 @@ module Liquid
|
|||||||
case key
|
case key
|
||||||
when 'offset'
|
when 'offset'
|
||||||
@from = if expr == 'continue'
|
@from = if expr == 'continue'
|
||||||
|
Usage.increment('for_offset_continue')
|
||||||
:continue
|
:continue
|
||||||
else
|
else
|
||||||
parse_expression(expr)
|
parse_expression(expr)
|
||||||
|
|||||||
@@ -437,4 +437,14 @@ HERE
|
|||||||
|
|
||||||
assert(context.registers[:for_stack].empty?)
|
assert(context.registers[:for_stack].empty?)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_instrument_for_offset_continue
|
||||||
|
assert_usage_increment('for_offset_continue') do
|
||||||
|
Template.parse('{% for item in items offset:continue %}{{item}}{% endfor %}')
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_usage_increment('for_offset_continue', times: 0) do
|
||||||
|
Template.parse('{% for item in items offset:2 %}{{item}}{% endfor %}')
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user