diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-14 18:04:21 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-14 18:04:21 +0000 |
commit | f414bd65aec6093f38860d5a9ddca4e4d581c95d (patch) | |
tree | 840798354a8f3ec79e6a0de7c0b7b652594d8f0b /test/ruby/test_regexp.rb | |
parent | f621b32e58fa7266e83884be795d00ee41c86560 (diff) |
* string.c (rb_str_subpat): accept capture name.
(rb_str_aref): follow above change.
(rb_str_aref_m): pass the 2nd argument to rb_str_subpat.
(rb_str_subpat_set): accept capture name.
(rb_str_aset): follow above change.
(rb_str_partition): ditto.
(rb_str_aset_m): pass the 2nd argument to rb_str_subpat_set.
* include/ruby/intern.h (rb_reg_backref_number): declared.
* re.c (rb_reg_backref_number): defined.
[ruby-core:21057]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_regexp.rb')
-rw-r--r-- | test/ruby/test_regexp.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index d6441c9573..8b7b6c053e 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -104,6 +104,12 @@ class TestRegexp < Test::Unit::TestCase assert_equal({}, /(.)(.)/.named_captures) assert_equal("a[b]c", "abc".sub(/(?<x>[bc])/, "[\\k<x>]")) + + assert_equal("o", "foo"[/(?<bar>o)/, "bar"]) + + s = "foo" + s[/(?<bar>o)/, "bar"] = "baz" + assert_equal("fbazo", s) end def test_assign_named_capture |