Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
b1c8fad9
Unverified
Commit
b1c8fad9
authored
Mar 27, 2018
by
ksss
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Should raise TypeError instead of NoMethodError
parent
5a7ce01f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
mrbgems/mruby-enum-ext/mrblib/enum.rb
mrbgems/mruby-enum-ext/mrblib/enum.rb
+6
-1
mrbgems/mruby-enum-ext/test/enum.rb
mrbgems/mruby-enum-ext/test/enum.rb
+2
-0
No files found.
mrbgems/mruby-enum-ext/mrblib/enum.rb
View file @
b1c8fad9
...
...
@@ -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
|
...
...
mrbgems/mruby-enum-ext/test/enum.rb
View file @
b1c8fad9
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment