Should raise TypeError instead of NoMethodError
MODIFY
mrbgems/mruby-enum-ext/mrblib/enum.rb
mrbgems/mruby-enum-ext/mrblib/enum.rb
@@ -768,7 +768,12 @@ module Enumerable
def zip(*arg, &block)
result = block ? nil : []
- arg = arg.map{|a|a.to_a}
+ arg = arg.map do |a|
+ unless a.respond_to?(:to_a)
+ raise TypeError, "wrong argument type #{a.class} (must respond to :to_a)"
+ end
+ a.to_a
+ end
i = 0
self.each do |*val|

MODIFY
mrbgems/mruby-enum-ext/test/enum.rb
mrbgems/mruby-enum-ext/test/enum.rb
@@ -170,6 +170,8 @@ assert("Enumerable#zip") do
ret = []
assert_equal nil, a.zip([1, 2], [8]) { |i| ret << i }
assert_equal [[4, 1, 8], [5, 2, nil], [6, nil, nil]], ret
+
+ assert_raise(TypeError) { [1].zip(1) }
end
assert("Enumerable#to_h") do

Should raise TypeError instead of NoMethodError