summaryrefslogtreecommitdiff
path: root/spec/ruby/optional/capi/string_spec.rb
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-09-24 20:59:12 -0700
committerJeremy Evans <code@jeremyevans.net>2019-11-18 01:00:25 +0200
commitffd0820ab317542f8780aac475da590a4bdbc7a8 (patch)
tree6a5d774933c15fd2b9ea948bd3ae2fa587faaf82 /spec/ruby/optional/capi/string_spec.rb
parentc5c05460ac20abcbc0ed686eb4acf06da7a39a79 (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/optional/capi/string_spec.rb')
-rw-r--r--spec/ruby/optional/capi/string_spec.rb44
1 files changed, 26 insertions, 18 deletions
diff --git a/spec/ruby/optional/capi/string_spec.rb b/spec/ruby/optional/capi/string_spec.rb
index 53d28f7940..4da31445fe 100644
--- a/spec/ruby/optional/capi/string_spec.rb
+++ b/spec/ruby/optional/capi/string_spec.rb
@@ -167,8 +167,10 @@ describe "C-API String function" do
@s.rb_str_new("hello", 3).should == "hel"
end
- it "returns a non-tainted string" do
- @s.rb_str_new("hello", 5).tainted?.should == false
+ ruby_version_is ''...'2.7' do
+ it "returns a non-tainted string" do
+ @s.rb_str_new("hello", 5).tainted?.should == false
+ end
end
it "returns an empty string if len is 0" do
@@ -305,19 +307,21 @@ describe "C-API String function" do
end
end
- describe "rb_tainted_str_new" do
- it "creates a new tainted String" do
- newstring = @s.rb_tainted_str_new("test", 4)
- newstring.should == "test"
- newstring.tainted?.should be_true
+ ruby_version_is ''...'2.7' do
+ describe "rb_tainted_str_new" do
+ it "creates a new tainted String" do
+ newstring = @s.rb_tainted_str_new("test", 4)
+ newstring.should == "test"
+ newstring.tainted?.should be_true
+ end
end
- end
- describe "rb_tainted_str_new2" do
- it "creates a new tainted String" do
- newstring = @s.rb_tainted_str_new2("test")
- newstring.should == "test"
- newstring.tainted?.should be_true
+ describe "rb_tainted_str_new2" do
+ it "creates a new tainted String" do
+ newstring = @s.rb_tainted_str_new2("test")
+ newstring.should == "test"
+ newstring.tainted?.should be_true
+ end
end
end
@@ -684,8 +688,10 @@ describe :rb_external_str_new, shared: true do
@s.send(@method, "#{x80}abc").encoding.should == Encoding::BINARY
end
- it "returns a tainted String" do
- @s.send(@method, "abc").tainted?.should be_true
+ ruby_version_is ''...'2.7' do
+ it "returns a tainted String" do
+ @s.send(@method, "abc").tainted?.should be_true
+ end
end
end
@@ -767,9 +773,11 @@ describe "C-API String function" do
s.encoding.should equal(Encoding::EUC_JP)
end
- it "returns a tainted String" do
- s = @s.rb_external_str_new_with_enc("abc", 3, Encoding::US_ASCII)
- s.tainted?.should be_true
+ ruby_version_is ''...'2.7' do
+ it "returns a tainted String" do
+ s = @s.rb_external_str_new_with_enc("abc", 3, Encoding::US_ASCII)
+ s.tainted?.should be_true
+ end
end
end