From bf524be10c1fbc28e59d11d17fc7147f53129cb5 Mon Sep 17 00:00:00 2001 From: usa Date: Thu, 25 Feb 2016 07:48:31 +0000 Subject: merge revision(s) 53167: [Backport #11825] * 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/branches/ruby_2_1@53920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_regexp.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index bef770b923..8223a143b3 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"], /(?.)(?.)/.names) assert_equal(["foo"], /(?.)(?.)/.names) assert_equal([], /(.)(.)/.names) + assert_equal([bug11825_name], bug11825_re.names) assert_equal(["foo", "bar"], /(?.)(?.)/.match("ab").names) assert_equal(["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]}, /(?.)(?.)/.named_captures) -- cgit v1.2.3