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 | 7cf84b83cb4cd81ae0c00d44a4e34af82f56f845 (patch) | |
tree | 7a22a7db756c3ff7726f2fa8782a5c298ec5072c /test/ruby/test_array.rb | |
parent | 4333dacd008a08fec48d6bf63d3f626fce609772 (diff) | |
download | ruby-7cf84b83cb4cd81ae0c00d44a4e34af82f56f845.tar.gz ruby-7cf84b83cb4cd81ae0c00d44a4e34af82f56f845.tar.xz ruby-7cf84b83cb4cd81ae0c00d44a4e34af82f56f845.zip |
* test/ruby/test_array.rb (test_sort_with_callcc): test for [ruby-core:16679].
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_array.rb')
-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 11be73c73..2ed15ffec 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__ |