Chromium Code Reviews| Index: test/mjsunit/array-sort.js |
| diff --git a/test/mjsunit/array-sort.js b/test/mjsunit/array-sort.js |
| index fdd2333d7c8a1332e2ae7b5d6667218037c62993..da0dac093be02a6ffd71b83f25270bebcee3cc24 100644 |
| --- a/test/mjsunit/array-sort.js |
| +++ b/test/mjsunit/array-sort.js |
| @@ -480,6 +480,30 @@ function TestSortOnProxy() { |
| } |
| TestSortOnProxy(); |
| +function TestSortOnNonExtensible() { |
| + { |
| + var arr = [1,,2]; |
| + Object.preventExtensions(arr); |
| + var exception = false; |
| + try { |
| + arr.sort(); |
| + } catch (e) { |
| + exception = true; |
| + assertTrue(e instanceof TypeError); |
| + } |
| + assertTrue(exception); |
|
adamk
2017/02/07 00:23:46
You can use
assertThrows(() => arr.sort(), TypeEr
Choongwoo Han
2017/02/07 09:45:49
Done.
|
| + assertEquals(arr, [1,,2]); |
| + } |
| + { |
| + var arr = [1,undefined,2]; |
| + Object.preventExtensions(arr); |
| + arr.sort(); |
| + assertEquals(3, arr.length); |
| + assertEquals(arr, [1,2,undefined]); |
| + } |
| +} |
| +TestSortOnNonExtensible(); |
| + |
| // Test special prototypes |
| (function testSortSpecialPrototypes() { |