summaryrefslogtreecommitdiffhomepage
path: root/test/t/hash.rb
diff options
context:
space:
mode:
authorYutaka HARA <[email protected]>2016-12-01 14:55:26 +0900
committerYutaka HARA <[email protected]>2016-12-01 14:55:26 +0900
commit3f83ec64a82410cdc16863f8242eaea30dec026f (patch)
tree224b8762cf95071bf080243b501a72306b179ff7 /test/t/hash.rb
parent61ac564c99ab07f01f1af2809493103fc5216a85 (diff)
downloadmruby-3f83ec64a82410cdc16863f8242eaea30dec026f.tar.gz
mruby-3f83ec64a82410cdc16863f8242eaea30dec026f.zip
Add test for recently fixed bugs
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