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 | 0c449ed7c2eb4775d9e8fbf75531be091d125fbf (patch) | |
| tree | 7f26b6fc5b8798184b0828c44fbb880200a9fe1c /bootstraptest | |
| parent | 0e6f7a503c32fdac8da1240974e0ab2d92fc5415 (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: http://svn.ruby-lang.org/repos/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 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' |
