diff options
author | Jeremy Evans <code@jeremyevans.net> | 2019-09-01 22:35:38 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2019-09-01 22:35:38 -0700 |
commit | 6724b1f83d2cad57bbcbcdc9756532d825b0c592 (patch) | |
tree | 75f2dddb72d9497c0e4f499e56b1aa35b2e9200b /test/ruby/test_lazy_enumerator.rb | |
parent | c69545ae32a5ddf928e8992a0d2cf39648c2b555 (diff) |
Revert "Make Enumerator::Lazy#with_index be lazy"
This reverts commit 83498854eb5a824f1f83c31fac18c9279f9ee10d.
This didn't pass rubyspec.
Diffstat (limited to 'test/ruby/test_lazy_enumerator.rb')
-rw-r--r-- | test/ruby/test_lazy_enumerator.rb | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/test/ruby/test_lazy_enumerator.rb b/test/ruby/test_lazy_enumerator.rb index 80977a0bbd..e76a53e650 100644 --- a/test/ruby/test_lazy_enumerator.rb +++ b/test/ruby/test_lazy_enumerator.rb @@ -587,26 +587,4 @@ EOS assert_equal([4, 6, 6, 4, 0, 4], e.first(6)) assert_equal([4, 6, 6, 4, 0, 4], e.first(6)) end - - def test_with_index - feature7877 = '[ruby-dev:47025] [Feature #7877]' - leibniz = ->(n) { - (0..Float::INFINITY).lazy.with_index {|i, j| - raise IndexError, "limit exceeded (#{n})" unless j < n - ((-1) ** j) / (2*i+1).to_f - }.take(n).reduce(:+) - } - assert_nothing_raised(IndexError, feature7877) { - assert_in_epsilon(Math::PI/4, leibniz[1000]) - } - - ary = (0..Float::INFINITY).lazy.with_index(2) {|i, j| [i-1, j] }.take(2).to_a - assert_equal([[-1, 2], [0, 3]], ary) - - ary = (0..Float::INFINITY).lazy.with_index(2).take(2).to_a - assert_equal([[0, 2], [1, 3]], ary) - - ary = (0..Float::INFINITY).lazy.with_index.take(2).to_a - assert_equal([[0, 0], [1, 1]], ary) - end end |