From 39be41cb21d41a1365003acb8d8af09be29edcee Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 4 Jul 2015 11:54:04 +0000 Subject: [PATCH] all?, any?, one?, none? of empty Enumerable git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_enum.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb index 0370508b71..7a6e15174f 100644 --- a/test/ruby/test_enum.rb +++ b/test/ruby/test_enum.rb @@ -238,6 +238,8 @@ class TestEnumerable < Test::Unit::TestCase assert_equal(false, @obj.all? {|x| x < 3 }) assert_equal(true, @obj.all?) assert_equal(false, [true, true, false].all?) + assert_equal(true, [].all?) + assert_equal(true, @empty.all?) end def test_any @@ -245,6 +247,8 @@ class TestEnumerable < Test::Unit::TestCase assert_equal(false, @obj.any? {|x| x > 3 }) assert_equal(true, @obj.any?) assert_equal(false, [false, false, false].any?) + assert_equal(false, [].any?) + assert_equal(false, @empty.any?) end def test_one @@ -256,6 +260,8 @@ class TestEnumerable < Test::Unit::TestCase assert(!(%w{ant bear cat}.one? {|word| word.length < 4})) assert(!([ nil, true, 99 ].one?)) assert([ nil, true, false ].one?) + assert(![].one?) + assert(!@empty.one?) end def test_none @@ -268,6 +274,7 @@ class TestEnumerable < Test::Unit::TestCase assert([nil].none?) assert([nil,false].none?) assert(![nil,false,true].none?) + assert(@empty.none?) end def test_min