1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2008-05-08 01:04:20 +00:00
parent 4c2b10e0d6
commit f8cb9c861a

View file

@ -1125,6 +1125,25 @@ class TestArray < Test::Unit::TestCase
assert_equal(@cls[], @cls[].sort!) assert_equal(@cls[], @cls[].sort!)
end 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 def test_to_a
a = @cls[ 1, 2, 3 ] a = @cls[ 1, 2, 3 ]
a_id = a.__id__ a_id = a.__id__