[前][次][番号順一覧][スレッド一覧]

ruby-changes:42665

From: yui-knk <ko1@a...>
Date: Sun, 24 Apr 2016 08:35:48 +0900 (JST)
Subject: [ruby-changes:42665] yui-knk:r54739 (trunk): * test/ruby/test_array.rb: Add test cases for Array#sum with

yui-knk	2016-04-24 09:32:21 +0900 (Sun, 24 Apr 2016)

  New Revision: 54739

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54739

  Log:
    * test/ruby/test_array.rb: Add test cases for Array#sum with
      non-numeric objects.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_array.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54738)
+++ ChangeLog	(revision 54739)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Apr 24 09:32:12 2016  Yuichiro Kaneko  <yui-knk@r...>
+
+	* test/ruby/test_array.rb: Add test cases for Array#sum with
+	  non-numeric objects.
+
 Sun Apr 24 04:21:27 2016  NARUSE, Yui  <naruse@r...>
 
 	* vm_insnhelper.c (INLINE): define as `inline` when it is optimized.
Index: test/ruby/test_array.rb
===================================================================
--- test/ruby/test_array.rb	(revision 54738)
+++ test/ruby/test_array.rb	(revision 54739)
@@ -2786,6 +2786,9 @@ class TestArray < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_array.rb#L2786
     assert_float_equal(large_number+(small_number*10), [large_number, *[small_number]*10].sum)
     assert_float_equal(large_number+(small_number*10), [large_number/1r, *[small_number]*10].sum)
     assert_float_equal(large_number+(small_number*11), [small_number, large_number/1r, *[small_number]*10].sum)
+
+    assert_equal("abc", ["a", "b", "c"].sum(""))
+    assert_equal([1, [2], 3], [[1], [[2]], [3]].sum([]))
   end
 
   private

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]