From 0c449ed7c2eb4775d9e8fbf75531be091d125fbf Mon Sep 17 00:00:00 2001 From: yugui Date: Thu, 25 Dec 2008 09:56:55 +0000 Subject: merges r20980 from trunk into ruby_1_9_1. * proc.c (proc_new): should use proc_dup() if block has Proc. * vm.c (vm_make_proc_from_block): should use rb_cProc for block. * vm.c (vm_make_proc): add an assertion. * bootstraptest/test_proc.rb: add a test. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- bootstraptest/test_proc.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'bootstraptest') diff --git a/bootstraptest/test_proc.rb b/bootstraptest/test_proc.rb index 1ab9444c3..9bef6ea85 100644 --- a/bootstraptest/test_proc.rb +++ b/bootstraptest/test_proc.rb @@ -394,3 +394,27 @@ assert_equal 'ok', %q{ a_proc = give_it f.call_it(&give_it()) }, '[ruby-core:15711]' + +assert_equal 'foo!', %q{ + class FooProc < Proc + def initialize + @foo = "foo!" + end + + def bar + @foo + end + end + + def bar + FooProc.new &lambda{ + p 1 + } + end + + fp = bar(&lambda{ + p 2 + }) + + fp.bar +}, 'Subclass of Proc' -- cgit