diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-01 07:50:53 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-01 07:50:53 +0000 |
commit | cec0668209483a3f233574211c4b8fbd3d1d64b7 (patch) | |
tree | a52f0e7e2806d023f52a05d7e35032dc04eed1b2 /test | |
parent | dabaaafd9f1932c103f489ac59a2f09ae5e02d09 (diff) | |
download | ruby-cec0668209483a3f233574211c4b8fbd3d1d64b7.tar.gz |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_object.rb | 8 |
1 files changed, 8 insertions, 0 deletions
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 |