diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-12-25 15:40:10 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-12-25 23:43:37 +0900 |
| commit | 421819dc2ce42ae32e67d0d2151eed50f7c12e93 (patch) | |
| tree | 9b658ee0c67450059f715ce404d628405fe6db08 /mrbgems/mruby-hash-ext/test/hash.rb | |
| parent | df68a3345de9b5b711b1f720dad1cd0109854188 (diff) | |
| download | mruby-421819dc2ce42ae32e67d0d2151eed50f7c12e93.tar.gz mruby-421819dc2ce42ae32e67d0d2151eed50f7c12e93.zip | |
Add `Hash#slice` [Ruby 2.5]
Diffstat (limited to 'mrbgems/mruby-hash-ext/test/hash.rb')
| -rw-r--r-- | mrbgems/mruby-hash-ext/test/hash.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/mrbgems/mruby-hash-ext/test/hash.rb b/mrbgems/mruby-hash-ext/test/hash.rb index 183cecfce..269da800d 100644 --- a/mrbgems/mruby-hash-ext/test/hash.rb +++ b/mrbgems/mruby-hash-ext/test/hash.rb @@ -292,3 +292,9 @@ assert("Hash#transform_values") do assert_equal(h, h.transform_values!{|v|v.to_s}) assert_equal({a: "1", b: "2", c: "3"}, h) end + +assert("Hash#slice") do + h = { a: 100, b: 200, c: 300 } + assert_equal({:a=>100}, h.slice(:a)) + assert_equal({:b=>200, :c=>300}, h.slice(:b, :c, :d)) +end |
