summaryrefslogtreecommitdiff
path: root/test/ruby/test_proc.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-01 17:24:02 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-01 17:24:02 +0000
commit43ba2c01e746992e9658000e4df7bb025bfb6b01 (patch)
tree0b5f080c1f4c47e63a53b0996a2b14d6fd419ef6 /test/ruby/test_proc.rb
parent02c391a1c90ceb05f5243d1aececc299a2080f76 (diff)
proc.c: Binding#receiver
* proc.c (bind_receiver): new method to return the bound receiver of the binding object. [ruby-dev:47613] [Feature #8779] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_proc.rb')
-rw-r--r--test/ruby/test_proc.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb
index 5a22afee85..91279d9d75 100644
--- a/test/ruby/test_proc.rb
+++ b/test/ruby/test_proc.rb
@@ -1299,4 +1299,14 @@ class TestProc < Test::Unit::TestCase
assert_equal(true, b.local_variable_defined?(:a))
assert_equal(false, b.local_variable_defined?(:b))
end
+
+ def test_binding_receiver
+ feature8779 = '[ruby-dev:47613] [Feature #8779]'
+
+ assert_same(self, binding.receiver, feature8779)
+
+ obj = Object.new
+ def obj.b; binding; end
+ assert_same(obj, obj.b.receiver, feature8779)
+ end
end