summaryrefslogtreecommitdiff
path: root/bootstraptest/test_proc.rb
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-25 03:51:35 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-25 03:51:35 +0000
commit7c982059ea464cbdb951eab239afdffb2d0553ca (patch)
tree9afa8d4d79283e58596f88ce6bdee9f5345d7915 /bootstraptest/test_proc.rb
parentf6e435fe878cfdb03906b1dbb2e366e9b3408b53 (diff)
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@20980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bootstraptest/test_proc.rb')
-rw-r--r--bootstraptest/test_proc.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/bootstraptest/test_proc.rb b/bootstraptest/test_proc.rb
index 1ab9444..9bef6ea 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'