summaryrefslogtreecommitdiff
path: root/spec/ruby/core/matchdata
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-27 20:21:25 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-27 20:21:25 +0000
commit37ef87c12b6c496001d0f199e46b4ecbfac5d394 (patch)
tree063c277e6343b299f6d47200e5b38f3af7975301 /spec/ruby/core/matchdata
parentecf03376ec25fbd1ced6c0d1de110c6761e959fd (diff)
Update to ruby/spec@cbe855c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/matchdata')
-rw-r--r--spec/ruby/core/matchdata/inspect_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/ruby/core/matchdata/inspect_spec.rb b/spec/ruby/core/matchdata/inspect_spec.rb
index 3cf968b6f5..eb71d45523 100644
--- a/spec/ruby/core/matchdata/inspect_spec.rb
+++ b/spec/ruby/core/matchdata/inspect_spec.rb
@@ -14,4 +14,10 @@ describe "MatchData#inspect" do
# it makes perfect sense. See JRUBY-4558 for example.
@match_data.inspect.should == '#<MatchData "HX1138" 1:"H" 2:"X" 3:"113" 4:"8">'
end
+
+ it "returns a human readable representation of named captures" do
+ match_data = "abc def ghi".match(/(?<first>\w+)\s+(?<last>\w+)\s+(\w+)/)
+
+ match_data.inspect.should == '#<MatchData "abc def ghi" first:"abc" last:"def">'
+ end
end