mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@3affe1e
This commit is contained in:
parent
6ae81d49b5
commit
45cf4f2187
277 changed files with 3844 additions and 7624 deletions
|
@ -94,16 +94,6 @@ describe "String#slice! with index, length" do
|
|||
a.should == "h"
|
||||
end
|
||||
|
||||
ruby_version_is ''...'2.7' do
|
||||
it "always taints resulting strings when self is tainted" do
|
||||
str = "hello world"
|
||||
str.taint
|
||||
|
||||
str.slice!(0, 0).should.tainted?
|
||||
str.slice!(2, 1).should.tainted?
|
||||
end
|
||||
end
|
||||
|
||||
it "returns nil if the given position is out of self" do
|
||||
a = "hello"
|
||||
a.slice(10, 3).should == nil
|
||||
|
@ -195,16 +185,6 @@ describe "String#slice! Range" do
|
|||
b.should == "hello"
|
||||
end
|
||||
|
||||
ruby_version_is ''...'2.7' do
|
||||
it "always taints resulting strings when self is tainted" do
|
||||
str = "hello world"
|
||||
str.taint
|
||||
|
||||
str.slice!(0..0).should.tainted?
|
||||
str.slice!(2..3).should.tainted?
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is ''...'3.0' do
|
||||
it "returns subclass instances" do
|
||||
s = StringSpecs::MyString.new("hello")
|
||||
|
@ -294,30 +274,6 @@ describe "String#slice! with Regexp" do
|
|||
s.should == "this is a string"
|
||||
end
|
||||
|
||||
ruby_version_is ''...'2.7' do
|
||||
it "always taints resulting strings when self or regexp is tainted" do
|
||||
strs = ["hello world"]
|
||||
strs += strs.map { |s| s.dup.taint }
|
||||
|
||||
strs.each do |str|
|
||||
str = str.dup
|
||||
str.slice!(//).tainted?.should == str.tainted?
|
||||
str.slice!(/hello/).tainted?.should == str.tainted?
|
||||
|
||||
tainted_re = /./
|
||||
tainted_re.taint
|
||||
|
||||
str.slice!(tainted_re).should.tainted?
|
||||
end
|
||||
end
|
||||
|
||||
it "doesn't taint self when regexp is tainted" do
|
||||
s = "hello"
|
||||
s.slice!(/./.taint)
|
||||
s.should_not.tainted?
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is ''...'3.0' do
|
||||
it "returns subclass instances" do
|
||||
s = StringSpecs::MyString.new("hello")
|
||||
|
@ -365,30 +321,6 @@ describe "String#slice! with Regexp, index" do
|
|||
str.should == "ho here"
|
||||
end
|
||||
|
||||
ruby_version_is ''...'2.7' do
|
||||
it "always taints resulting strings when self or regexp is tainted" do
|
||||
strs = ["hello world"]
|
||||
strs += strs.map { |s| s.dup.taint }
|
||||
|
||||
strs.each do |str|
|
||||
str = str.dup
|
||||
str.slice!(//, 0).tainted?.should == str.tainted?
|
||||
str.slice!(/hello/, 0).tainted?.should == str.tainted?
|
||||
|
||||
tainted_re = /(.)(.)(.)/
|
||||
tainted_re.taint
|
||||
|
||||
str.slice!(tainted_re, 1).should.tainted?
|
||||
end
|
||||
end
|
||||
|
||||
it "doesn't taint self when regexp is tainted" do
|
||||
s = "hello"
|
||||
s.slice!(/(.)(.)/.taint, 1)
|
||||
s.should_not.tainted?
|
||||
end
|
||||
end
|
||||
|
||||
it "returns nil if there was no match" do
|
||||
s = "this is a string"
|
||||
s.slice!(/x(zzz)/, 1).should == nil
|
||||
|
@ -463,23 +395,6 @@ describe "String#slice! with String" do
|
|||
c.should == "he hello"
|
||||
end
|
||||
|
||||
ruby_version_is ''...'2.7' do
|
||||
it "taints resulting strings when other is tainted" do
|
||||
strs = ["", "hello world", "hello"]
|
||||
strs += strs.map { |s| s.dup.taint }
|
||||
|
||||
strs.each do |str|
|
||||
str = str.dup
|
||||
strs.each do |other|
|
||||
other = other.dup
|
||||
r = str.slice!(other)
|
||||
|
||||
r.tainted?.should == !r.nil? & other.tainted?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it "doesn't set $~" do
|
||||
$~ = nil
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue