Skip to content

Commit

Permalink
lstrip returns String instances when called on a subclass in Ruby 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lxxxvi committed Oct 1, 2021
1 parent 1307612 commit 1faf27d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions core/string/lstrip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@
end
end

ruby_version_is '3.0' do
it "returns String instances when called on a subclass" do
StringSpecs::MyString.new(" hello").lstrip.should be_an_instance_of(String)
StringSpecs::MyString.new(" ").lstrip.should be_an_instance_of(String)
StringSpecs::MyString.new("").lstrip.should be_an_instance_of(String)
end
end

ruby_version_is ''...'3.0.0' do
it "returns subclass instances when called on a subclass" do
StringSpecs::MyString.new(" hello").lstrip.should be_an_instance_of(StringSpecs::MyString)
StringSpecs::MyString.new(" ").lstrip.should be_an_instance_of(StringSpecs::MyString)
StringSpecs::MyString.new("").lstrip.should be_an_instance_of(StringSpecs::MyString)
end
end

ruby_version_is ''...'2.7' do
it "taints the result when self is tainted" do
"".taint.lstrip.should.tainted?
Expand Down

0 comments on commit 1faf27d

Please sign in to comment.