summaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-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 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){