From bd5d443a56ee4bcb59a0a08776c07dea3ee60121 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 31 Dec 2015 23:53:04 +0000 Subject: [PATCH] Add test for Enumerator::Lazy#take * test/ruby/test_lazy_enumerator.rb (test_take_bad_arg): Add test code in case of Enumerator::Lazy#take called with negative number. [ruby-dev:49467] [Bug #11933] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ test/ruby/test_lazy_enumerator.rb | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index bce027f63e..a6084e9ffd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri Jan 1 08:53:02 2016 Yuki Kurihara + + * test/ruby/test_lazy_enumerator.rb (test_take_bad_arg): Add test + code in case of Enumerator::Lazy#take called with negative number. + [ruby-dev:49467] [Bug #11933] + Fri Jan 1 05:06:20 2016 Nobuyoshi Nakada * parse.y (parser_here_document): update indent for each line in diff --git a/test/ruby/test_lazy_enumerator.rb b/test/ruby/test_lazy_enumerator.rb index 5feddd5bde..792a95bb7e 100644 --- a/test/ruby/test_lazy_enumerator.rb +++ b/test/ruby/test_lazy_enumerator.rb @@ -275,6 +275,11 @@ class TestLazyEnumerator < Test::Unit::TestCase assert_equal(nil, a.current) end + def test_take_bad_arg + a = Step.new(1..10) + assert_raise(ArgumentError) { a.lazy.take(-1) } + end + def test_take_recycle bug6428 = '[ruby-dev:45634]' a = Step.new(1..10)