diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-22 03:40:57 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-22 03:40:57 +0000 |
commit | 77061811ee6b618d1efd8a2ca66aec82d9077f33 (patch) | |
tree | dba0a9b6e8e3a370a436dca9c850123185eb1b81 /test/ruby | |
parent | db440bc6f04e7e4e4c2986a5ef17b698735e7899 (diff) | |
download | ruby-77061811ee6b618d1efd8a2ca66aec82d9077f33.tar.gz ruby-77061811ee6b618d1efd8a2ca66aec82d9077f33.tar.xz ruby-77061811ee6b618d1efd8a2ca66aec82d9077f33.zip |
* array.c (flatten): check if reentered. [ruby-dev:34798]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_array.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index dd3d165c1..0cbeb435a 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -726,6 +726,20 @@ class TestArray < Test::Unit::TestCase @cls[@cls[@cls[@cls[],@cls[]],@cls[@cls[]],@cls[]],@cls[@cls[@cls[]]]].flatten) end + def test_flatten_with_callcc + respond_to?(:callcc) or require 'continuation' + o = Object.new + def o.to_ary() callcc {|k| @cont = k; [1,2,3]} end + begin + assert_equal([10, 20, 1, 2, 3, 30, 1, 2, 3, 40], [10, 20, o, 30, o, 40].flatten) + rescue => e + else + o.instance_eval {@cont}.call + end + assert_instance_of(RuntimeError, e, '[ruby-dev:34798]') + assert_match(/reentered/, e.message, '[ruby-dev:34798]') + end + def test_hash a1 = @cls[ 'cat', 'dog' ] a2 = @cls[ 'cat', 'dog' ] |