Bug #1024

Array#zip does not convert arguments to arrays

Added by Brian Shirai about 6 years ago. Updated almost 4 years ago.

[ruby-core:21442]
Status:Closed
Priority:Normal
Assignee:-
ruby -v: Backport:

Description

=begin
The RDoc for Array#zip states that it "Converts any arguments to arrays...", however it does not appear to do so.

euler:rubyspec brian$ cat array_zip.rb
ary = Object.new

def ary.to_a; [1, 2]; end
def ary.to_ary; [3, 4]; end

p [5, 6].zip(ary)

euler:rubyspec brian$ multiruby -vw array_zip.rb

VERSION = mri_1_9
CMD = ~/.multiruby/install/mri_1_9/bin/ruby -vw array_zip.rb

ruby 1.9.1p5000 (2009-01-20 trunk 21676) [i386-darwin9.6.0]
array_zip.rb:6:in zip': undefined methodeach' for #Object:0x3d6be8 (NoMethodError)
from array_zip.rb:6:in `'

RESULT = 256

VERSION = mri_rel_1_8_6
CMD = ~/.multiruby/install/mri_rel_1_8_6/bin/ruby -vw array_zip.rb

ruby 1.8.6 (2009-01-19 patchlevel 303) [i686-darwin9.6.0]
[[5, 3], [6, 4]]

RESULT = 0

VERSION = mri_rel_1_8_7
CMD = ~/.multiruby/install/mri_rel_1_8_7/bin/ruby -vw array_zip.rb

ruby 1.8.7 (2009-01-19 patchlevel 89) [i686-darwin9.6.0]
[[5, 3], [6, 4]]

RESULT = 0

VERSION = 1.8.6-p114
CMD = ~/.multiruby/install/1.8.6-p114/bin/ruby -vw array_zip.rb

ruby 1.8.6 (2008-03-03 patchlevel 114) [i686-darwin9.5.0]
[[5, 3], [6, 4]]

RESULT = 0

TOTAL RESULT = 1 failures out of 4

Passed: mri_rel_1_8_6, mri_rel_1_8_7, 1.8.6-p114
Failed: mri_1_9
=end

History

#1 Updated by Nobuyoshi Nakada about 6 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r21678.
=end

Also available in: Atom PDF