From 314bef7ef149d7ce87c57fa0c95e30fc8fb9b27f Mon Sep 17 00:00:00 2001 From: ko1 Date: Thu, 20 Dec 2007 07:07:35 +0000 Subject: * insnhelper.ci, vm.c, vm_core.h: change interface of vm_invoke_block() to specify block ptr. [ruby-talk:266422] * cont.c, eval_jump.ci, insns.def, proc.c, signal.c, thread.c: apply above change. * bootstraptest/test_knownbug.rb: move fixed bug. * bootstraptest/test_block.rb: ditto. and add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- bootstraptest/test_block.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'bootstraptest/test_block.rb') diff --git a/bootstraptest/test_block.rb b/bootstraptest/test_block.rb index 97fcdd4bef..f139c21d15 100644 --- a/bootstraptest/test_block.rb +++ b/bootstraptest/test_block.rb @@ -472,3 +472,28 @@ assert_equal '[nil, []]', %q{ GC.stress=false r.inspect }, '[ruby-dev:32567]' + +assert_equal NilClass.to_s, %q{ + r = false; 1.times{|&b| r = b}; r.class +} + +assert_equal 'ok', %q{ + class C + define_method(:foo) do |arg, &block| + if block then block.call else arg end + end + end + C.new.foo("ng") {"ok"} +}, '[ruby-talk:266422]' + +assert_equal 'ok', %q{ + STDERR.reopen(STDOUT) + class C + define_method(:foo) do |&block| + block.call if block + end + result = "ng" + new.foo() {result = "ok"} + result + end +} -- cgit v1.2.3