Fix ParseTreeVisitor error and DropsTest failure
Signed-off-by: cherry530 <xuping33@huawei.com> (cherry picked from commit aaab371e6ae29ed833e416b785584031edf833f0)
This commit is contained in:
parent
d2d5160e99
commit
92d9a238d7
@ -0,0 +1,40 @@
|
|||||||
|
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 }}')
|
||||||
22
04-fix-parse-tree-visitor-test-for-ruby-head.patch
Normal file
22
04-fix-parse-tree-visitor-test-for-ruby-head.patch
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
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)
|
||||||
@ -2,12 +2,14 @@
|
|||||||
Name: rubygem-%{gem_name}
|
Name: rubygem-%{gem_name}
|
||||||
Summary: Secure, non-evaling end user template engine
|
Summary: Secure, non-evaling end user template engine
|
||||||
Version: 4.0.3
|
Version: 4.0.3
|
||||||
Release: 1
|
Release: 2
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: http://www.liquidmarkup.org
|
URL: http://www.liquidmarkup.org
|
||||||
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
|
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
|
||||||
Patch1: 01-test-unit-context-disable-stack-profiler.patch
|
Patch1: 01-test-unit-context-disable-stack-profiler.patch
|
||||||
Patch2: 02-test-helper-remove-shebang-and-executable-bit.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
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
BuildRequires: ruby(release) ruby >= 2.1.0 rubygems-devel >= 1.3.7
|
BuildRequires: ruby(release) ruby >= 2.1.0 rubygems-devel >= 1.3.7
|
||||||
BuildRequires: rubygem(bigdecimal) rubygem(minitest)
|
BuildRequires: rubygem(bigdecimal) rubygem(minitest)
|
||||||
@ -34,6 +36,8 @@ Documentation for %{name}.
|
|||||||
%setup -q -n %{gem_name}-%{version}
|
%setup -q -n %{gem_name}-%{version}
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
|
%patch3 -p1
|
||||||
|
%patch4 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
gem build ../%{gem_name}-%{version}.gemspec
|
gem build ../%{gem_name}-%{version}.gemspec
|
||||||
@ -62,5 +66,8 @@ popd
|
|||||||
%{gem_instdir}/test
|
%{gem_instdir}/test
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Feb 10 2022 xu_ping <xuping33@huawei.com> - 4.0.3-2
|
||||||
|
- Fix ParseTreeVisitor error and DropsTest failure
|
||||||
|
|
||||||
* Thu Jul 30 2020 wutao <wutao61@huawei.com> - 4.0.3-1
|
* Thu Jul 30 2020 wutao <wutao61@huawei.com> - 4.0.3-1
|
||||||
- package init
|
- package init
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user