2 assert_equal '1', 'def m() 1 end; m()'
3 assert_equal '1', 'def m(a) a end; m(1)'
4 assert_equal '[1, 2]', 'def m(a,b) [a, b] end; m(1,2)'
5 assert_equal '[1, 2, 3]', 'def m(a,b,c) [a, b, c] end; m(1,2,3)'
6 assert_equal 'wrong number of arguments (1 for 0)', %q{
15 assert_equal 'wrong number of arguments (0 for 1)', %q{
25 assert_equal '1', 'def m(x=1) x end; m()'
26 assert_equal '1', 'def m(x=7) x end; m(1)'
27 assert_equal '1', 'def m(a,x=1) x end; m(7)'
28 assert_equal '1', 'def m(a,x=7) x end; m(7,1)'
29 assert_equal '1', 'def m(a,b,x=1) x end; m(7,7)'
30 assert_equal '1', 'def m(a,b,x=7) x end; m(7,7,1)'
31 assert_equal '1', 'def m(a,x=1,y=1) x end; m(7)'
32 assert_equal '1', 'def m(a,x=1,y=1) y end; m(7)'
33 assert_equal '1', 'def m(a,x=7,y=1) x end; m(7,1)'
34 assert_equal '1', 'def m(a,x=7,y=1) y end; m(7,1)'
35 assert_equal '1', 'def m(a,x=7,y=7) x end; m(7,1,1)'
36 assert_equal '1', 'def m(a,x=7,y=7) y end; m(7,1,1)'
39 assert_equal '[]', 'def m(*a) a end; m().inspect'
40 assert_equal '[1]', 'def m(*a) a end; m(1).inspect'
41 assert_equal '[1, 2]', 'def m(*a) a end; m(1,2).inspect'
42 assert_equal '[]', 'def m(x,*a) a end; m(7).inspect'
43 assert_equal '[1]', 'def m(x,*a) a end; m(7,1).inspect'
44 assert_equal '[1, 2]', 'def m(x,*a) a end; m(7,1,2).inspect'
45 assert_equal '[]', 'def m(x,y,*a) a end; m(7,7).inspect'
46 assert_equal '[1]', 'def m(x,y,*a) a end; m(7,7,1).inspect'
47 assert_equal '[1, 2]', 'def m(x,y,*a) a end; m(7,7,1,2).inspect'
48 assert_equal '[]', 'def m(x,y=7,*a) a end; m(7).inspect'
49 assert_equal '[]', 'def m(x,y,z=7,*a) a end; m(7,7).inspect'
50 assert_equal '[]', 'def m(x,y,z=7,*a) a end; m(7,7,7).inspect'
51 assert_equal '[]', 'def m(x,y,z=7,zz=7,*a) a end; m(7,7,7).inspect'
52 assert_equal '[]', 'def m(x,y,z=7,zz=7,*a) a end; m(7,7,7,7).inspect'
53 assert_equal '1', 'def m(x,y,z=7,zz=1,*a) zz end; m(7,7,7).inspect'
54 assert_equal '1', 'def m(x,y,z=7,zz=1,*a) zz end; m(7,7,7).inspect'
55 assert_equal '1', 'def m(x,y,z=7,zz=7,*a) zz end; m(7,7,7,1).inspect'
58 assert_equal 'Proc', 'def m(&block) block end; m{}.class'
59 assert_equal 'nil', 'def m(&block) block end; m().inspect'
60 assert_equal 'Proc', 'def m(a,&block) block end; m(7){}.class'
61 assert_equal 'nil', 'def m(a,&block) block end; m(7).inspect'
62 assert_equal '1', 'def m(a,&block) a end; m(1){}'
63 assert_equal 'Proc', 'def m(a,b=nil,&block) block end; m(7){}.class'
64 assert_equal 'nil', 'def m(a,b=nil,&block) block end; m(7).inspect'
65 assert_equal 'Proc', 'def m(a,b=nil,&block) block end; m(7,7){}.class'
66 assert_equal '1', 'def m(a,b=nil,&block) b end; m(7,1){}'
67 assert_equal 'Proc', 'def m(a,b=nil,*c,&block) block end; m(7){}.class'
68 assert_equal 'nil', 'def m(a,b=nil,*c,&block) block end; m(7).inspect'
69 assert_equal '1', 'def m(a,b=nil,*c,&block) a end; m(1).inspect'
70 assert_equal '1', 'def m(a,b=1,*c,&block) b end; m(7).inspect'
71 assert_equal '1', 'def m(a,b=7,*c,&block) b end; m(7,1).inspect'
72 assert_equal '[1]', 'def m(a,b=7,*c,&block) c end; m(7,7,1).inspect'
75 assert_equal '1', 'def m(a) a end; m(*[1])'
76 assert_equal '1', 'def m(x,a) a end; m(7,*[1])'
77 assert_equal '1', 'def m(x,y,a) a end; m(7,7,*[1])'
78 assert_equal '1', 'def m(a,b) a end; m(*[1,7])'
79 assert_equal '1', 'def m(a,b) b end; m(*[7,1])'
80 assert_equal '1', 'def m(x,a,b) b end; m(7,*[7,1])'
81 assert_equal '1', 'def m(x,y,a,b) b end; m(7,7,*[7,1])'
82 assert_equal '1', 'def m(a,b,c) a end; m(*[1,7,7])'
83 assert_equal '1', 'def m(a,b,c) b end; m(*[7,1,7])'
84 assert_equal '1', 'def m(a,b,c) c end; m(*[7,7,1])'
85 assert_equal '1', 'def m(x,a,b,c) a end; m(7,*[1,7,7])'
86 assert_equal '1', 'def m(x,y,a,b,c) a end; m(7,7,*[1,7,7])'
89 assert_equal '1', 'def m(h) h end; m(7=>1)[7]'
90 assert_equal '1', 'def m(h) h end; m(7=>1).size'
91 assert_equal '1', 'def m(h) h end; m(7=>1, 8=>7)[7]'
92 assert_equal '2', 'def m(h) h end; m(7=>1, 8=>7).size'
93 assert_equal '1', 'def m(h) h end; m(7=>1, 8=>7, 9=>7)[7]'
94 assert_equal '3', 'def m(h) h end; m(7=>1, 8=>7, 9=>7).size'
95 assert_equal '1', 'def m(x,h) h end; m(7, 7=>1)[7]'
96 assert_equal '1', 'def m(x,h) h end; m(7, 7=>1, 8=>7)[7]'
97 assert_equal '1', 'def m(x,h) h end; m(7, 7=>1, 8=>7, 9=>7)[7]'
98 assert_equal '1', 'def m(x,y,h) h end; m(7,7, 7=>1)[7]'
99 assert_equal '1', 'def m(x,y,h) h end; m(7,7, 7=>1, 8=>7)[7]'
100 assert_equal '1', 'def m(x,y,h) h end; m(7,7, 7=>1, 8=>7, 9=>7)[7]'
103 assert_equal '1', %q(def m(&block) mm(&block) end
106 assert_equal '1', %q(def m(x,&block) mm(x,&block) end
107 def mm(x) yield 1 end
109 assert_equal '1', %q(def m(x,y,&block) mm(x,y,&block) end
110 def mm(x,y) yield 1 end
114 assert_equal '1', %q(def m(n) n == 0 ? 1 : m(n-1) end; m(5))
117 assert_equal '1', %q(class C; def m() 1 end end; C.new.m)
118 assert_equal '1', %q(class C; def m(a) a end end; C.new.m(1))
119 assert_equal '1', %q(class C; def m(a = 1) a end end; C.new.m)
120 assert_equal '[1]', %q(class C; def m(*a) a end end; C.new.m(1).inspect)
121 assert_equal '1', %q( class C
127 # singleton method (const)
128 assert_equal '1', %q(class C; def C.m() 1 end end; C.m)
129 assert_equal '1', %q(class C; def C.m(a) a end end; C.m(1))
130 assert_equal '1', %q(class C; def C.m(a = 1) a end end; C.m)
131 assert_equal '[1]', %q(class C; def C.m(*a) a end end; C.m(1).inspect)
132 assert_equal '1', %q(class C; end; def C.m() 1 end; C.m)
133 assert_equal '1', %q(class C; end; def C.m(a) a end; C.m(1))
134 assert_equal '1', %q(class C; end; def C.m(a = 1) a end; C.m)
135 assert_equal '[1]', %q(class C; end; def C.m(*a) a end; C.m(1).inspect)
136 assert_equal '1', %q(class C; def m() 7 end end; def C.m() 1 end; C.m)
137 assert_equal '1', %q( class C
143 # singleton method (lvar)
144 assert_equal '1', %q(obj = Object.new; def obj.m() 1 end; obj.m)
145 assert_equal '1', %q(obj = Object.new; def obj.m(a) a end; obj.m(1))
146 assert_equal '1', %q(obj = Object.new; def obj.m(a=1) a end; obj.m)
147 assert_equal '[1]', %q(obj = Object.new; def obj.m(*a) a end; obj.m(1))
148 assert_equal '1', %q(class C; def m() 7 end; end
154 assert_equal '1', %q(class A; def m(a) a end end
157 assert_equal '1', %q(class A; end
158 class B < A; def m(a) a end end
160 assert_equal '1', %q(class A; def m(a) a end end
166 assert_equal '1', %q(class A; def m(a) a end end
168 class B < A; include M; end
170 assert_equal '1', %q(class A; end
171 module M; def m(a) a end end
172 class B < A; include M; end
176 assert_equal '1', %q( def a() 1 end
179 assert_equal '1', %q( class C
184 assert_equal '1', %q( class C
189 assert_equal '1', %q( class C
194 assert_equal '1', %q( class C
199 assert_equal '1', %q( class C
207 assert_equal '1', %q( class C
211 begin C.new.m; rescue NoMethodError; 1 end )
212 assert_equal '1', %q( class A
219 begin C.new.m; rescue NoMethodError; 1 end )
220 assert_equal '1', %q( class A; def a() end end # [yarv-dev:999]
225 begin B.new.a; rescue NoMethodError; 1 end )
226 assert_equal '1', %q( class A; def a() end end # [yarv-dev:999]
231 begin B.new.b; rescue NoMethodError; 1 end )
233 assert_equal '3', %q{
240 }, '[ruby-dev:32308]'
241 assert_equal '1', %q{
246 }, '[ruby-dev:32308]'
247 assert_equal '1', %q{
251 alias :"bar#{:baz}" :"foo#{:bar}"
253 }, '[ruby-dev:32308]'
256 assert_equal '1', %q( class C
262 assert_equal '1', %q( class C
266 begin C.m; rescue NoMethodError; 1 end )
267 assert_equal '1', %q( class C
270 private_class_method :mm
273 assert_equal '1', %q( class C
275 private_class_method :m
277 begin C.m; rescue NoMethodError; 1 end )
278 assert_equal '1', %q( class C; def m() 1 end end
281 alias mm m; private :mm
284 begin C.new.mm; 7; rescue NoMethodError; 1 end )
287 assert_equal '1', %q( class C
294 assert_equal '1', %q( class C
299 instance_eval "C.new.m; C.new.mm" )
302 assert_equal ':m', %q( class C
303 def method_missing(mid, *args) mid end
306 assert_equal ':mm', %q( class C
307 def method_missing(mid, *args) mid end
310 assert_equal '[1, 2]', %q( class C
311 def method_missing(mid, *args) args end
313 C.new.m(1,2).inspect )
314 assert_equal '1', %q( class C
315 def method_missing(mid, *args) yield 1 end
318 assert_equal 'nil', %q( class C
319 def method_missing(mid, *args, &block) block end
324 assert_equal '1', %q( class C; def m() 1 end end;
326 assert_equal '1', %q( class C; def m() 1 end end;
328 assert_equal '1', %q( class C; def m(a) a end end;
330 assert_equal '1', %q( class C; def m(a,b) a end end;
332 assert_equal '1', %q( class C; def m(x,a=1) a end end;
334 assert_equal '1', %q( class C; def m(x,a=7) a end end;
336 assert_equal '[1, 2]', %q( class C; def m(*a) a end end;
337 C.new.send(:m,1,2).inspect )
338 assert_equal '1', %q( class C; def m() 7 end; private :m end
339 begin C.new.public_send(:m); rescue NoMethodError; 1 end )
340 assert_equal '1', %q( class C; def m() 1 end; private :m end
344 assert_equal '[[:ok1, :foo], [:ok2, :foo, :bar]]',
351 $ary << [yield, a, b]
356 C.new[:foo, &lambda{:ok1}]
357 C.new[:foo, &lambda{:ok2}] = :bar
362 assert_equal '[:ok1, [:ok2, 11]]', %q{
377 # splat and block arguments
378 assert_equal %q{[[[:x, :y, :z], NilClass], [[1, :x, :y, :z], NilClass], [[1, 2, :x, :y, :z], NilClass], [[:obj], NilClass], [[1, :obj], NilClass], [[1, 2, :obj], NilClass], [[], Proc], [[1], Proc], [[1, 2], Proc], [[], Proc], [[1], Proc], [[1, 2], Proc], [[:x, :y, :z], Proc], [[1, :x, :y, :z], Proc], [[1, 2, :x, :y, :z], Proc]]}, %q{
380 $result << [args, b.class]
406 assert_equal %q{[1, 2, :o1, :o2, [], 3, 4, NilClass, nil, nil]}, %q{
407 def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2, &b)
408 x, y = :x, :y if $foo
409 [m1, m2, o1, o2, r, p1, p2, b.class, x, y]
413 assert_equal %q{[1, 2, 3, :o2, [], 4, 5, NilClass, nil, nil]}, %q{
414 def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2, &b)
415 x, y = :x, :y if $foo
416 [m1, m2, o1, o2, r, p1, p2, b.class, x, y]
420 assert_equal %q{[1, 2, 3, 4, [], 5, 6, NilClass, nil, nil]}, %q{
421 def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2, &b)
422 x, y = :x, :y if $foo
423 [m1, m2, o1, o2, r, p1, p2, b.class, x, y]
425 ; m(1, 2, 3, 4, 5, 6)}
427 assert_equal %q{[1, 2, 3, 4, [5], 6, 7, NilClass, nil, nil]}, %q{
428 def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2, &b)
429 x, y = :x, :y if $foo
430 [m1, m2, o1, o2, r, p1, p2, b.class, x, y]
432 ; m(1, 2, 3, 4, 5, 6, 7)}
434 assert_equal %q{[1, 2, 3, 4, [5, 6], 7, 8, NilClass, nil, nil]}, %q{
435 def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2, &b)
436 x, y = :x, :y if $foo
437 [m1, m2, o1, o2, r, p1, p2, b.class, x, y]
439 ; m(1, 2, 3, 4, 5, 6, 7, 8)}
441 assert_equal %q{[1, 2, 3, 4, [5, 6, 7], 8, 9, NilClass, nil, nil]}, %q{
442 def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2, &b)
443 x, y = :x, :y if $foo
444 [m1, m2, o1, o2, r, p1, p2, b.class, x, y]
446 ; m(1, 2, 3, 4, 5, 6, 7, 8, 9)}
448 assert_equal %q{[1, 2, 3, 4, [5, 6, 7, 8], 9, 10, NilClass, nil, nil]}, %q{
449 def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2, &b)
450 x, y = :x, :y if $foo
451 [m1, m2, o1, o2, r, p1, p2, b.class, x, y]
453 ; m(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)}
455 assert_equal %q{[1, 2, 3, 4, [5, 6, 7, 8, 9], 10, 11, NilClass, nil, nil]}, %q{
456 def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2, &b)
457 x, y = :x, :y if $foo
458 [m1, m2, o1, o2, r, p1, p2, b.class, x, y]
460 ; m(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)}
462 assert_equal %q{[1, 2, :o1, :o2, [], 3, 4, Proc, nil, nil]}, %q{
463 def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2, &b)
464 x, y = :x, :y if $foo
465 [m1, m2, o1, o2, r, p1, p2, b.class, x, y]
469 assert_equal %q{[1, 2, 3, :o2, [], 4, 5, Proc, nil, nil]}, %q{
470 def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2, &b)
471 x, y = :x, :y if $foo
472 [m1, m2, o1, o2, r, p1, p2, b.class, x, y]
474 ; m(1, 2, 3, 4, 5){}}
476 assert_equal %q{[1, 2, 3, 4, [], 5, 6, Proc, nil, nil]}, %q{
477 def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2, &b)
478 x, y = :x, :y if $foo
479 [m1, m2, o1, o2, r, p1, p2, b.class, x, y]
481 ; m(1, 2, 3, 4, 5, 6){}}
483 assert_equal %q{[1, 2, 3, 4, [5], 6, 7, Proc, nil, nil]}, %q{
484 def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2, &b)
485 x, y = :x, :y if $foo
486 [m1, m2, o1, o2, r, p1, p2, b.class, x, y]
488 ; m(1, 2, 3, 4, 5, 6, 7){}}
490 assert_equal %q{[1, 2, 3, 4, [5, 6], 7, 8, Proc, nil, nil]}, %q{
491 def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2, &b)
492 x, y = :x, :y if $foo
493 [m1, m2, o1, o2, r, p1, p2, b.class, x, y]
495 ; m(1, 2, 3, 4, 5, 6, 7, 8){}}
497 assert_equal %q{[1, 2, 3, 4, [5, 6, 7], 8, 9, Proc, nil, nil]}, %q{
498 def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2, &b)
499 x, y = :x, :y if $foo
500 [m1, m2, o1, o2, r, p1, p2, b.class, x, y]
502 ; m(1, 2, 3, 4, 5, 6, 7, 8, 9){}}
504 assert_equal %q{[1, 2, 3, 4, [5, 6, 7, 8], 9, 10, Proc, nil, nil]}, %q{
505 def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2, &b)
506 x, y = :x, :y if $foo
507 [m1, m2, o1, o2, r, p1, p2, b.class, x, y]
509 ; m(1, 2, 3, 4, 5, 6, 7, 8, 9, 10){}}
511 assert_equal %q{[1, 2, 3, 4, [5, 6, 7, 8, 9], 10, 11, Proc, nil, nil]}, %q{
512 def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2, &b)
513 x, y = :x, :y if $foo
514 [m1, m2, o1, o2, r, p1, p2, b.class, x, y]
516 ; m(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11){}}
518 assert_equal %q{[1, 2, :o1, :o2, [], 3, 4, nil, nil]}, %q{
519 def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2)
520 x, y = :x, :y if $foo
521 [m1, m2, o1, o2, r, p1, p2, x, y]
525 assert_equal %q{[1, 2, 3, :o2, [], 4, 5, nil, nil]}, %q{
526 def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2)
527 x, y = :x, :y if $foo
528 [m1, m2, o1, o2, r, p1, p2, x, y]
532 assert_equal %q{[1, 2, 3, 4, [], 5, 6, nil, nil]}, %q{
533 def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2)
534 x, y = :x, :y if $foo
535 [m1, m2, o1, o2, r, p1, p2, x, y]
537 ; m(1, 2, 3, 4, 5, 6)}
544 # below programs are generated by this program:
547 class C0; def m *args; [:C0_m, args]; end; end
548 class C1 < C0; <TEST>; super; end; end
617 def m a, o=:o, *r, &b
626 C1.new.m(1, 2, 3, 4){}
629 "def m(m1, m2, o1=:o1, o2=:o2, p1, p2)" =>
633 C1.new.m(1,2,3,4,5,6)
636 "def m(m1, m2, *r, p1, p2)" =>
640 C1.new.m(1,2,3,4,5,6)
641 C1.new.m(1,2,3,4,5,6,7)
642 C1.new.m(1,2,3,4,5,6,7,8)
645 "def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2)" =>
649 C1.new.m(1,2,3,4,5,6)
650 C1.new.m(1,2,3,4,5,6,7)
651 C1.new.m(1,2,3,4,5,6,7,8)
652 C1.new.m(1,2,3,4,5,6,7,8,9)
659 tests.each{|setup, methods| setup = setup.dup; setup.strip!
660 setup = BASE.gsub(/<TEST>/){setup}
661 methods.split(/\n/).each{|m| m = m.dup; m.strip!
663 expr = "#{setup}; #{m}"
665 puts "assert_equal %q{#{result.inspect}}, %q{\n#{expr}}"
672 assert_equal %q{[:C0_m, [1, 2, :o1, :o2, 3, 4]]}, %q{
673 class C0; def m *args; [:C0_m, args]; end; end
674 class C1 < C0; def m(m1, m2, o1=:o1, o2=:o2, p1, p2); super; end; end
677 assert_equal %q{[:C0_m, [1, 2, 3, :o2, 4, 5]]}, %q{
678 class C0; def m *args; [:C0_m, args]; end; end
679 class C1 < C0; def m(m1, m2, o1=:o1, o2=:o2, p1, p2); super; end; end
680 ; C1.new.m(1,2,3,4,5)}
682 assert_equal %q{[:C0_m, [1, 2, 3, 4, 5, 6]]}, %q{
683 class C0; def m *args; [:C0_m, args]; end; end
684 class C1 < C0; def m(m1, m2, o1=:o1, o2=:o2, p1, p2); super; end; end
685 ; C1.new.m(1,2,3,4,5,6)}
687 assert_equal %q{[:C0_m, [1, :o]]}, %q{
688 class C0; def m *args; [:C0_m, args]; end; end
689 class C1 < C0; def m a, o=:o, *r; super; end; end
692 assert_equal %q{[:C0_m, [1, 2]]}, %q{
693 class C0; def m *args; [:C0_m, args]; end; end
694 class C1 < C0; def m a, o=:o, *r; super; end; end
697 assert_equal %q{[:C0_m, [1, 2, 3]]}, %q{
698 class C0; def m *args; [:C0_m, args]; end; end
699 class C1 < C0; def m a, o=:o, *r; super; end; end
702 assert_equal %q{[:C0_m, [1, 2, 3, 4]]}, %q{
703 class C0; def m *args; [:C0_m, args]; end; end
704 class C1 < C0; def m a, o=:o, *r; super; end; end
705 ; C1.new.m 1, 2, 3, 4}
707 assert_equal %q{[:C0_m, [:a]]}, %q{
708 class C0; def m *args; [:C0_m, args]; end; end
709 class C1 < C0; def m a
710 a = :a; super; end; end
713 assert_equal %q{[:C0_m, [1, 2, 3, 4]]}, %q{
714 class C0; def m *args; [:C0_m, args]; end; end
715 class C1 < C0; def m(m1, m2, *r, p1, p2); super; end; end
718 assert_equal %q{[:C0_m, [1, 2, 3, 4, 5]]}, %q{
719 class C0; def m *args; [:C0_m, args]; end; end
720 class C1 < C0; def m(m1, m2, *r, p1, p2); super; end; end
721 ; C1.new.m(1,2,3,4,5)}
723 assert_equal %q{[:C0_m, [1, 2, 3, 4, 5, 6]]}, %q{
724 class C0; def m *args; [:C0_m, args]; end; end
725 class C1 < C0; def m(m1, m2, *r, p1, p2); super; end; end
726 ; C1.new.m(1,2,3,4,5,6)}
728 assert_equal %q{[:C0_m, [1, 2, 3, 4, 5, 6, 7]]}, %q{
729 class C0; def m *args; [:C0_m, args]; end; end
730 class C1 < C0; def m(m1, m2, *r, p1, p2); super; end; end
731 ; C1.new.m(1,2,3,4,5,6,7)}
733 assert_equal %q{[:C0_m, [1, 2, 3, 4, 5, 6, 7, 8]]}, %q{
734 class C0; def m *args; [:C0_m, args]; end; end
735 class C1 < C0; def m(m1, m2, *r, p1, p2); super; end; end
736 ; C1.new.m(1,2,3,4,5,6,7,8)}
738 assert_equal %q{[:C0_m, [1, :o]]}, %q{
739 class C0; def m *args; [:C0_m, args]; end; end
740 class C1 < C0; def m a, o=:o, *r, &b; super; end; end
743 assert_equal %q{[:C0_m, [1, 2]]}, %q{
744 class C0; def m *args; [:C0_m, args]; end; end
745 class C1 < C0; def m a, o=:o, *r, &b; super; end; end
748 assert_equal %q{[:C0_m, [1, 2, 3]]}, %q{
749 class C0; def m *args; [:C0_m, args]; end; end
750 class C1 < C0; def m a, o=:o, *r, &b; super; end; end
753 assert_equal %q{[:C0_m, [1, 2, 3, 4]]}, %q{
754 class C0; def m *args; [:C0_m, args]; end; end
755 class C1 < C0; def m a, o=:o, *r, &b; super; end; end
756 ; C1.new.m 1, 2, 3, 4}
758 assert_equal %q{[:C0_m, [1, :o]]}, %q{
759 class C0; def m *args; [:C0_m, args]; end; end
760 class C1 < C0; def m a, o=:o, *r, &b; super; end; end
763 assert_equal %q{[:C0_m, [1, 2]]}, %q{
764 class C0; def m *args; [:C0_m, args]; end; end
765 class C1 < C0; def m a, o=:o, *r, &b; super; end; end
768 assert_equal %q{[:C0_m, [1, 2, 3]]}, %q{
769 class C0; def m *args; [:C0_m, args]; end; end
770 class C1 < C0; def m a, o=:o, *r, &b; super; end; end
771 ; C1.new.m(1, 2, 3){}}
773 assert_equal %q{[:C0_m, [1, 2, 3, 4]]}, %q{
774 class C0; def m *args; [:C0_m, args]; end; end
775 class C1 < C0; def m a, o=:o, *r, &b; super; end; end
776 ; C1.new.m(1, 2, 3, 4){}}
778 assert_equal %q{[:C0_m, [1, :x]]}, %q{
779 class C0; def m *args; [:C0_m, args]; end; end
780 class C1 < C0; def m a, o=:o
781 o = :x; super; end; end
784 assert_equal %q{[:C0_m, [1, :x]]}, %q{
785 class C0; def m *args; [:C0_m, args]; end; end
786 class C1 < C0; def m a, o=:o
787 o = :x; super; end; end
790 assert_equal %q{[:C0_m, [:a, :o]]}, %q{
791 class C0; def m *args; [:C0_m, args]; end; end
792 class C1 < C0; def m a, o=:o
793 a = :a; super; end; end
796 assert_equal %q{[:C0_m, [:a, 2]]}, %q{
797 class C0; def m *args; [:C0_m, args]; end; end
798 class C1 < C0; def m a, o=:o
799 a = :a; super; end; end
802 assert_equal %q{[:C0_m, [1]]}, %q{
803 class C0; def m *args; [:C0_m, args]; end; end
804 class C1 < C0; def m a; super; end; end
807 assert_equal %q{[:C0_m, [1, :x, :y]]}, %q{
808 class C0; def m *args; [:C0_m, args]; end; end
809 class C1 < C0; def m a, *r
810 r = [:x, :y]; super; end; end
813 assert_equal %q{[:C0_m, [1, :x, :y]]}, %q{
814 class C0; def m *args; [:C0_m, args]; end; end
815 class C1 < C0; def m a, *r
816 r = [:x, :y]; super; end; end
819 assert_equal %q{[:C0_m, [1, :x, :y]]}, %q{
820 class C0; def m *args; [:C0_m, args]; end; end
821 class C1 < C0; def m a, *r
822 r = [:x, :y]; super; end; end
825 assert_equal %q{[:C0_m, [1, 2, :o1, :o2, 3, 4]]}, %q{
826 class C0; def m *args; [:C0_m, args]; end; end
827 class C1 < C0; def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2); super; end; end
830 assert_equal %q{[:C0_m, [1, 2, 3, :o2, 4, 5]]}, %q{
831 class C0; def m *args; [:C0_m, args]; end; end
832 class C1 < C0; def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2); super; end; end
833 ; C1.new.m(1,2,3,4,5)}
835 assert_equal %q{[:C0_m, [1, 2, 3, 4, 5, 6]]}, %q{
836 class C0; def m *args; [:C0_m, args]; end; end
837 class C1 < C0; def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2); super; end; end
838 ; C1.new.m(1,2,3,4,5,6)}
840 assert_equal %q{[:C0_m, [1, 2, 3, 4, 5, 6, 7]]}, %q{
841 class C0; def m *args; [:C0_m, args]; end; end
842 class C1 < C0; def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2); super; end; end
843 ; C1.new.m(1,2,3,4,5,6,7)}
845 assert_equal %q{[:C0_m, [1, 2, 3, 4, 5, 6, 7, 8]]}, %q{
846 class C0; def m *args; [:C0_m, args]; end; end
847 class C1 < C0; def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2); super; end; end
848 ; C1.new.m(1,2,3,4,5,6,7,8)}
850 assert_equal %q{[:C0_m, [1, 2, 3, 4, 5, 6, 7, 8, 9]]}, %q{
851 class C0; def m *args; [:C0_m, args]; end; end
852 class C1 < C0; def m(m1, m2, o1=:o1, o2=:o2, *r, p1, p2); super; end; end
853 ; C1.new.m(1,2,3,4,5,6,7,8,9)}
855 assert_equal %q{[:C0_m, [1]]}, %q{
856 class C0; def m *args; [:C0_m, args]; end; end
857 class C1 < C0; def m a, *r; super; end; end
860 assert_equal %q{[:C0_m, [1, 2]]}, %q{
861 class C0; def m *args; [:C0_m, args]; end; end
862 class C1 < C0; def m a, *r; super; end; end
865 assert_equal %q{[:C0_m, [1, 2, 3]]}, %q{
866 class C0; def m *args; [:C0_m, args]; end; end
867 class C1 < C0; def m a, *r; super; end; end
870 assert_equal %q{[:C0_m, []]}, %q{
871 class C0; def m *args; [:C0_m, args]; end; end
872 class C1 < C0; def m; super; end; end
875 assert_equal %q{[:C0_m, [1, :o]]}, %q{
876 class C0; def m *args; [:C0_m, args]; end; end
877 class C1 < C0; def m a, o=:o; super; end; end
880 assert_equal %q{[:C0_m, [1, 2]]}, %q{
881 class C0; def m *args; [:C0_m, args]; end; end
882 class C1 < C0; def m a, o=:o; super; end; end
885 assert_equal %q{[:ok, :ok, :ok, :ok, :ok, :ok, :ng, :ng]}, %q{
922 test{o1.public_send :m}
923 test{o2.public_send :mm}
924 test{o1.method(:m).call}
925 test{o2.method(:mm).call}
929 assert_equal 'ok', %q{
940 assert_equal 'ok', %q{
950 }, '[ruby-core:11998]'
952 assert_equal 'ok', %q{
962 }, '[ruby-core:11998]'
964 assert_equal 'ok', %q{
978 }, '[ruby-core:11998]'
980 assert_equal 'ok', %q{
996 }, '[ruby-dev:31816], [ruby-dev:31817]'
998 assert_normal_exit %q{
1000 Process.setrlimit(Process::RLIMIT_STACK, 4_202_496)
1001 # FreeBSD fails this less than 4M + 8K bytes.
1006 attr "a" * (10*1024*1024)
1008 }, '[ruby-dev:31818]'
1010 assert_equal 'ok', %q{
1012 def define_method2(name, &block)
1013 define_method(name, &block)
1017 define_method2(:m) {|x, y| :fail }
1021 rescue ArgumentError
1026 assert_not_match /method_missing/, %q{
1027 STDERR.reopen(STDOUT)
1028 variable_or_mehtod_not_exist
1031 assert_equal '[false, false, false, false, true, true]', %q{
1033 define_method(:foo) {
1059 [C.new.foo, C.new.foo{}, D.new.m1, D.new.m1{}, D.new.m2, D.new.m2{}]
1060 }, '[ruby-core:14813]'