Skip to content

Commit

Permalink
Remove Usage.increment calls that have been shown to in fact be used
Browse files Browse the repository at this point in the history
I think these were added for undocumented features to see if they were
actually used and they were being used.
  • Loading branch information
dylanahsmith committed Oct 25, 2022
1 parent 6ce4ec1 commit cbacc30
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 28 deletions.
1 change: 0 additions & 1 deletion lib/liquid/forloop_drop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def initialize(name, length, parentloop)
attr_reader :parentloop

def name
Usage.increment('forloop_drop_name')
@name
end

Expand Down
1 change: 0 additions & 1 deletion lib/liquid/tags/for.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ def set_attribute(key, expr)
case key
when 'offset'
@from = if expr == 'continue'
Usage.increment('for_offset_continue')
:continue
else
parse_expression(expr)
Expand Down
26 changes: 0 additions & 26 deletions test/integration/tags/for_tag_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -450,30 +450,4 @@ def test_for_cleans_up_registers

assert(context.registers[:for_stack].empty?)
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

def test_instrument_forloop_drop_name
assigns = { 'items' => [1, 2, 3, 4, 5] }

assert_usage_increment('forloop_drop_name', times: 5) do
Template.parse('{% for item in items %}{{forloop.name}}{% endfor %}').render!(assigns)
end

assert_usage_increment('forloop_drop_name', times: 0) do
Template.parse('{% for item in items %}{{forloop.index}}{% endfor %}').render!(assigns)
end

assert_usage_increment('forloop_drop_name', times: 0) do
Template.parse('{% for item in items %}{{item}}{% endfor %}').render!(assigns)
end
end
end

0 comments on commit cbacc30

Please sign in to comment.