diff options
author | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-28 21:18:53 +0000 |
---|---|---|
committer | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-28 21:18:53 +0000 |
commit | 15d4862b913f6d555ce8a79075d69bba74b5b9bc (patch) | |
tree | 79f4a8e7491d7f20b529d4c495006a4c4e6818d6 /test/ostruct | |
parent | 2dafb0f47a7ae70362aea7649b635e97bb33dcf2 (diff) |
* lib/ostruct.rb (each_pair): Add #each_pair [#1400]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ostruct')
-rw-r--r-- | test/ostruct/test_ostruct.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb index 1826e40e53..9b125fc055 100644 --- a/test/ostruct/test_ostruct.rb +++ b/test/ostruct/test_ostruct.rb @@ -85,4 +85,11 @@ class TC_OpenStruct < Test::Unit::TestCase assert_equal(h, OpenStruct.new("name" => "John Smith", "age" => 70, pension: 300).to_h) end + + def test_each_pair + h = {name: "John Smith", age: 70, pension: 300} + os = OpenStruct.new(h) + assert_equal '#<Enumerator: #<OpenStruct name="John Smith", age=70, pension=300>:each_pair>', os.each_pair.inspect + assert_equal [[:name, "John Smith"], [:age, 70], [:pension, 300]], os.each_pair.to_a + end end |