ruby-changes:39060
From: hsbt <ko1@a...>
Date: Sat, 4 Jul 2015 19:43:50 +0900 (JST)
Subject: [ruby-changes:39060] hsbt:r51141 (trunk): * Add test case for empty array and first method with args.
hsbt 2015-07-04 19:43:38 +0900 (Sat, 04 Jul 2015) New Revision: 51141 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51141 Log: * Add test case for empty array and first method with args. Patch by @yui-knk [fix GH-955] Modified files: trunk/ChangeLog trunk/enum.c trunk/test/ruby/test_enum.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 51140) +++ ChangeLog (revision 51141) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Jul 4 19:43:31 2015 SHIBATA Hiroshi <hsbt@r...> + + * Add test case for empty array and first method with args. + Patch by @yui-knk [fix GH-955] + Sat Jul 4 19:39:08 2015 SHIBATA Hiroshi <hsbt@r...> * Add test for `Enumerable#sort` with block. Patch by @yui-knk Index: enum.c =================================================================== --- enum.c (revision 51140) +++ enum.c (revision 51141) @@ -828,6 +828,7 @@ static VALUE enum_take(VALUE obj, VALUE https://github.com/ruby/ruby/blob/trunk/enum.c#L828 * %w[foo bar baz].first(2) #=> ["foo", "bar"] * %w[foo bar baz].first(10) #=> ["foo", "bar", "baz"] * [].first #=> nil + * [].first(10) #=> [] * */ Index: test/ruby/test_enum.rb =================================================================== --- test/ruby/test_enum.rb (revision 51140) +++ test/ruby/test_enum.rb (revision 51141) @@ -202,6 +202,7 @@ class TestEnumerable < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_enum.rb#L202 assert_equal(1, @obj.first) assert_equal([1, 2, 3], @obj.first(3)) assert_nil(@empty.first) + assert_equal([], @empty.first(10)) bug5801 = '[ruby-dev:45041]' assert_in_out_err([], <<-'end;', [], /unexpected break/) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/