From b6a69b9e762e1bb2e81c2b978f2635166fee49c3 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 14 Jan 2016 08:36:49 +0000 Subject: 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 --- test/ruby/test_variable.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'test') 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 -- cgit v1.2.3