1 assert_equal %q{1}, %q{
10 assert_equal %q{2}, %q{
11 [1,2,3].find{|x| x == 2}
13 assert_equal %q{2}, %q{
17 [1, 2, 3].each(&block)
20 E.new.find {|x| x == 2 }
22 assert_equal %q{6}, %q{
29 assert_equal %q{15}, %q{
36 assert_equal %q{0}, %q{
43 assert_equal %q{1}, %q{
52 assert_equal %q{1..3}, %q{
61 assert_equal %q{[1, 2, 3]}, %q{
64 assert_equal %q{[4, 8, 12]}, %q{
69 assert_equal %q{[1, 2, 3]}, %q{
81 assert_equal %q{[4, 5, 6]}, %q{
95 assert_equal %q{100}, %q{
109 assert_equal %q{20}, %q{
120 assert_equal %q{2}, %q{
132 assert_equal %q{3}, %q{
151 assert_equal %q{2}, %q{
170 assert_equal %q{2}, %q{
178 assert_equal %q{92580}, %q{
186 assert_equal %q{[10, nil]}, %q{
196 assert_equal %q{21}, %q{
207 assert_equal %q{[10, 20, 30, 40, nil, nil, nil, nil]}, %q{
217 assert_equal %q{[10, 20, 30, 40, nil, nil]}, %q{
227 assert_equal %q{[1]}, %q{
243 assert_equal %q{[1, [2]]}, %q{
252 assert_equal %q{[[1, 2]]}, %q{
261 assert_equal %q{[1, 2, []]}, %q{
270 assert_equal %q{[1, 2, nil, []]}, %q{
279 assert_equal %q{1}, %q{
287 assert_equal %q{15129}, %q{
297 assert_equal %q{2}, %q{
307 assert_equal %q{9}, %q{
315 assert_equal %q{10}, %q{
320 assert_equal %q{[1, 2]}, %q{
329 assert_equal %q{[1, nil]}, %q{
339 assert_equal '0', %q{
350 m {|(v0,v1,*v2,v3),|}
351 m {|v0,(v1,*v2,v3),|}
352 m {|(v0,*v1,v2),v3,|}
354 m {|(v0,*v1,v2),&v3|}
356 m {|(v0,*v1,v2),*,&v3|}
358 m {|*,(v0,*v1,v2),&v3|}
359 m {|v0,*,(v1,*v2,v3)|}
360 m {|v0,*,(v1,*v2,v3),&v4|}
361 m {|(v0,*v1,v2),*,v3|}
362 m {|(v0,*v1,v2),*,v3,&v4|}
366 }, "block parameter (shouldn't SEGV: [ruby-dev:31143])"
368 assert_equal 'nil', %q{
373 }, '[ruby-dev:31147]'
375 assert_equal 'nil', %q{
379 m {|(v,(*))|}.inspect
380 }, '[ruby-dev:31160]'
382 assert_equal 'nil', %q{
386 m {|(*,a,b)|}.inspect
387 }, '[ruby-dev:31153]'
389 assert_equal 'nil', %q{
396 assert_equal %q{[1, 1, [1, nil], [1, nil], [1, nil], [1, nil], [1, 1], 1, [1, nil], [1, nil], [1, nil], [1, nil], [[1, 1], [1, 1]], [1, 1], [1, 1], [1, 1], [1, nil], [1, nil], [[[1, 1], [1, 1]], [[1, 1], [1, 1]]], [[1, 1], [1, 1]], [[1, 1], [1, 1]], [[1, 1], [1, 1]], [1, 1], [1, 1], [[[[1, 1], [1, 1]], [[1, 1], [1, 1]]], [[[1, 1], [1, 1]], [[1, 1], [1, 1]]]], [[[1, 1], [1, 1]], [[1, 1], [1, 1]]], [[[1, 1], [1, 1]], [[1, 1], [1, 1]]], [[[1, 1], [1, 1]], [[1, 1], [1, 1]]], [[1, 1], [1, 1]], [[1, 1], [1, 1]]]}, %q{
405 m(o){|(v,(*))| $ans << v}
406 ((x, y)) = o; $ans << [x, y]
407 m(o){|((x, y))| $ans << [x, y]}
408 (((x, y))) = o; $ans << [x, y]
409 m(o){|(((x, y)))| $ans << [x, y]}
414 assert_equal '0', %q{
419 }, '[ruby-dev:31437]'
420 assert_equal '[0]', %q{
425 }, '[ruby-dev:31440]'
426 assert_equal 'ok', %q{
428 lambda{|a|}.call(1, 2)
434 }, '[ruby-dev:31464]'
435 assert_equal 'ok', %q{
443 }, '[ruby-dev:31472]'
444 assert_equal 'ok', %q{
452 C.new.each {|*v| vs1 << v }
454 C.new.to_enum.each {|*v| vs2 << v }
455 vs1 == vs2 ? :ok : :ng
456 }, '[ruby-dev:32329]'
458 assert_normal_exit %q{
463 Thread.new { GC.start }.join
464 }, '[ruby-dev:32604]'
467 assert_equal '[nil, []]', %q{
468 def m() yield nil,[] end
474 }, '[ruby-dev:32567]'
476 assert_equal NilClass.to_s, %q{
477 r = false; 1.times{|&b| r = b}; r.class
480 assert_equal 'ok', %q{
482 define_method(:foo) do |arg, &block|
483 if block then block.call else arg end
486 C.new.foo("ng") {"ok"}
487 }, '[ruby-talk:266422]'
489 assert_equal 'ok', %q{
490 STDERR.reopen(STDOUT)
492 define_method(:foo) do |&block|
496 new.foo() {result = "ok"}
501 assert_equal "ok", %q{
506 yield(Bar.new) if block_given?
509 }, '[ruby-core:14279]'
511 assert_normal_exit %q{
513 def respond_to(&block)
514 responder = Responder.new
515 block.call(responder)
534 def method_missing(symbol, &block)
535 puts "enter method_missing"
536 @response = Proc.new{
537 puts 'in method missing'
540 puts "leave method_missing"
548 }, '[ruby-core:14395]'