diff options
author | Benoit Daloze <eregontp@gmail.com> | 2020-05-02 16:03:14 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2020-05-02 16:03:14 +0200 |
commit | c9213aa864fb8527388679c21f1ea8ce129e2f1a (patch) | |
tree | a6ef2403c73ef61a2aaddad6c0f8d9d09e4e6151 /spec/ruby/core/enumerator | |
parent | a68ddf42879005905176bc38285906fe01707aff (diff) | |
download | ruby-c9213aa864fb8527388679c21f1ea8ce129e2f1a.tar.gz |
Update to ruby/spec@d394dfd
Diffstat (limited to 'spec/ruby/core/enumerator')
-rw-r--r-- | spec/ruby/core/enumerator/next_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/ruby/core/enumerator/next_spec.rb b/spec/ruby/core/enumerator/next_spec.rb index 3e9ed8b015..a5e01a399d 100644 --- a/spec/ruby/core/enumerator/next_spec.rb +++ b/spec/ruby/core/enumerator/next_spec.rb @@ -24,4 +24,15 @@ describe "Enumerator#next" do @enum.rewind @enum.next.should == 1 end + + it "restarts the enumerator if an exception terminated a previous iteration" do + exception = StandardError.new + enum = Enumerator.new do + raise exception + end + + result = 2.times.map { enum.next rescue $! } + + result.should == [exception, exception] + end end |