From d0a98a0e90c9ff969da0c477f0f4cedb018b54b1 Mon Sep 17 00:00:00 2001 From: marcandre Date: Fri, 2 Apr 2010 22:25:49 +0000 Subject: * array.c (rb_ary_product): Test for reentry * test/ruby/test_array.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_array.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test') diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index 8208b3a2a4..6c84b9238b 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -780,6 +780,23 @@ class TestArray < Test::Unit::TestCase assert_match(/reentered/, e.message) end + def test_product_with_callcc + respond_to?(:callcc, true) or require 'continuation' + n = 1000 + cont = nil + ary = [1,2,3] + begin + ary.product { + callcc {|k| cont = k} unless cont + } + rescue => e + end + n -= 1 + cont.call if 0 < n + assert_instance_of(RuntimeError, e) + assert_match(/reentered/, e.message) + end + def test_combination_with_callcc respond_to?(:callcc, true) or require 'continuation' n = 1000 -- cgit v1.2.3