From d2164fc5f2c8d32aaa9a857ca680c8f6d05ed106 Mon Sep 17 00:00:00 2001 From: naruse Date: Sat, 22 Feb 2014 09:24:49 +0000 Subject: merge revision(s) 45057,45059: [Backport #9533] * hash.c (rb_hash_flatten): fix behavior of flatten(-1). [ruby-dev:47988] [Bug #9533] * test/ruby/test_array.rb: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@45126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_hash.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/ruby') diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index c872b11a3c..800241a703 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -973,11 +973,11 @@ class TestHash < Test::Unit::TestCase a = @cls[1=> "one", 2 => [2,"two"], 3 => [3, ["three"]]] assert_equal([1, "one", 2, [2, "two"], 3, [3, ["three"]]], a.flatten) - assert_equal([1, "one", 2, [2, "two"], 3, [3, ["three"]]], a.flatten(-1)) - assert_equal([1, "one", 2, [2, "two"], 3, [3, ["three"]]], a.flatten(0)) + assert_equal([[1, "one"], [2, [2, "two"]], [3, [3, ["three"]]]], a.flatten(0)) assert_equal([1, "one", 2, [2, "two"], 3, [3, ["three"]]], a.flatten(1)) assert_equal([1, "one", 2, 2, "two", 3, 3, ["three"]], a.flatten(2)) assert_equal([1, "one", 2, 2, "two", 3, 3, "three"], a.flatten(3)) + assert_equal([1, "one", 2, 2, "two", 3, 3, "three"], a.flatten(-1)) assert_raise(TypeError){ a.flatten(Object) } end -- cgit v1.2.3