summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-13 10:31:33 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-13 10:31:33 +0000
commitc791dc1345ad8ebe7b707e8922b42a7a43c53b89 (patch)
tree020162add6282afc465081d6675dec75e4c33443 /sample
parent855f1ff1323e7eca763b34cc9f7b850dddaa1c0c (diff)
* eval.c (POP_BLOCK): turn on BLOCK_LEFT flag when leaving block.
* eval.c (proc_invoke): unpack return/break destination when block is already left. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample')
-rw-r--r--sample/test.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/sample/test.rb b/sample/test.rb
index 6d2a6cd..8b8354a 100644
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -1033,6 +1033,34 @@ test_ok(get_block(&lambda).class == Proc)
test_ok(Proc.new{|a,| a}.call(1,2,3) == 1)
argument_test(true, Proc.new{|a,|}, 1,2)
+def test_return1
+ Proc.new {
+ return 55
+ }.call + 5
+end
+test_ok(test_return1() == 55)
+def test_return2
+ lambda {
+ return 55
+ }.call + 5
+end
+test_ok(test_return2() == 60)
+
+def proc_call(&b)
+ b.call
+end
+def proc_yield()
+ yield
+end
+def proc_return1
+ proc_call{return 42}+1
+end
+test_ok(proc_return1() == 42)
+def proc_return2
+ proc_yield{return 42}+1
+end
+test_ok(proc_return2() == 42)
+
def ljump_test(state, proc, *args)
x = state
begin