summaryrefslogtreecommitdiff
path: root/test/ruby/test_regexp.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_regexp.rb')
-rw-r--r--test/ruby/test_regexp.rb6
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