diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-04 12:14:23 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-04 12:14:23 +0900 |
| commit | 59cd24d41f1e6b5e25d35103c0720e8aa8cae0b6 (patch) | |
| tree | c7d96eddbe8b171d59f17f58bd0542037b114221 /test | |
| parent | 9f6d69ee562cecb597ab02b2b716e3d773141f17 (diff) | |
| download | mruby-59cd24d41f1e6b5e25d35103c0720e8aa8cae0b6.tar.gz mruby-59cd24d41f1e6b5e25d35103c0720e8aa8cae0b6.zip | |
Hash#replace should copy default as well; close #2004
Diffstat (limited to 'test')
| -rw-r--r-- | test/t/hash.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/t/hash.rb b/test/t/hash.rb index ec9da8ca7..8a10f4026 100644 --- a/test/t/hash.rb +++ b/test/t/hash.rb @@ -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 |
