diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-10 07:57:17 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-10 07:57:17 +0000 |
commit | fbe967ec02cb65a7efa3fb8f3d747cf6f620dde1 (patch) | |
tree | c01bf08a7dfae15b3519ece7383fe0d74f005fff /test | |
parent | 911b1c6b06a89603dfc9976a021b85e505221b7b (diff) | |
download | ruby-fbe967ec02cb65a7efa3fb8f3d747cf6f620dde1.tar.gz |
hash.c: to_proc
* hash.c (rb_hash_to_proc): new method Hash#to_proc.
[Feature #11653]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_hash.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index 4f48d3b90c..cb59524bd0 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -1333,6 +1333,16 @@ class TestHash < Test::Unit::TestCase assert_not_operator(h2, :>, h2) end + def test_to_proc + h = { + 1 => 10, + 2 => 20, + 3 => 30, + } + + assert_equal([10, 20, 30], [1, 2, 3].map(&h)) + end + class TestSubHash < TestHash class SubHash < Hash def reject(*) |