Commit b6cc3aca authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #1605 from suzukaze/test-array

Fix ISO no in Array#* and Array#+
parents 4b82cadf 853e26e1
......@@ -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 */
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment