summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-20 05:43:15 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-20 05:43:15 +0000
commitf89238ec0d689f3989c55c4716da500b8c898900 (patch)
treeddf409196264dc90a3b096e7940f6bd8c5a21ae1 /test
parent766f9b4aff57b05a19589c55850d1a73f49d5d06 (diff)
parse.y: ignore constant name captures
* parse.y (reg_named_capture_assign_iter): ignore non-local name captures, including non-ASCII constant names. [ruby-dev:50719] [Bug #15437] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-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 9a008888468..f8800468b34 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -216,6 +216,12 @@ class TestRegexp < Test::Unit::TestCase
assert_not_include(local_variables, :nil, "[ruby-dev:32675]")
end
+ def test_assign_named_capture_to_const
+ %W[C \u{1d402}].each do |name|
+ assert_equal(:ok, Class.new.class_eval("#{name} = :ok; /(?<#{name}>.*)/ =~ 'ng'; #{name}"))
+ end
+ end
+
def test_assign_named_capture_trace
bug = '[ruby-core:79940] [Bug #13287]'
assert_normal_exit("#{<<-"begin;"}\n#{<<-"end;"}", bug)