summaryrefslogtreecommitdiff
path: root/spec/ruby/core/matchdata/to_s_spec.rb
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2021-11-29 15:50:28 +0100
committerBenoit Daloze <eregontp@gmail.com>2021-11-29 15:50:28 +0100
commit67a1e2258974df4b597d019739595c18fbb9a7c1 (patch)
tree992ad4fc0fc08a6af8f04373703a339f957eb143 /spec/ruby/core/matchdata/to_s_spec.rb
parente6d93a27afa058319e6dad093bbef637e49fce47 (diff)
Update to ruby/spec@7f22a0b
Diffstat (limited to 'spec/ruby/core/matchdata/to_s_spec.rb')
-rw-r--r--spec/ruby/core/matchdata/to_s_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/ruby/core/matchdata/to_s_spec.rb b/spec/ruby/core/matchdata/to_s_spec.rb
index 9e213bb342..aab0955ae1 100644
--- a/spec/ruby/core/matchdata/to_s_spec.rb
+++ b/spec/ruby/core/matchdata/to_s_spec.rb
@@ -1,7 +1,15 @@
require_relative '../../spec_helper'
+require_relative 'fixtures/classes'
describe "MatchData#to_s" do
it "returns the entire matched string" do
/(.)(.)(\d+)(\d)/.match("THX1138.").to_s.should == "HX1138"
end
+
+ ruby_version_is "3.0" do
+ it "returns an instance of String when given a String subclass" do
+ str = MatchDataSpecs::MyString.new("THX1138.")
+ /(.)(.)(\d+)(\d)/.match(str).to_s.should be_an_instance_of(String)
+ end
+ end
end