ruby-changes:59787
From: Nobuyoshi <ko1@a...>
Date: Thu, 23 Jan 2020 22:04:41 +0900 (JST)
Subject: [ruby-changes:59787] 109183c2c0 (master): Guarded the examples for deprecated "taint"
https://git.ruby-lang.org/ruby.git/commit/?id=109183c2c0 From 109183c2c0902a0af735b2660737e1724307b264 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 23 Jan 2020 22:03:13 +0900 Subject: Guarded the examples for deprecated "taint" diff --git a/spec/ruby/library/stringio/append_spec.rb b/spec/ruby/library/stringio/append_spec.rb index c46dc59..b35d17e 100644 --- a/spec/ruby/library/stringio/append_spec.rb +++ b/spec/ruby/library/stringio/append_spec.rb @@ -36,9 +36,11 @@ describe "StringIO#<< when passed [Object]" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/stringio/append_spec.rb#L36 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 diff --git a/spec/ruby/library/stringio/reopen_spec.rb b/spec/ruby/library/stringio/reopen_spec.rb index 34e38a6..64fd0a8 100644 --- a/spec/ruby/library/stringio/reopen_spec.rb +++ b/spec/ruby/library/stringio/reopen_spec.rb @@ -23,13 +23,15 @@ describe "StringIO#reopen when passed [Object, Integer]" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/stringio/reopen_spec.rb#L23 @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 - - @io.reopen("reopened".taint, IO::WRONLY) - @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 + 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 https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/stringio/reopen_spec.rb#L92 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 https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/stringio/reopen_spec.rb#L164 @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 diff --git a/spec/ruby/library/stringio/shared/write.rb b/spec/ruby/library/stringio/shared/write.rb index 28683e3..dc5e144 100644 --- a/spec/ruby/library/stringio/shared/write.rb +++ b/spec/ruby/library/stringio/shared/write.rb @@ -52,9 +52,11 @@ describe :stringio_write_string, shared: true do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/stringio/shared/write.rb#L52 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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/