diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-06-12 09:35:19 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-06-12 09:35:19 +0000 |
commit | 83687c4eb47e2bcbe463d097317d068d1dd0b734 (patch) | |
tree | 003e23f99c0a3e8587360aa2a6282c702b564fc5 /sample/test.rb | |
parent | 1bc6f594d3de8dbfb5c165835eaec99bd49327c8 (diff) |
nested local variables
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/test.rb')
-rw-r--r-- | sample/test.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sample/test.rb b/sample/test.rb index 912f84e2d4..b3303959f2 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -653,7 +653,6 @@ ok(!defined?(iii)) # out of scope $x=0 $proc.call(5) $proc2.call -p $x ok($x == 5) if defined? Process.kill @@ -739,6 +738,17 @@ rescue NameError # must raise error end ok(!$bad) +x = proc{} +eval "i = 1", x +ok(eval("i", x) == 1) +x = proc{proc{}}.call +eval "i = 22", x +ok(eval("i", x) == 22) +$x = [] +x = proc{proc{}}.call +eval "(0..9).each{|i4| $x[i4] = proc{i4*2}}", x +ok($x[4].call == 8) + check "system" ok(`echo foobar` == "foobar\n") ok(`./ruby -e 'print "foobar"'` == 'foobar') |