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); |
+ assertEquals(arr, [1,,2]); |
+ } |
+ { |
+ var arr = [1,undefined,2]; |
+ Object.preventExtensions(arr); |
+ arr.sort(); |
+ assertEquals(3, arr.length); |
+ assertEquals(arr, [1,2,undefined]); |
adamk
2017/02/01 16:39:13
Shouldn't this fail now?
Choongwoo Han
2017/02/01 18:21:07
Yes. In this case, this arr does not have any hole
|
+ } |
+} |
+TestSortOnNonExtensible(); |
+ |
// Test special prototypes |
(function testSortSpecialPrototypes() { |