public void Scenario_RubyBlockArgs5() {
TestOutput(@"
c1 = class C1
define_method('[]=') { |a| }
new
end
c2 = class C2
define_method('[]=') { |a,b| p [a,b] }
new
end
c3 = class C3
define_method('[]=') { |a,b,c| p [a,b,c] }
new
end
c4 = class C4
define_method('[]=') { |a,b,c,d| p [a,b,c,d] }
new
end
c5 = class C5
define_method('[]=') { |a,b,c,d,e| p [a,b,c,d,e] }
new
end
c6 = class C6
define_method('[]=') { |a,*b| p [a,b] }
new
end
#(c1[1] = 2) rescue p $! # TODO: raise exception
#(c1[1,*[]] = 2) rescue p $! # TODO: raise exception
#(c2[1,2] = 3) rescue p $! # TODO: raise exception
#(c2[*[1,2]] = 3) rescue p $! # TODO: raise exception
c3[1,2,*[]] = 3
c4[1,*[2,3]] = 4
c5[1,2,*[3,4]] = 5
c6[1,2] = 3
c6[1,*[2,3,4,5,6]] = 7
",
// #<ArgumentError: wrong number of arguments (2 for 1)>
// #<ArgumentError: wrong number of arguments (2 for 1)>
// #<ArgumentError: wrong number of arguments (3 for 2)>
// #<ArgumentError: wrong number of arguments (3 for 2)>
@"
[1, 2, 3]
[1, 2, 3, 4]
[1, 2, 3, 4, 5]
[1, [2, 3]]
[1, [2, 3, 4, 5, 6, 7]]
");
}