From 83687c4eb47e2bcbe463d097317d068d1dd0b734 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 12 Jun 1998 09:35:19 +0000 Subject: nested local variables git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- sample/test.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'sample/test.rb') 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') -- cgit v1.2.3