1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Skip tainted examples for stringio

This commit is contained in:
Hiroshi SHIBATA 2019-10-31 16:50:00 +09:00
parent ebc884461b
commit 473882e01f
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
3 changed files with 22 additions and 14 deletions

View file

@ -29,10 +29,12 @@ describe "StringIO#<< when passed [Object]" do
@io.string.should == "example\000\000\000\000\000\000\000\000just testing" @io.string.should == "example\000\000\000\000\000\000\000\000just testing"
end end
ruby_version_is ""..."2.7"
it "taints self's String when the passed argument is tainted" do it "taints self's String when the passed argument is tainted" do
(@io << "test".taint) (@io << "test".taint)
@io.string.tainted?.should be_true @io.string.tainted?.should be_true
end end
end
it "does not taint self when the passed argument is tainted" do it "does not taint self when the passed argument is tainted" do
(@io << "test".taint) (@io << "test".taint)

View file

@ -202,10 +202,12 @@ describe "StringIO#reopen when passed [Object]" do
end end
# NOTE: WEIRD! # NOTE: WEIRD!
ruby_version_is ""..."2.7"
it "taints self when the passed Object was tainted" do it "taints self when the passed Object was tainted" do
@io.reopen(StringIO.new("reopened").taint) @io.reopen(StringIO.new("reopened").taint)
@io.tainted?.should be_true @io.tainted?.should be_true
end end
end
end end
describe "StringIO#reopen when passed no arguments" do describe "StringIO#reopen when passed no arguments" do
@ -270,12 +272,14 @@ describe "StringIO#reopen" do
str.should == '' str.should == ''
end end
ruby_version_is ""..."2.7"
it "taints self if the provided StringIO argument is tainted" do it "taints self if the provided StringIO argument is tainted" do
new_io = StringIO.new("tainted") new_io = StringIO.new("tainted")
new_io.taint new_io.taint
@io.reopen(new_io) @io.reopen(new_io)
@io.tainted?.should == true @io.tainted?.should == true
end end
end
it "does not truncate the content even when the StringIO argument is in the truncate mode" do it "does not truncate the content even when the StringIO argument is in the truncate mode" do
orig_io = StringIO.new("Original StringIO", IO::RDWR|IO::TRUNC) orig_io = StringIO.new("Original StringIO", IO::RDWR|IO::TRUNC)

View file

@ -45,10 +45,12 @@ describe :stringio_write_string, shared: true do
@io.pos.should eql(4) @io.pos.should eql(4)
end end
ruby_version_is ""..."2.7"
it "taints self's String when the passed argument is tainted" do it "taints self's String when the passed argument is tainted" do
@io.send(@method, "test".taint) @io.send(@method, "test".taint)
@io.string.tainted?.should be_true @io.string.tainted?.should be_true
end end
end
it "does not taint self when the passed argument is tainted" do it "does not taint self when the passed argument is tainted" do
@io.send(@method, "test".taint) @io.send(@method, "test".taint)