diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-25 09:56:55 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-25 09:56:55 +0000 |
commit | dcc293e053ee845446396b85950fd95cf62bbcb3 (patch) | |
tree | 7f26b6fc5b8798184b0828c44fbb880200a9fe1c /bootstraptest | |
parent | eaf7ad9d5a5e210bde9ec7643ef0b54da64ee3a1 (diff) |
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: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@21033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bootstraptest')
-rw-r--r-- | bootstraptest/test_proc.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/bootstraptest/test_proc.rb b/bootstraptest/test_proc.rb index 1ab9444c31..9bef6ea85e 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' |