mirror of
https://github.com/ruby/ruby.git
synced 2025-08-26 06:25:31 +02:00
* enumerator.c (enumerator_initialize): Warn when using deprecated form
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ac7f5157ac
commit
c73b6bd7eb
2 changed files with 5 additions and 1 deletions
|
@ -57,7 +57,10 @@ class TestEnumerator < Test::Unit::TestCase
|
|||
|
||||
def test_initialize
|
||||
assert_equal([1, 2, 3], @obj.to_enum(:foo, 1, 2, 3).to_a)
|
||||
assert_equal([1, 2, 3], Enumerator.new(@obj, :foo, 1, 2, 3).to_a)
|
||||
_, err = capture_io do
|
||||
assert_equal([1, 2, 3], Enumerator.new(@obj, :foo, 1, 2, 3).to_a)
|
||||
end
|
||||
assert_match 'Enumerator.new without a block is deprecated', err
|
||||
assert_equal([1, 2, 3], Enumerator.new { |y| i = 0; loop { y << (i += 1) } }.take(3))
|
||||
assert_raise(ArgumentError) { Enumerator.new }
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue