summaryrefslogtreecommitdiff
path: root/spec/ruby/core/matchdata/regexp_spec.rb
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-11-30 21:26:52 +0100
committerBenoit Daloze <eregontp@gmail.com>2019-11-30 21:26:52 +0100
commit1243255c3a36433041012b6107a5ac48658a0895 (patch)
tree04440f84b48999ff08d4a2a16d066d0ad731400e /spec/ruby/core/matchdata/regexp_spec.rb
parentab8345271eb87ff155d8bd5f22f53a4cf2902c26 (diff)
Update to ruby/spec@4eec3dc
Diffstat (limited to 'spec/ruby/core/matchdata/regexp_spec.rb')
-rw-r--r--spec/ruby/core/matchdata/regexp_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/ruby/core/matchdata/regexp_spec.rb b/spec/ruby/core/matchdata/regexp_spec.rb
index 7a4783434c..099b59c559 100644
--- a/spec/ruby/core/matchdata/regexp_spec.rb
+++ b/spec/ruby/core/matchdata/regexp_spec.rb
@@ -11,6 +11,12 @@ describe "MatchData#regexp" do
m.regexp.should == /hay/
end
+ it "returns the same Regexp used to match" do
+ r = /hay/
+ m = 'haystack'.match(r)
+ m.regexp.object_id.should == r.object_id
+ end
+
it "returns a Regexp for the result of gsub(String)" do
'he[[o'.gsub('[', ']')
$~.regexp.should == /\[/