diff options
author | Benoit Daloze <eregontp@gmail.com> | 2021-10-05 19:41:44 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2021-10-05 19:41:44 +0200 |
commit | b9f34062f00d1d2548ca9b6af61a6447c2d0f8e3 (patch) | |
tree | 37c7600088a5e080b2f35794b0923395daf036d0 /spec/ruby/core/string/reverse_spec.rb | |
parent | afcbb501ac17ba2ad5370ada5fd26e8dda9a5aaa (diff) |
Update to ruby/spec@ccf0d85
Diffstat (limited to 'spec/ruby/core/string/reverse_spec.rb')
-rw-r--r-- | spec/ruby/core/string/reverse_spec.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/spec/ruby/core/string/reverse_spec.rb b/spec/ruby/core/string/reverse_spec.rb index cf4956a528..b45ff2cf6f 100644 --- a/spec/ruby/core/string/reverse_spec.rb +++ b/spec/ruby/core/string/reverse_spec.rb @@ -10,6 +10,22 @@ describe "String#reverse" do "".reverse.should == "" end + ruby_version_is '3.0' do + it "returns String instances when called on a subclass" do + StringSpecs::MyString.new("stressed").reverse.should be_an_instance_of(String) + StringSpecs::MyString.new("m").reverse.should be_an_instance_of(String) + StringSpecs::MyString.new("").reverse.should be_an_instance_of(String) + end + end + + ruby_version_is ''...'3.0' do + it "returns subclass instances when called on a subclass" do + StringSpecs::MyString.new("stressed").reverse.should be_an_instance_of(StringSpecs::MyString) + StringSpecs::MyString.new("m").reverse.should be_an_instance_of(StringSpecs::MyString) + StringSpecs::MyString.new("").reverse.should be_an_instance_of(StringSpecs::MyString) + end + end + ruby_version_is ''...'2.7' do it "taints the result if self is tainted" do "".taint.reverse.should.tainted? @@ -20,7 +36,6 @@ describe "String#reverse" do it "reverses a string with multi byte characters" do "微軟正黑體".reverse.should == "體黑正軟微" end - end describe "String#reverse!" do |