summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/t/proc.rb16
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