Hash#replace should copy default as well; close #2004

This commit is contained in:
Yukihiro "Matz" Matsumoto
2014-04-04 12:14:23 +09:00
parent 9f6d69ee56
commit 59cd24d41f
3 changed files with 17 additions and 5 deletions
+9
View File
@@ -230,6 +230,15 @@ assert('Hash#replace', '15.2.13.4.23') do
b = Hash.new.replace(a)
assert_equal({ 'abc_key' => 'abc_value' }, b)
a = Hash.new(42)
b = {}
b.replace(a)
assert_equal(42, b[1])
a = Hash.new{|h,x| x}
b.replace(a)
assert_equal(127, b[127])
end
assert('Hash#shift', '15.2.13.4.24') do