diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Array/prototype/slice/15.4.4.10-10-c-ii-1.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Array/prototype/slice/15.4.4.10-10-c-ii-1.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Array/prototype/slice/15.4.4.10-10-c-ii-1.js b/js/src/tests/test262/built-ins/Array/prototype/slice/15.4.4.10-10-c-ii-1.js new file mode 100644 index 0000000000..4289b144ca --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/slice/15.4.4.10-10-c-ii-1.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.slice +description: > + Array.prototype.slice will slice a string from start to end when + index property (read-only) exists in Array.prototype (Step 10.c.ii) +---*/ + +var arrObj = [1, 2, 3]; + +Object.defineProperty(Array.prototype, "0", { + value: "test", + writable: false, + configurable: true +}); + +var newArr = arrObj.slice(0, 1); + +assert(newArr.hasOwnProperty("0"), 'newArr.hasOwnProperty("0") !== true'); +assert.sameValue(newArr[0], 1, 'newArr[0]'); +assert.sameValue(typeof newArr[1], "undefined", 'typeof newArr[1]'); + +reportCompare(0, 0); |