1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

array.c, enum.c: TypeError in zip

* array.c (take_items), enum.c (enum_zip): raise TypeError at
  non-enumerable objects, not NoMethodError.  [ruby-dev:46145]
  [Bug #7038]
* vm_eval.c (rb_check_block_call): check_funcall variant with block
  function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-09-19 15:42:26 +00:00
parent b70f99d15f
commit abeedb0875
7 changed files with 37 additions and 3 deletions

View file

@ -277,7 +277,7 @@ class TestEnumerable < Test::Unit::TestCase
ary = Object.new
def ary.to_a; [1, 2]; end
assert_raise(NoMethodError){ %w(a b).zip(ary) }
assert_raise(TypeError, NoMethodError) {%w(a b).zip(ary)}
def ary.each; [3, 4].each{|e|yield e}; end
assert_equal([[1, 3], [2, 4], [3, nil], [1, nil], [2, nil]], @obj.zip(ary))
def ary.to_ary; [5, 6]; end