aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_hash.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-10 07:57:17 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-10 07:57:17 +0000
commitfbe967ec02cb65a7efa3fb8f3d747cf6f620dde1 (patch)
treec01bf08a7dfae15b3519ece7383fe0d74f005fff /test/ruby/test_hash.rb
parent911b1c6b06a89603dfc9976a021b85e505221b7b (diff)
downloadruby-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/ruby/test_hash.rb')
-rw-r--r--test/ruby/test_hash.rb10
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(*)