Add Enumerable#compact and Enumerator::Lazy#compact

This commit is contained in:
zverok 2020-12-05 13:39:20 +02:00 committed by Nobuyoshi Nakada
parent f690eb34e2
commit b8d33df1d9
Notes: git 2021-01-02 17:27:50 +09:00
4 changed files with 88 additions and 0 deletions

View file

@ -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