From 96b5325f873808ae8cbfef471e602d6c5bddd115 Mon Sep 17 00:00:00 2001 From: Dylan Thacker-Smith Date: Wed, 26 Oct 2022 09:21:43 -0400 Subject: [PATCH] Remove Usage.increment calls that have been shown to in fact be used (#1645) 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 9592faa1..4c69a8c3 100644 --- a/lib/liquid/forloop_drop.rb +++ b/lib/liquid/forloop_drop.rb @@ -30,10 +30,7 @@ module Liquid # @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 ff8c7fc9..3ad8ac36 100644 --- a/lib/liquid/tags/for.rb +++ b/lib/liquid/tags/for.rb @@ -177,7 +177,6 @@ module Liquid 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 614ebdc1..3855d97b 100644 --- a/test/integration/tags/for_tag_test.rb +++ b/test/integration/tags/for_tag_test.rb @@ -450,30 +450,4 @@ HERE 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