diff options
Diffstat (limited to 'test/ruby/test_array.rb')
-rw-r--r-- | test/ruby/test_array.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index fd3b98432d..25bf5955ec 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -1224,6 +1224,18 @@ class TestArray < Test::Unit::TestCase if (@cls == Array) assert_equal(a_id, a.to_ary.__id__) end + + o = Object.new + def o.to_ary + [4, 5] + end + assert_equal([1, 2, 3, 4, 5], a.concat(o)) + + o = Object.new + def o.to_ary + foo_bar() + end + assert_match(/foo_bar/, assert_raise(NoMethodError) {a.concat(o)}.message) end def test_to_s |