From 3203ae53ffeea05c7719d4ba863e0ca492b305cd Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 18 Feb 2017 04:23:20 +0000 Subject: array.c: check if numeric * array.c (finish_exact_sum): add 0 and the initial value to check if the latter is numeric. [ruby-core:79572] [Bug #13222] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_array.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index 08100142f8..b0be0b4a87 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -2838,6 +2838,9 @@ class TestArray < Test::Unit::TestCase assert_equal("abc", ["a", "b", "c"].sum("")) assert_equal([1, [2], 3], [[1], [[2]], [3]].sum([])) + assert_raise(TypeError) {[0].sum("")} + assert_raise(TypeError) {[1].sum("")} + assert_separately(%w[-rmathn], <<-EOS, ignore_stderr: true) assert_equal(6, [1r, 2, 3r].sum) EOS -- cgit v1.2.3