From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../prototype/splice/called_with_one_argument.js | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 js/src/tests/test262/built-ins/Array/prototype/splice/called_with_one_argument.js (limited to 'js/src/tests/test262/built-ins/Array/prototype/splice/called_with_one_argument.js') 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); -- cgit v1.2.3