diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-01-14 08:36:49 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-01-14 08:36:49 +0000 |
commit | 92e803c9c8e7cebe937c5ba05312417dbf99d688 (patch) | |
tree | 01475f3c7b7fe9a38d1d563e8358f25a19e41cb3 /test | |
parent | 1301d1f5bccc10daf93c816ef4e177776d0668de (diff) |
variable.c: matched backrefs only
* variable.c (rb_f_global_variables): add matched back references
only, as well as defiend? operator.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_variable.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/test/ruby/test_variable.rb b/test/ruby/test_variable.rb index 90afde19cb..3fba8d1884 100644 --- a/test/ruby/test_variable.rb +++ b/test/ruby/test_variable.rb @@ -105,9 +105,13 @@ class TestVariable < Test::Unit::TestCase assert_empty(gv.grep(/\A(?!\$)/)) assert_nil($~) assert_not_include(gv, :$1) - /.*/ =~ "global" + /(\w)(\d)?(.)(.)(.)(.)(.)(.)(.)(.)(\d)?(.)/ =~ "globalglobalglobal" assert_not_nil($~) - assert_include(global_variables-gv, :$1) + gv = global_variables - gv + assert_include(gv, :$1) + assert_not_include(gv, :$2) + assert_not_include(gv, :$11) + assert_include(gv, :$12) end def test_global_variable_0 |