diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-01-14 02:45:03 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-01-14 02:45:03 +0000 |
commit | 55fba79ee1796e586f8ae8db6d384dc0959cc471 (patch) | |
tree | 1bab71f1f5055c44f3db3019983b865f1deca3d3 /test | |
parent | 5e3909cb4f6749dde1a1366974a01d5997cbd6cc (diff) | |
download | ruby-55fba79ee1796e586f8ae8db6d384dc0959cc471.tar.gz |
variable.c: $1..$9 in global_variables
* variable.c (rb_f_global_variables): add $1..$9 only if $~ is
set. fix the condition removed at r14014.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_variable.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_variable.rb b/test/ruby/test_variable.rb index 667f9ee24f..90afde19cb 100644 --- a/test/ruby/test_variable.rb +++ b/test/ruby/test_variable.rb @@ -100,6 +100,16 @@ class TestVariable < Test::Unit::TestCase assert_equal([:x, :bug9486], x) end + def test_global_variables + gv = global_variables + assert_empty(gv.grep(/\A(?!\$)/)) + assert_nil($~) + assert_not_include(gv, :$1) + /.*/ =~ "global" + assert_not_nil($~) + assert_include(global_variables-gv, :$1) + end + def test_global_variable_0 assert_in_out_err(["-e", "$0='t'*1000;print $0"], "", /\At+\z/, []) end |