summaryrefslogtreecommitdiffhomepage
path: root/test/t/hash.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/t/hash.rb')
-rw-r--r--test/t/hash.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/t/hash.rb b/test/t/hash.rb
index c8d7a70ef..b455812cf 100644
--- a/test/t/hash.rb
+++ b/test/t/hash.rb
@@ -16,6 +16,13 @@ assert('Hash#[]', '15.2.13.4.2') do
a = { 'abc' => 'abc' }
assert_equal 'abc', a['abc']
+
+ # Hash#[] should call #default (#3272)
+ hash = {}
+ def hash.default(k); self[k] = 1; end
+ hash[:foo] += 1
+
+ assert_equal 2, hash[:foo]
end
assert('Hash#[]=', '15.2.13.4.3') do