diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Array/prototype/splice/called_with_one_argument.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Array/prototype/splice/called_with_one_argument.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Array/prototype/splice/called_with_one_argument.js b/js/src/tests/test262/built-ins/Array/prototype/splice/called_with_one_argument.js new file mode 100644 index 0000000000..0aa1280c22 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/splice/called_with_one_argument.js @@ -0,0 +1,27 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Array.prototype.splice deletes length-start elements when called with one argument +info: | + 22.1.3.25 Array.prototype.splice (start, deleteCount , ...items ) + + ... + 9. Else if the number of actual arguments is 1, then + a. Let insertCount be 0. + b. Let actualDeleteCount be len – actualStart. +esid: sec-array.prototype.splice +---*/ + +var array = ["first", "second", "third"]; + +var result = array.splice(1); + +assert.sameValue(array.length, 1, "array length updated"); +assert.sameValue(array[0], "first", "array[0] unchanged"); + +assert.sameValue(result.length, 2, "result array length correct"); +assert.sameValue(result[0], "second", "result[0] correct"); +assert.sameValue(result[1], "third", "result[1] correct"); + +reportCompare(0, 0); |