Upgrade 5.3.0

Signed-off-by: cherry530 <xuping33@huawei.com>
This commit is contained in:
cherry530 2022-06-30 18:02:42 +08:00
parent bd2a292c0a
commit 5327ddb236
8 changed files with 40 additions and 156 deletions

View File

@ -1,60 +0,0 @@
From cc54e7dff9aa2a20be632f450db8ae3c31046edf Mon Sep 17 00:00:00 2001
From: Fabio Valentini <decathorpe@gmail.com>
Date: Sat, 9 Mar 2019 20:38:31 +0100
Subject: [PATCH 1/2] test/unit/context: disable stack profiler
---
test/unit/context_unit_test.rb | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/test/unit/context_unit_test.rb b/test/unit/context_unit_test.rb
index fab19b8..1d59a31 100644
--- a/test/unit/context_unit_test.rb
+++ b/test/unit/context_unit_test.rb
@@ -446,11 +446,11 @@ class ContextUnitTest < Minitest::Test
assert_equal @context, @context['category'].context
end
- def test_interrupt_avoids_object_allocations
- assert_no_object_allocations do
- @context.interrupt?
- end
- end
+ # def test_interrupt_avoids_object_allocations
+ # assert_no_object_allocations do
+ # @context.interrupt?
+ # end
+ # end
def test_context_initialization_with_a_proc_in_environment
contx = Context.new([test: ->(c) { c['poutine'] }], { test: :foo })
@@ -475,15 +475,15 @@ class ContextUnitTest < Minitest::Test
private
- def assert_no_object_allocations
- unless RUBY_ENGINE == 'ruby'
- skip "stackprof needed to count object allocations"
- end
- require 'stackprof'
-
- profile = StackProf.run(mode: :object) do
- yield
- end
- assert_equal 0, profile[:samples]
- end
+# def assert_no_object_allocations
+# unless RUBY_ENGINE == 'ruby'
+# skip "stackprof needed to count object allocations"
+# end
+# require 'stackprof'
+
+# profile = StackProf.run(mode: :object) do
+# yield
+# end
+# assert_equal 0, profile[:samples]
+# end
end # ContextTest
--
2.20.1

View File

@ -1,25 +0,0 @@
From d991316f9ded539c9b6f0f1a8bfb95db197567ac Mon Sep 17 00:00:00 2001
From: Fabio Valentini <decathorpe@gmail.com>
Date: Sat, 9 Mar 2019 20:38:45 +0100
Subject: [PATCH 2/2] test/helper: remove shebang and executable bit
---
test/test_helper.rb | 2 --
1 file changed, 2 deletions(-)
mode change 100755 => 100644 test/test_helper.rb
diff --git a/test/test_helper.rb b/test/test_helper.rb
old mode 100755
new mode 100644
index ac5ab53..18e464a
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -1,5 +1,3 @@
-#!/usr/bin/env ruby
-
ENV["MT_NO_EXPECTATIONS"] = "1"
require 'minitest/autorun'
--
2.20.1

View File

@ -1,40 +0,0 @@
From 48ed7aa9c516aa9ddef53fed0ffcd6705f814a23 Mon Sep 17 00:00:00 2001
From: Fabio Valentini <decathorpe@gmail.com>
Date: Fri, 31 Jan 2020 17:29:49 +0100
Subject: [PATCH 2/2] tests/integration/drop_test: disable tests broken with
ruby 2.7
---
test/integration/drop_test.rb | 36 +++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/test/integration/drop_test.rb b/test/integration/drop_test.rb
index 2de4a5a..a1abca0 100644
--- a/test/integration/drop_test.rb
+++ b/test/integration/drop_test.rb
@@ -112,25 +112,6 @@ class DropsTest < Minitest::Test
assert_equal ' ', tpl.render!('product' => ProductDrop.new)
end
- def test_rendering_raises_on_tainted_attr
- with_taint_mode(:error) do
- tpl = Liquid::Template.parse('{{ product.user_input }}')
- assert_raises TaintedError do
- tpl.render!('product' => ProductDrop.new)
- end
- end
- end
-
- def test_rendering_warns_on_tainted_attr
- with_taint_mode(:warn) do
- tpl = Liquid::Template.parse('{{ product.user_input }}')
- context = Context.new('product' => ProductDrop.new)
- tpl.render!(context)
- assert_equal [Liquid::TaintedError], context.warnings.map(&:class)
- assert_equal "variable 'product.user_input' is tainted and was not escaped", context.warnings.first.to_s(false)
- end
- end
-
def test_rendering_doesnt_raise_on_escaped_tainted_attr
with_taint_mode(:error) do
tpl = Liquid::Template.parse('{{ product.user_input | escape }}')

View File

@ -1,22 +0,0 @@
From 81149344a5ba53b30e8ab7d77d605dc484a0a3ff Mon Sep 17 00:00:00 2001
From: Dylan Thacker-Smith <Dylan.Smith@shopify.com>
Date: Tue, 31 Mar 2020 10:19:25 -0400
Subject: [PATCH] Fix ParseTreeVisitorTest for ruby-head
---
test/integration/parse_tree_visitor_test.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/integration/parse_tree_visitor_test.rb b/test/integration/parse_tree_visitor_test.rb
index 6ad6a2d..933dbc3 100644
--- a/test/integration/parse_tree_visitor_test.rb
+++ b/test/integration/parse_tree_visitor_test.rb
@@ -238,7 +238,7 @@ class ParseTreeVisitorTest < Minitest::Test
def traversal(template)
ParseTreeVisitor
.for(Template.parse(template).root)
- .add_callback_for(VariableLookup, &:name)
+ .add_callback_for(VariableLookup) { |node| node.name } # rubocop:disable Style/SymbolProc
end
def visit(template)

View File

@ -0,0 +1,34 @@
diff --git a/test/integration/context_test.rb b/test/integration/context_test.rb
index 58f1c33..b8dcc5f 100644
--- a/test/integration/context_test.rb
+++ b/test/integration/context_test.rb
@@ -458,13 +458,6 @@ class ContextTest < Minitest::Test
assert_equal(@context, @context['category'].context)
end
- def test_interrupt_avoids_object_allocations
- @context.interrupt? # ruby 3.0.0 allocates on the first call
- assert_no_object_allocations do
- @context.interrupt?
- end
- end
-
def test_context_initialization_with_a_proc_in_environment
contx = Context.new([test: ->(c) { c['poutine'] }], test: :foo)
@@ -620,15 +613,4 @@ class ContextTest < Minitest::Test
private
- def assert_no_object_allocations
- unless RUBY_ENGINE == 'ruby'
- skip("stackprof needed to count object allocations")
- end
- require 'stackprof'
-
- profile = StackProf.run(mode: :object) do
- yield
- end
- assert_equal(0, profile[:samples])
- end
end # ContextTest

Binary file not shown.

BIN
liquid-5.3.0.gem Normal file

Binary file not shown.

View File

@ -1,15 +1,12 @@
%global gem_name liquid
Name: rubygem-%{gem_name}
Summary: Secure, non-evaling end user template engine
Version: 4.0.3
Release: 2
Version: 5.3.0
Release: 1
License: MIT
URL: http://www.liquidmarkup.org
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
Patch1: 01-test-unit-context-disable-stack-profiler.patch
Patch2: 02-test-helper-remove-shebang-and-executable-bit.patch
Patch3: 03-tests-integration-drop_test-disable-tests-broken-wit.patch
Patch4: 04-fix-parse-tree-visitor-test-for-ruby-head.patch
Patch1: fix-check-error-to-ignore-import-stackprof.patch
BuildArch: noarch
BuildRequires: ruby(release) ruby >= 2.1.0 rubygems-devel >= 1.3.7
BuildRequires: rubygem(bigdecimal) rubygem(minitest)
@ -35,9 +32,6 @@ Documentation for %{name}.
%prep
%setup -q -n %{gem_name}-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
gem build ../%{gem_name}-%{version}.gemspec
@ -66,6 +60,9 @@ popd
%{gem_instdir}/test
%changelog
* Thu Jun 30 2022 xu_ping <xuping33@h-partners.com> - 5.3.0-1
- Upgrade 5.3.0
* Thu Feb 10 2022 xu_ping <xuping33@huawei.com> - 4.0.3-2
- Fix ParseTreeVisitor error and DropsTest failure