diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-08 01:04:20 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-08 01:04:20 +0000 |
commit | f8cb9c861ad95f081c97a18e8f7df4e5f623db6e (patch) | |
tree | 7a22a7db756c3ff7726f2fa8782a5c298ec5072c | |
parent | 4c2b10e0d6b966246f4ca71837720df552fbfdca (diff) | |
download | ruby-f8cb9c861ad95f081c97a18e8f7df4e5f623db6e.tar.gz |
* test/ruby/test_array.rb (test_sort_with_callcc): test for [ruby-core:16679].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/ruby/test_array.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index 11be73c733..2ed15ffec0 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -1125,6 +1125,25 @@ class TestArray < Test::Unit::TestCase 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__ |