aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_enum.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb
index 532d1b965a..d9b8166f2e 100644
--- a/test/ruby/test_enum.rb
+++ b/test/ruby/test_enum.rb
@@ -348,6 +348,14 @@ class TestEnumerable < Test::Unit::TestCase
ary.clear
(1..10).each_slice(3, &lambda {|a, *| ary << a})
assert_equal([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]], ary, bug9749)
+
+ ary.clear
+ (1..10).each_slice(10) {|a| ary << a}
+ assert_equal([[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]], ary)
+
+ ary.clear
+ (1..10).each_slice(11) {|a| ary << a}
+ assert_equal([[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]], ary)
end
def test_each_cons
@@ -359,6 +367,14 @@ class TestEnumerable < Test::Unit::TestCase
ary.clear
(1..5).each_cons(3, &lambda {|a, *| ary << a})
assert_equal([[1, 2, 3], [2, 3, 4], [3, 4, 5]], ary, bug9749)
+
+ ary.clear
+ (1..5).each_cons(5) {|a| ary << a}
+ assert_equal([[1, 2, 3, 4, 5]], ary)
+
+ ary.clear
+ (1..5).each_cons(6) {|a| ary << a}
+ assert_empty(ary)
end
def test_zip