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
b6cc3aca
Commit
b6cc3aca
authored
Dec 07, 2013
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1605 from suzukaze/test-array
Fix ISO no in Array#* and Array#+
parents
4b82cadf
853e26e1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
src/array.c
src/array.c
+2
-2
test/t/array.rb
test/t/array.rb
+5
-5
No files found.
src/array.c
View file @
b6cc3aca
...
...
@@ -1124,8 +1124,8 @@ mrb_init_array(mrb_state *mrb)
mrb_define_class_method
(
mrb
,
a
,
"[]"
,
mrb_ary_s_create
,
MRB_ARGS_ANY
());
/* 15.2.12.4.1 */
mrb_define_method
(
mrb
,
a
,
"
*"
,
mrb_ary_times
,
MRB_ARGS_REQ
(
1
));
/* 15.2.12.5.1 */
mrb_define_method
(
mrb
,
a
,
"
+"
,
mrb_ary_plus
,
MRB_ARGS_REQ
(
1
));
/* 15.2.12.5.2 */
mrb_define_method
(
mrb
,
a
,
"
+"
,
mrb_ary_plus
,
MRB_ARGS_REQ
(
1
));
/* 15.2.12.5.1 */
mrb_define_method
(
mrb
,
a
,
"
*"
,
mrb_ary_times
,
MRB_ARGS_REQ
(
1
));
/* 15.2.12.5.2 */
mrb_define_method
(
mrb
,
a
,
"<<"
,
mrb_ary_push_m
,
MRB_ARGS_REQ
(
1
));
/* 15.2.12.5.3 */
mrb_define_method
(
mrb
,
a
,
"[]"
,
mrb_ary_aget
,
MRB_ARGS_ANY
());
/* 15.2.12.5.4 */
mrb_define_method
(
mrb
,
a
,
"[]="
,
mrb_ary_aset
,
MRB_ARGS_ANY
());
/* 15.2.12.5.5 */
...
...
test/t/array.rb
View file @
b6cc3aca
...
...
@@ -17,7 +17,11 @@ assert('Array.[]', '15.2.12.4.1') do
assert_equal
([
1
,
2
,
3
],
Array
.
[
](
1
,
2
,
3
))
end
assert
(
'Array#*'
,
'15.2.12.5.1'
)
do
assert
(
'Array#+'
,
'15.2.12.5.1'
)
do
assert_equal
([
1
,
1
],
[
1
].
+
([
1
]))
end
assert
(
'Array#*'
,
'15.2.12.5.2'
)
do
assert_raise
(
ArgumentError
)
do
# this will cause an exception due to the wrong argument
[
1
].
*
(
-
1
)
...
...
@@ -26,10 +30,6 @@ assert('Array#*', '15.2.12.5.1') do
assert_equal
([],
[
1
].
*
(
0
))
end
assert
(
'Array#+'
,
'15.2.12.5.2'
)
do
assert_equal
([
1
,
1
],
[
1
].
+
([
1
]))
end
assert
(
'Array#<<'
,
'15.2.12.5.3'
)
do
assert_equal
([
1
,
1
],
[
1
].
<
<
(
1
))
end
...
...
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