From 331f6ecb79aed51e9628e6d12e86390ef000b49d Mon Sep 17 00:00:00 2001 From: Dylan Thacker-Smith Date: Tue, 25 Oct 2022 17:34:00 -0400 Subject: [PATCH] Remove Usage.increment calls that have been shown to in fact be used I think these were added for undocumented features to see if they were actually used and they were being used. --- lib/liquid/forloop_drop.rb | 5 +---- lib/liquid/tags/for.rb | 1 - test/integration/tags/for_tag_test.rb | 26 -------------------------- 3 files changed, 1 insertion(+), 31 deletions(-) diff --git a/lib/liquid/forloop_drop.rb b/lib/liquid/forloop_drop.rb index 9592faa14..4c69a8c38 100644 --- a/lib/liquid/forloop_drop.rb +++ b/lib/liquid/forloop_drop.rb @@ -30,10 +30,7 @@ def initialize(name, length, parentloop) # @liquid_return [forloop] attr_reader :parentloop - def name - Usage.increment('forloop_drop_name') - @name - end + attr_reader :name # @liquid_public_docs # @liquid_summary diff --git a/lib/liquid/tags/for.rb b/lib/liquid/tags/for.rb index ff8c7fc94..3ad8ac36d 100644 --- a/lib/liquid/tags/for.rb +++ b/lib/liquid/tags/for.rb @@ -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) diff --git a/test/integration/tags/for_tag_test.rb b/test/integration/tags/for_tag_test.rb index 614ebdc19..3855d97b9 100644 --- a/test/integration/tags/for_tag_test.rb +++ b/test/integration/tags/for_tag_test.rb @@ -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