mirror of
https://github.com/ruby/ruby.git
synced 2025-08-25 22:14:37 +02:00
Add Enumerable#compact and Enumerator::Lazy#compact
This commit is contained in:
parent
f690eb34e2
commit
b8d33df1d9
Notes:
git
2021-01-02 17:27:50 +09:00
4 changed files with 88 additions and 0 deletions
|
@ -696,6 +696,11 @@ class TestEnumerator < Test::Unit::TestCase
|
|||
assert_equal([0, 1], u.force)
|
||||
end
|
||||
|
||||
def test_compact
|
||||
u = [0, 1, nil, 2, 3, nil].to_enum.lazy.compact
|
||||
assert_equal([0, 1, 2, 3], u.force)
|
||||
end
|
||||
|
||||
def test_enum_chain_and_plus
|
||||
r = 1..5
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue