From dc460944bb483b45908ab028fa64467113a45ddc Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 1 May 2017 07:50:53 +0000 Subject: object.c: Kernel#yield_self * object.c (rb_obj_yield_self): new method which yields the receiver and returns the result. [ruby-core:46320] [Feature #6721] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_object.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/ruby/test_object.rb b/test/ruby/test_object.rb index d93d5594a7..6a1a82546a 100644 --- a/test/ruby/test_object.rb +++ b/test/ruby/test_object.rb @@ -18,6 +18,14 @@ class TestObject < Test::Unit::TestCase assert_same(object, object.itself, feature6373) end + def test_yield_self + feature = '[ruby-core:46320] [Feature #6721]' + object = Object.new + assert_same(self, object.yield_self {self}, feature) + assert_same(object, object.yield_self {|x| break x}, feature) + assert_instance_of(Enumerator, object.yield_self) + end + def test_dup assert_equal 1, 1.dup assert_equal true, true.dup -- cgit v1.2.3