diff options
author | Jeremy Evans <code@jeremyevans.net> | 2019-09-24 20:59:12 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2019-11-18 01:00:25 +0200 |
commit | ffd0820ab317542f8780aac475da590a4bdbc7a8 (patch) | |
tree | 6a5d774933c15fd2b9ea948bd3ae2fa587faaf82 /spec/ruby/core/string/chomp_spec.rb | |
parent | c5c05460ac20abcbc0ed686eb4acf06da7a39a79 (diff) |
Deprecate taint/trust and related methods, and make the methods no-ops
This removes the related tests, and puts the related specs behind
version guards. This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2476
Diffstat (limited to 'spec/ruby/core/string/chomp_spec.rb')
-rw-r--r-- | spec/ruby/core/string/chomp_spec.rb | 66 |
1 files changed, 42 insertions, 24 deletions
diff --git a/spec/ruby/core/string/chomp_spec.rb b/spec/ruby/core/string/chomp_spec.rb index 9db47d1dc6..20a0925959 100644 --- a/spec/ruby/core/string/chomp_spec.rb +++ b/spec/ruby/core/string/chomp_spec.rb @@ -38,8 +38,10 @@ describe "String#chomp" do "".chomp.should == "" end - it "taints the result if self is tainted" do - "abc".taint.chomp.tainted?.should be_true + ruby_version_is ''...'2.7' do + it "taints the result if self is tainted" do + "abc".taint.chomp.tainted?.should be_true + end end it "returns subclass instances when called on a subclass" do @@ -63,8 +65,10 @@ describe "String#chomp" do str.chomp(nil).should_not equal(str) end - it "taints the result if self is tainted" do - "abc".taint.chomp(nil).tainted?.should be_true + ruby_version_is ''...'2.7' do + it "taints the result if self is tainted" do + "abc".taint.chomp(nil).tainted?.should be_true + end end it "returns an empty String when self is empty" do @@ -93,8 +97,10 @@ describe "String#chomp" do "abc\r\n\r\n\r\n".chomp("").should == "abc" end - it "taints the result if self is tainted" do - "abc".taint.chomp("").tainted?.should be_true + ruby_version_is ''...'2.7' do + it "taints the result if self is tainted" do + "abc".taint.chomp("").tainted?.should be_true + end end it "returns an empty String when self is empty" do @@ -115,8 +121,10 @@ describe "String#chomp" do "abc\r\n\r\n".chomp("\n").should == "abc\r\n" end - it "taints the result if self is tainted" do - "abc".taint.chomp("\n").tainted?.should be_true + ruby_version_is ''...'2.7' do + it "taints the result if self is tainted" do + "abc".taint.chomp("\n").tainted?.should be_true + end end it "returns an empty String when self is empty" do @@ -151,12 +159,14 @@ describe "String#chomp" do "".chomp("abc").should == "" end - it "taints the result if self is tainted" do - "abc".taint.chomp("abc").tainted?.should be_true - end + ruby_version_is ''...'2.7' do + it "taints the result if self is tainted" do + "abc".taint.chomp("abc").tainted?.should be_true + end - it "does not taint the result when the argument is tainted" do - "abc".chomp("abc".taint).tainted?.should be_false + it "does not taint the result when the argument is tainted" do + "abc".chomp("abc".taint).tainted?.should be_false + end end it "returns an empty String when the argument equals self" do @@ -201,8 +211,10 @@ describe "String#chomp!" do "".chomp!.should be_nil end - it "taints the result if self is tainted" do - "abc\n".taint.chomp!.tainted?.should be_true + ruby_version_is ''...'2.7' do + it "taints the result if self is tainted" do + "abc\n".taint.chomp!.tainted?.should be_true + end end it "returns subclass instances when called on a subclass" do @@ -247,8 +259,10 @@ describe "String#chomp!" do "abc\r\n\r\n\r\n".chomp!("").should == "abc" end - it "taints the result if self is tainted" do - "abc\n".taint.chomp!("").tainted?.should be_true + ruby_version_is ''...'2.7' do + it "taints the result if self is tainted" do + "abc\n".taint.chomp!("").tainted?.should be_true + end end it "returns nil when self is empty" do @@ -269,8 +283,10 @@ describe "String#chomp!" do "abc\r\n\r\n".chomp!("\n").should == "abc\r\n" end - it "taints the result if self is tainted" do - "abc\n".taint.chomp!("\n").tainted?.should be_true + ruby_version_is ''...'2.7' do + it "taints the result if self is tainted" do + "abc\n".taint.chomp!("\n").tainted?.should be_true + end end it "returns nil when self is empty" do @@ -305,12 +321,14 @@ describe "String#chomp!" do "".chomp!("abc").should be_nil end - it "taints the result if self is tainted" do - "abc".taint.chomp!("abc").tainted?.should be_true - end + ruby_version_is ''...'2.7' do + it "taints the result if self is tainted" do + "abc".taint.chomp!("abc").tainted?.should be_true + end - it "does not taint the result when the argument is tainted" do - "abc".chomp!("abc".taint).tainted?.should be_false + it "does not taint the result when the argument is tainted" do + "abc".chomp!("abc".taint).tainted?.should be_false + end end end |