ruby-changes:4828
From: ko1@a...
Date: Thu, 8 May 2008 10:04:29 +0900 (JST)
Subject: [ruby-changes:4828] nobu - Ruby:r16322 (trunk): * test/ruby/test_array.rb (test_sort_with_callcc): test for .
nobu 2008-05-08 10:04:20 +0900 (Thu, 08 May 2008) New Revision: 16322 Modified files: trunk/test/ruby/test_array.rb Log: * test/ruby/test_array.rb (test_sort_with_callcc): test for [ruby-core:16679]. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_array.rb?r1=16322&r2=16321&diff_format=u Index: test/ruby/test_array.rb =================================================================== --- test/ruby/test_array.rb (revision 16321) +++ test/ruby/test_array.rb (revision 16322) @@ -1125,6 +1125,25 @@ assert_equal(@cls[], @cls[].sort!) end + def test_sort_with_callcc + respond_to?(:callcc) or require 'continuation' + n = 1000 + cont = nil + ary = (1..100).to_a + begin + ary.sort! {|a,b| + callcc {|k| cont = k} unless cont + assert_equal(100, ary.size, '[ruby-core:16679]') + a <=> b + } + rescue => e + end + n -= 1 + cont.call if 0 < n + assert_instance_of(RuntimeError, e, '[ruby-core:16679]') + assert_match(/reentered/, e.message, '[ruby-core:16679]') + end + def test_to_a a = @cls[ 1, 2, 3 ] a_id = a.__id__ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/