diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_continuation.rb | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/test/ruby/test_continuation.rb b/test/ruby/test_continuation.rb index 5e5b78cc82..18289c5418 100644 --- a/test/ruby/test_continuation.rb +++ b/test/ruby/test_continuation.rb @@ -82,8 +82,12 @@ class TestContinuation < Test::Unit::TestCase cont = nil func = lambda do |*args| if orig_thread == Thread.current - @memo += 1 - cont.call(nil) + if cont + @memo += 1 + c = cont + cont = nil + c.call(nil) + end end end cont = callcc { |cc| cc } @@ -105,14 +109,18 @@ class TestContinuation < Test::Unit::TestCase def tracing_with_thread_set_trace_func cont = nil func = lambda do |*args| - @memo += 1 - cont.call(nil) + if cont + @memo += 1 + c = cont + cont = nil + c.call(nil) + end end cont = callcc { |cc| cc } if cont Thread.current.set_trace_func(func) else - Thread.current.set_trace_func(nil) + set_trace_func(nil) end end |