diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-05-07 22:50:24 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-05-07 22:50:24 -0700 |
| commit | c80103e89a7ddcbaa7b5fc470358a4bcae327953 (patch) | |
| tree | 4ebbc46f688f1d4c4e81eec715a9314ebb286c73 /test/t | |
| parent | 11e70f2191caecfe546f8a97baf284c1cfc25e00 (diff) | |
| parent | c9edc5b02ee07aa2b8caa994910d31273260ca22 (diff) | |
| download | mruby-c80103e89a7ddcbaa7b5fc470358a4bcae327953.tar.gz mruby-c80103e89a7ddcbaa7b5fc470358a4bcae327953.zip | |
Merge pull request #1237 from monaka/pr-cleanup-hash
Cleanup hash
Diffstat (limited to 'test/t')
| -rw-r--r-- | test/t/hash.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/test/t/hash.rb b/test/t/hash.rb index 5ba476e40..ef03c4a26 100644 --- a/test/t/hash.rb +++ b/test/t/hash.rb @@ -52,9 +52,12 @@ end assert('Hash#default_proc', '15.2.13.4.7') do a = Hash.new - b = Hash.new {|s,k| s[k] = k} + b = Hash.new {|s,k| s[k] = k + k} + c = b[2] + d = b['cat'] - a.default_proc == nil and b.default_proc.class == Proc + a.default_proc == nil and b.default_proc.class == Proc and + c = 4 and d = 'catcat' end assert('Hash#delete', '15.2.13.4.8') do @@ -278,3 +281,11 @@ assert('Hash#select!') do h == {:two => 2, :four => 4} end +# Not ISO specified + +assert('Hash#inspect') do + h = { "c" => 300, "a" => 100, "d" => 400, "c" => 300 } + ret = h.to_s + + ret = "{\"c\"=>300, \"a\"=>100, \"d\"=>400}" +end |
