#363 ✓resolved
Jox

extlib specs fail

Reported by Jox | June 10th, 2008 @ 12:02 PM

The following specs fail on my system for extlib.


ruby -v
ruby 1.8.7 (2008-05-31 patchlevel 0) [i486-linux]

1)
ArgumentError in 'LazyArray should return self'
wrong number of arguments (2 for 1)
/usr/src/dm/extlib/lib/extlib/lazy_array.rb:20:in `respond_to?'
/usr/src/dm/extlib/lib/extlib/lazy_array.rb:20:in `concat'
/usr/src/dm/extlib/lib/extlib/lazy_array.rb:20:in `concat'
./spec/lazy_array_spec.rb:86:

2)
ArgumentError in 'LazyArray should concatenate another lazy array with #concat'
wrong number of arguments (2 for 1)
/usr/src/dm/extlib/lib/extlib/lazy_array.rb:20:in `respond_to?'
/usr/src/dm/extlib/lib/extlib/lazy_array.rb:20:in `concat'
/usr/src/dm/extlib/lib/extlib/lazy_array.rb:20:in `concat'
./spec/lazy_array_spec.rb:90:

3)
ArgumentError in 'LazyArray should return self'
wrong number of arguments (2 for 1)
/usr/src/dm/extlib/lib/extlib/lazy_array.rb:44:in `respond_to?'
/usr/src/dm/extlib/lib/extlib/lazy_array.rb:44:in `replace'
/usr/src/dm/extlib/lib/extlib/lazy_array.rb:44:in `replace'
./spec/lazy_array_spec.rb:414:

4)
ArgumentError in 'LazyArray should replace itself with the other object'
wrong number of arguments (2 for 1)
/usr/src/dm/extlib/lib/extlib/lazy_array.rb:44:in `respond_to?'
/usr/src/dm/extlib/lib/extlib/lazy_array.rb:44:in `replace'
/usr/src/dm/extlib/lib/extlib/lazy_array.rb:44:in `replace'
./spec/lazy_array_spec.rb:418:

5)
ArgumentError in 'LazyArray should be loaded afterwards'
wrong number of arguments (2 for 1)
/usr/src/dm/extlib/lib/extlib/lazy_array.rb:44:in `respond_to?'
/usr/src/dm/extlib/lib/extlib/lazy_array.rb:44:in `replace'
/usr/src/dm/extlib/lib/extlib/lazy_array.rb:44:in `replace'
./spec/lazy_array_spec.rb:426:

I provided a patch that fixes the problem. A call other.to_a fixes the problem.

The culprit:


  def replace(other)
    mark_loaded
    @array.replace(other)
    self
  end

becomes


  def replace(other)
    mark_loaded
    @array.replace(other.to_a)
    self
  end

I have no idea what happens here. Any ideas?

Comments and changes to this ticket

  • Sam Smoot

    Sam Smoot June 10th, 2008 @ 12:27 PM

    • State changed from “new” to “resolved”

    Weird that the specs don't fail on 1.8.6.

    Anyways, resolved (84cb21d). Used #entries instead of #to_a since #entries is an Enumerable method.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Attachments

Tags

Pages