summaryrefslogtreecommitdiff
path: root/test/ruby/test_regexp.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-17 00:46:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-17 00:46:07 +0000
commite64d814101fc0ee5c856ef55282c1efd6db3681c (patch)
tree9630c7416d1546eb300e40a823e7517aaddca71d /test/ruby/test_regexp.rb
parent70dea9ef28e8986d361e1b387afa2306b9e4b015 (diff)
re.c: names encoding
* re.c (reg_names_iter): should consider encoding of regexp. [ruby-core:72185] [Bug #11825] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 ef75d4d413..96b0bfacb1 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -119,13 +119,19 @@ class TestRegexp < Test::Unit::TestCase
assert_equal(nil, Regexp.last_match(1))
assert_equal(nil, Regexp.last_match(:foo))
+ bug11825_name = "\u{5b9d 77f3}"
+ bug11825_str = "\u{30eb 30d3 30fc}"
+ bug11825_re = /(?<#{bug11825_name}>)#{bug11825_str}/
+
assert_equal(["foo", "bar"], /(?<foo>.)(?<bar>.)/.names)
assert_equal(["foo"], /(?<foo>.)(?<foo>.)/.names)
assert_equal([], /(.)(.)/.names)
+ assert_equal([bug11825_name], bug11825_re.names)
assert_equal(["foo", "bar"], /(?<foo>.)(?<bar>.)/.match("ab").names)
assert_equal(["foo"], /(?<foo>.)(?<foo>.)/.match("ab").names)
assert_equal([], /(.)(.)/.match("ab").names)
+ assert_equal([bug11825_name], bug11825_re.match(bug11825_str).names)
assert_equal({"foo"=>[1], "bar"=>[2]},
/(?<foo>.)(?<bar>.)/.named_captures)