diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-03-23 12:34:32 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-03-23 12:34:32 +0900 |
| commit | 817b884343cc349d3c32da7f1c65cb4867963bde (patch) | |
| tree | 49ffcd28618ed32c94c393dfa9367daae02a6249 /mrbgems/mruby-array-ext/test/array.rb | |
| parent | daf83946bbf2834da8393cd50af2bc7bcee3289f (diff) | |
| download | mruby-817b884343cc349d3c32da7f1c65cb4867963bde.tar.gz mruby-817b884343cc349d3c32da7f1c65cb4867963bde.zip | |
add #dig tests
Diffstat (limited to 'mrbgems/mruby-array-ext/test/array.rb')
| -rw-r--r-- | mrbgems/mruby-array-ext/test/array.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mrbgems/mruby-array-ext/test/array.rb b/mrbgems/mruby-array-ext/test/array.rb index f17cb80e1..ec1528fc3 100644 --- a/mrbgems/mruby-array-ext/test/array.rb +++ b/mrbgems/mruby-array-ext/test/array.rb @@ -310,3 +310,10 @@ assert("Array#to_ary") do assert_equal [], [].to_ary assert_equal [1,2,3], [1,2,3].to_ary end + +assert("Array#dig") do + h = [[[1]], 0] + assert_equal(1, h.dig(0, 0, 0)) + assert_nil(h.dig(2, 0)) + assert_raise(TypeError) {h.dig(:a)} +end |
