diff options
| author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-05-30 05:56:13 +0000 |
|---|---|---|
| committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-05-30 05:56:13 +0000 |
| commit | 2de9bf108ef949a3af13299499ef207528df62ac (patch) | |
| tree | 372a124cb831288479f8807bcb53d3cfbf533b9b /test/ruby | |
| parent | 7d52d7ec653139f3ca373b05d8be7910e73e0193 (diff) | |
| download | ruby-2de9bf108ef949a3af13299499ef207528df62ac.tar.gz ruby-2de9bf108ef949a3af13299499ef207528df62ac.tar.xz ruby-2de9bf108ef949a3af13299499ef207528df62ac.zip | |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@12415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_continuation.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_continuation.rb b/test/ruby/test_continuation.rb index d5c9c32e4..8af13363d 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){ |
