diff options
| author | Keita Obo <[email protected]> | 2013-09-18 00:20:13 +0900 |
|---|---|---|
| committer | Keita Obo <[email protected]> | 2013-09-18 00:20:13 +0900 |
| commit | 0bce3a36d2b6b0d4bccdbf3b75b279a13fbb22e4 (patch) | |
| tree | ee3608eee388bcc6a40d627ff3b7a313341d0193 /test/t/proc.rb | |
| parent | ccadbbeb8425eac6b7e6b0503a12dad5541d6d54 (diff) | |
| download | mruby-0bce3a36d2b6b0d4bccdbf3b75b279a13fbb22e4.tar.gz mruby-0bce3a36d2b6b0d4bccdbf3b75b279a13fbb22e4.zip | |
Fixed self value in a block is changed with return value
fix #1504
Diffstat (limited to 'test/t/proc.rb')
| -rw-r--r-- | test/t/proc.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/t/proc.rb b/test/t/proc.rb index 4227772dd..8587a7bc7 100644 --- a/test/t/proc.rb +++ b/test/t/proc.rb @@ -54,3 +54,19 @@ assert('Proc#call', '15.2.17.4.3') do assert_equal 1, a assert_equal 5, a2 end + +assert('Proc#return_does_not_break_self') do + class TestClass + attr_accessor :block + def initialize + end + def register_block + @block = Proc.new { self } + return [] + end + end + + c = TestClass.new + assert_equal [], c.register_block + assert_equal c, c.block.call +end |
