diff options
author | Benoit Daloze <eregontp@gmail.com> | 2022-07-27 17:18:25 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2022-07-27 17:18:25 +0200 |
commit | 6582df26dcdef5dab01242b4d97d9b242e959860 (patch) | |
tree | 99824a5c370ef27acd12905b67304870f1af9561 /spec/ruby/core/enumerator | |
parent | 44f42413e6c3c2b487a03b53bf6cacbb83ac285b (diff) | |
download | ruby-6582df26dcdef5dab01242b4d97d9b242e959860.tar.gz |
Update to ruby/spec@cbfaf51
Diffstat (limited to 'spec/ruby/core/enumerator')
-rw-r--r-- | spec/ruby/core/enumerator/lazy/lazy_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/ruby/core/enumerator/lazy/lazy_spec.rb b/spec/ruby/core/enumerator/lazy/lazy_spec.rb index cde9b31066..683dfb81d7 100644 --- a/spec/ruby/core/enumerator/lazy/lazy_spec.rb +++ b/spec/ruby/core/enumerator/lazy/lazy_spec.rb @@ -16,6 +16,10 @@ describe "Enumerator::Lazy" do ] lazy_methods += [:chunk_while, :uniq] + ruby_version_is '3.1' do + lazy_methods += [:compact] + end + Enumerator::Lazy.instance_methods(false).should include(*lazy_methods) end end @@ -26,3 +30,13 @@ describe "Enumerator::Lazy#lazy" do lazy.lazy.should equal(lazy) end end + +ruby_version_is '3.1' do + describe "Enumerator::Lazy#compact" do + it 'returns array without nil elements' do + arr = [1, nil, 3, false, 5].to_enum.lazy.compact + arr.should be_an_instance_of(Enumerator::Lazy) + arr.force.should == [1, 3, false, 5] + end + end +end |