diff options
author | Leo Balter <leonardo.balter@gmail.com> | 2017-04-11 01:40:40 -0400 |
---|---|---|
committer | Leo Balter <leonardo.balter@gmail.com> | 2017-04-11 03:01:00 -0400 |
commit | 7972f9bbdc491295c28ca6cc11ee53683a451ef1 (patch) | |
tree | fdcafb7b1b1562982f95f5176d3020594197daf9 /test/built-ins/Array/prototype/splice | |
parent | c58738e041f09dfd33efe3f83a12ae94be21d952 (diff) | |
download | qtdeclarative-testsuites-7972f9bbdc491295c28ca6cc11ee53683a451ef1.tar.gz |
Add and update common tests for Array and Array.prototype
Ref #960
Diffstat (limited to 'test/built-ins/Array/prototype/splice')
8 files changed, 49 insertions, 117 deletions
diff --git a/test/built-ins/Array/prototype/splice/S15.4.4.12_A5.1.js b/test/built-ins/Array/prototype/splice/S15.4.4.12_A5.1.js deleted file mode 100644 index 5a1b9297c..000000000 --- a/test/built-ins/Array/prototype/splice/S15.4.4.12_A5.1.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: The length property of splice has the attribute DontEnum -es5id: 15.4.4.12_A5.1 -description: Checking use propertyIsEnumerable, for-in ----*/ - -//CHECK#1 -if (Array.prototype.splice.propertyIsEnumerable('length') !== false) { - $ERROR('#1: Array.prototype.splice.propertyIsEnumerable(\'length\') === false. Actual: ' + (Array.prototype.splice.propertyIsEnumerable('length'))); -} - -//CHECK#2 -var result = true; -for (var p in Array.prototype.splice){ - if (p === "length") { - result = false; - } -} - -if (result !== true) { - $ERROR('#2: result = true; for (p in Array.prototype.splice) { if (p === "length") result = false; } result === true;'); -} diff --git a/test/built-ins/Array/prototype/splice/S15.4.4.12_A5.2.js b/test/built-ins/Array/prototype/splice/S15.4.4.12_A5.2.js deleted file mode 100644 index 741608e43..000000000 --- a/test/built-ins/Array/prototype/splice/S15.4.4.12_A5.2.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: The length property of splice does not have the attribute DontDelete -es5id: 15.4.4.12_A5.2 -description: Checking use hasOwnProperty, delete ----*/ - -//CHECK#1 -if (Array.prototype.splice.hasOwnProperty('length') !== true) { - $ERROR('#1: Array.prototype.splice.hasOwnProperty(\'length\') === true. Actual: ' + (Array.prototype.splice.hasOwnProperty('length'))); -} - -delete Array.prototype.splice.length; - -//CHECK#2 -if (Array.prototype.splice.hasOwnProperty('length') !== false) { - $ERROR('#2: delete Array.prototype.splice.length; Array.prototype.splice.hasOwnProperty(\'length\') === false. Actual: ' + (Array.prototype.splice.hasOwnProperty('length'))); -} - -//CHECK#3 -if (Array.prototype.splice.length === undefined) { - $ERROR('#3: delete Array.prototype.splice.length; Array.prototype.splice.length !== undefined'); -} diff --git a/test/built-ins/Array/prototype/splice/S15.4.4.12_A5.3.js b/test/built-ins/Array/prototype/splice/S15.4.4.12_A5.3.js deleted file mode 100644 index 8d250f341..000000000 --- a/test/built-ins/Array/prototype/splice/S15.4.4.12_A5.3.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: The length property of splice has the attribute ReadOnly -es5id: 15.4.4.12_A5.3 -description: Checking if varying the length property fails -includes: [propertyHelper.js] ----*/ - -//CHECK#1 -var x = Array.prototype.splice.length; -verifyNotWritable(Array.prototype.splice, "length", null, Infinity); -if (Array.prototype.splice.length !== x) { - $ERROR('#1: x = Array.prototype.splice.length; Array.prototype.splice.length = Infinity; Array.prototype.splice.length === x. Actual: ' + (Array.prototype.splice.length)); -} diff --git a/test/built-ins/Array/prototype/splice/S15.4.4.12_A5.4.js b/test/built-ins/Array/prototype/splice/S15.4.4.12_A5.4.js deleted file mode 100644 index 43cccec64..000000000 --- a/test/built-ins/Array/prototype/splice/S15.4.4.12_A5.4.js +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: The length property of splice is 2 -es5id: 15.4.4.12_A5.4 -description: splice.length === 1 ----*/ - -//CHECK#1 -if (Array.prototype.splice.length !== 2) { - $ERROR('#1: Array.prototype.splice.length === 2. Actual: ' + (Array.prototype.splice.length)); -} diff --git a/test/built-ins/Array/prototype/splice/S15.4.4.12_A5.5.js b/test/built-ins/Array/prototype/splice/S15.4.4.12_A5.5.js deleted file mode 100644 index 824939640..000000000 --- a/test/built-ins/Array/prototype/splice/S15.4.4.12_A5.5.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: The splice property of Array has the attribute DontEnum -es5id: 15.4.4.12_A5.5 -description: Checking use propertyIsEnumerable, for-in ----*/ - -//CHECK#1 -if (Array.propertyIsEnumerable('splice') !== false) { - $ERROR('#1: Array.propertyIsEnumerable(\'splice\') === false. Actual: ' + (Array.propertyIsEnumerable('splice'))); -} - -//CHECK#2 -var result = true; -for (var p in Array){ - if (p === "splice") { - result = false; - } -} - -if (result !== true) { - $ERROR('#2: result = true; for (p in Array) { if (p === "splice") result = false; } result === true;'); -} diff --git a/test/built-ins/Array/prototype/splice/S15.4.4.12_A5.6.js b/test/built-ins/Array/prototype/splice/S15.4.4.12_A5.6.js deleted file mode 100644 index ba2034ba6..000000000 --- a/test/built-ins/Array/prototype/splice/S15.4.4.12_A5.6.js +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: The splice property of Array has not prototype property -es5id: 15.4.4.12_A5.6 -description: Checking Array.prototype.splice.prototype ----*/ - -//CHECK#1 -if (Array.prototype.splice.prototype !== undefined) { - $ERROR('#1: Array.prototype.splice.prototype === undefined. Actual: ' + (Array.prototype.splice.prototype)); -} diff --git a/test/built-ins/Array/prototype/splice/length.js b/test/built-ins/Array/prototype/splice/length.js new file mode 100644 index 000000000..c77eb7eca --- /dev/null +++ b/test/built-ins/Array/prototype/splice/length.js @@ -0,0 +1,28 @@ +// Copyright (C) 2017 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.splice +description: > + The "length" property of Array.prototype.splice +info: | + 17 ECMAScript Standard Built-in Objects + + Every built-in function object, including constructors, has a length property + whose value is an integer. Unless otherwise specified, this value is equal to + the largest number of named arguments shown in the subclause headings for the + function description. Optional parameters (which are indicated with brackets: + [ ]) or rest parameters (which are shown using the form «...name») are not + included in the default argument count. + + Unless otherwise specified, the length property of a built-in function object + has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Array.prototype.splice.length, 2); + +verifyNotEnumerable(Array.prototype.splice, 'length'); +verifyNotWritable(Array.prototype.splice, 'length'); +verifyConfigurable(Array.prototype.splice, 'length'); diff --git a/test/built-ins/Array/prototype/splice/prop-desc.js b/test/built-ins/Array/prototype/splice/prop-desc.js new file mode 100644 index 000000000..ca24692ef --- /dev/null +++ b/test/built-ins/Array/prototype/splice/prop-desc.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.splice +description: > + "splice" property of Array.prototype +info: | + 17 ECMAScript Standard Built-in Objects + + Every other data property described in clauses 18 through 26 and in Annex B.2 + has the attributes { [[Writable]]: true, [[Enumerable]]: false, + [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(typeof Array.prototype.splice, 'function', 'typeof'); + +verifyNotEnumerable(Array.prototype, "splice"); +verifyWritable(Array.prototype, "splice"); +verifyConfigurable(Array.prototype, "splice"); |