[前][次][番号順一覧][スレッド一覧]

ruby-changes:58523

From: Hiroshi <ko1@a...>
Date: Thu, 31 Oct 2019 16:50:17 +0900 (JST)
Subject: [ruby-changes:58523] 473882e01f (master): Skip tainted examples for stringio

https://git.ruby-lang.org/ruby.git/commit/?id=473882e01f

From 473882e01f7e55753733e2607ace633b5041f11f Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@r...>
Date: Thu, 31 Oct 2019 16:50:00 +0900
Subject: Skip tainted examples for stringio


diff --git a/spec/ruby/library/stringio/append_spec.rb b/spec/ruby/library/stringio/append_spec.rb
index a8bc6aa..034ca96 100644
--- a/spec/ruby/library/stringio/append_spec.rb
+++ b/spec/ruby/library/stringio/append_spec.rb
@@ -29,9 +29,11 @@ describe "StringIO#<< when passed [Object]" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/stringio/append_spec.rb#L29
     @io.string.should == "example\000\000\000\000\000\000\000\000just testing"
   end
 
-  it "taints self's String when the passed argument is tainted" do
-    (@io << "test".taint)
-    @io.string.tainted?.should be_true
+  ruby_version_is ""..."2.7"
+    it "taints self's String when the passed argument is tainted" do
+      (@io << "test".taint)
+      @io.string.tainted?.should be_true
+    end
   end
 
   it "does not taint self when the passed argument is tainted" do
diff --git a/spec/ruby/library/stringio/reopen_spec.rb b/spec/ruby/library/stringio/reopen_spec.rb
index 6b5bdb5..32bf13d 100644
--- a/spec/ruby/library/stringio/reopen_spec.rb
+++ b/spec/ruby/library/stringio/reopen_spec.rb
@@ -202,9 +202,11 @@ describe "StringIO#reopen when passed [Object]" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/stringio/reopen_spec.rb#L202
   end
 
   # NOTE: WEIRD!
-  it "taints self when the passed Object was tainted" do
-    @io.reopen(StringIO.new("reopened").taint)
-    @io.tainted?.should be_true
+  ruby_version_is ""..."2.7"
+    it "taints self when the passed Object was tainted" do
+      @io.reopen(StringIO.new("reopened").taint)
+      @io.tainted?.should be_true
+    end
   end
 end
 
@@ -270,11 +272,13 @@ describe "StringIO#reopen" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/stringio/reopen_spec.rb#L272
     str.should == ''
   end
 
-  it "taints self if the provided StringIO argument is tainted" do
-    new_io = StringIO.new("tainted")
-    new_io.taint
-    @io.reopen(new_io)
-    @io.tainted?.should == true
+  ruby_version_is ""..."2.7"
+    it "taints self if the provided StringIO argument is tainted" do
+      new_io = StringIO.new("tainted")
+      new_io.taint
+      @io.reopen(new_io)
+      @io.tainted?.should == true
+    end
   end
 
   it "does not truncate the content even when the StringIO argument is in the truncate mode" do
diff --git a/spec/ruby/library/stringio/shared/write.rb b/spec/ruby/library/stringio/shared/write.rb
index df4822c..12c58d1 100644
--- a/spec/ruby/library/stringio/shared/write.rb
+++ b/spec/ruby/library/stringio/shared/write.rb
@@ -45,9 +45,11 @@ describe :stringio_write_string, shared: true do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/stringio/shared/write.rb#L45
     @io.pos.should eql(4)
   end
 
-  it "taints self's String when the passed argument is tainted" do
-    @io.send(@method, "test".taint)
-    @io.string.tainted?.should be_true
+  ruby_version_is ""..."2.7"
+    it "taints self's String when the passed argument is tainted" do
+      @io.send(@method, "test".taint)
+      @io.string.tainted?.should be_true
+    end
   end
 
   it "does not taint self when the passed argument is tainted" do
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]