mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Guarded the examples for deprecated "taint"
This commit is contained in:
parent
27ac1c615d
commit
109183c2c0
3 changed files with 32 additions and 22 deletions
|
@ -36,9 +36,11 @@ describe "StringIO#<< when passed [Object]" do
|
|||
end
|
||||
end
|
||||
|
||||
it "does not taint self when the passed argument is tainted" do
|
||||
(@io << "test".taint)
|
||||
@io.tainted?.should be_false
|
||||
ruby_version_is ""..."2.8" do
|
||||
it "does not taint self when the passed argument is tainted" do
|
||||
(@io << "test".taint)
|
||||
@io.tainted?.should be_false
|
||||
end
|
||||
end
|
||||
|
||||
it "updates self's position" do
|
||||
|
|
|
@ -23,13 +23,15 @@ describe "StringIO#reopen when passed [Object, Integer]" do
|
|||
@io.string.should == "reopened, another time"
|
||||
end
|
||||
|
||||
# NOTE: WEIRD!
|
||||
it "does not taint self when the passed Object was tainted" do
|
||||
@io.reopen("reopened".taint, IO::RDONLY)
|
||||
@io.tainted?.should be_false
|
||||
ruby_version_is ""..."2.8" do
|
||||
# NOTE: WEIRD!
|
||||
it "does not taint self when the passed Object was tainted" do
|
||||
@io.reopen("reopened".taint, IO::RDONLY)
|
||||
@io.tainted?.should be_false
|
||||
|
||||
@io.reopen("reopened".taint, IO::WRONLY)
|
||||
@io.tainted?.should be_false
|
||||
@io.reopen("reopened".taint, IO::WRONLY)
|
||||
@io.tainted?.should be_false
|
||||
end
|
||||
end
|
||||
|
||||
it "tries to convert the passed Object to a String using #to_str" do
|
||||
|
@ -90,13 +92,15 @@ describe "StringIO#reopen when passed [Object, Object]" do
|
|||
str.should == ""
|
||||
end
|
||||
|
||||
# NOTE: WEIRD!
|
||||
it "does not taint self when the passed Object was tainted" do
|
||||
@io.reopen("reopened".taint, "r")
|
||||
@io.tainted?.should be_false
|
||||
ruby_version_is ""..."2.8" do
|
||||
# NOTE: WEIRD!
|
||||
it "does not taint self when the passed Object was tainted" do
|
||||
@io.reopen("reopened".taint, "r")
|
||||
@io.tainted?.should be_false
|
||||
|
||||
@io.reopen("reopened".taint, "w")
|
||||
@io.tainted?.should be_false
|
||||
@io.reopen("reopened".taint, "w")
|
||||
@io.tainted?.should be_false
|
||||
end
|
||||
end
|
||||
|
||||
it "tries to convert the passed Object to a String using #to_str" do
|
||||
|
@ -160,10 +164,12 @@ describe "StringIO#reopen when passed [String]" do
|
|||
@io.string.should == "reopened"
|
||||
end
|
||||
|
||||
# NOTE: WEIRD!
|
||||
it "does not taint self when the passed Object was tainted" do
|
||||
@io.reopen("reopened".taint)
|
||||
@io.tainted?.should be_false
|
||||
ruby_version_is ""..."2.8" do
|
||||
# NOTE: WEIRD!
|
||||
it "does not taint self when the passed Object was tainted" do
|
||||
@io.reopen("reopened".taint)
|
||||
@io.tainted?.should be_false
|
||||
end
|
||||
end
|
||||
|
||||
it "resets self's position to 0" do
|
||||
|
|
|
@ -52,9 +52,11 @@ describe :stringio_write_string, shared: true do
|
|||
end
|
||||
end
|
||||
|
||||
it "does not taint self when the passed argument is tainted" do
|
||||
@io.send(@method, "test".taint)
|
||||
@io.tainted?.should be_false
|
||||
ruby_version_is ""..."2.8" do
|
||||
it "does not taint self when the passed argument is tainted" do
|
||||
@io.send(@method, "test".taint)
|
||||
@io.tainted?.should be_false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue