summaryrefslogtreecommitdiff
path: root/test/ruby/test_continuation.rb
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-30 05:56:13 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-30 05:56:13 +0000
commit284565992f487937080230d3ae2b5afae4c8ac3f (patch)
tree372a124cb831288479f8807bcb53d3cfbf533b9b /test/ruby/test_continuation.rb
parent426fcba8916780c99c7280a8278f84d81ff3d05e (diff)
* cont.c (cont_capture): store all local variables in heap
([ruby-dev:30832]). * vm.c (th_stack_to_heap): added. * test/ruby/test_continuation.rb: add a test for above. * eval_intern.h (th_get_ruby_level_cfp): fix to clean code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_continuation.rb')
-rw-r--r--test/ruby/test_continuation.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_continuation.rb b/test/ruby/test_continuation.rb
index d5c9c32e4b..8af13363dc 100644
--- a/test/ruby/test_continuation.rb
+++ b/test/ruby/test_continuation.rb
@@ -18,6 +18,20 @@ class TestContinuation < Test::Unit::TestCase
assert_equal([:a, :b, :b], ary)
end
+ def test_check_localvars
+ vv = 0
+ @v = 0
+ @ary = []
+ [1, 2, 3].each{|i|
+ callcc {|k| @k = k}
+ @v += 1
+ vv += 1
+ }
+ @ary << [vv, @v]
+ @k.call if @v < 10
+ assert_equal((3..10).map{|e| [e, e]}, @ary)
+ end
+
def test_error
cont = callcc{|c| c}
assert_raise(RuntimeError){