aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-09 04:07:53 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-09 04:07:53 +0000
commit6b18a8c2e9540f67de5887f899d73e100c3ce13f (patch)
tree5037c18957dd3217a1efd6e392ef957e4b2c5f99 /test
parent6cb7ac7e155b15d542297eac32b2cd03efca8b60 (diff)
downloadruby-6b18a8c2e9540f67de5887f899d73e100c3ce13f.tar.gz
* hash.c (rb_hash_set_default_proc): Accept nil, patch by Run Paint
[Feature #4234] * test/ruby/test_hash.rb: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_hash.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index bcfe13cbb3..e3c92125c5 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -718,6 +718,10 @@ class TestHash < Test::Unit::TestCase
def test_default_proc
h = Hash.new {|hh, k| hh + k + "baz" }
assert_equal("foobarbaz", h.default_proc.call("foo", "bar"))
+ assert_nil(h.default_proc = nil)
+ assert_nil(h.default_proc)
+ h.default_proc = ->(h, k){ true }
+ assert(h[:nope])
h = {}
assert_nil(h.default_proc)
end