summaryrefslogtreecommitdiff
path: root/test/ruby/test_regexp.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2021-09-16 19:37:52 +0900
committerNobuyoshi Nakada <[email protected]>2021-09-16 19:55:06 +0900
commit09d724e6f846b4e53e8571d41ca7d3055d732d9f ()
treed1438b730b4201f4a02cd67a1e3d1e6a73b78c6f /test/ruby/test_regexp.rb
parentddb32e66160ab50849419ef7c7ac584913b79c34 (diff)
[Feature #18172] Add MatchData#match
The method to return the single matched substring corresponding to the given argument.
Notes: Merged: https://.com/ruby/ruby/pull/4851
-rw-r--r--test/ruby/test_regexp.rb17
1 files changed, 17 insertions, 0 deletions
@@ -473,6 +473,23 @@ class TestRegexp < Test::Unit::TestCase
assert_equal("foobarbaz", m.string)
end
def test_match_inspect
m = /(...)(...)(...)(...)?/.match("foobarbaz")
assert_equal('#<MatchData "foobarbaz" 1:"foo" 2:"bar" 3:"baz" 4:nil>', m.inspect)