diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-05-08 08:51:36 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-05-08 08:51:36 +0900 |
| commit | d25d343eee8ff2e63b5e3ad75c77c238016fdd2c (patch) | |
| tree | 8e5c69016cdb5ab6f8f138fb11af51a8c34dda0e /test | |
| parent | 09b9c7762df3f75384f8390b9f6b51e2e18f4c5d (diff) | |
| parent | eafc4dd0afe0db26be0f5abce425af717552fa48 (diff) | |
| download | mruby-d25d343eee8ff2e63b5e3ad75c77c238016fdd2c.tar.gz mruby-d25d343eee8ff2e63b5e3ad75c77c238016fdd2c.zip | |
Merge pull request #2208 from yui-knk/array-error
Make Array#[]= raise IndexError.
Diffstat (limited to 'test')
| -rw-r--r-- | test/t/array.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/t/array.rb b/test/t/array.rb index 48f2fe0c4..56daf0b01 100644 --- a/test/t/array.rb +++ b/test/t/array.rb @@ -66,6 +66,11 @@ assert('Array#[]=', '15.2.12.5.5') do # this will cause an exception due to the wrong arguments a.[]=(1,2,3,4) end + assert_raise(IndexError) do + # this will cause an exception due to the wrong arguments + a = [1,2,3,4,5] + a[1, -1] = 10 + end assert_equal(4, [1,2,3].[]=(1,4)) assert_equal(3, [1,2,3].[]=(1,2,3)) |
