From 0546fb2f52ca83d0395f8ab99d828206ed8c8298 Mon Sep 17 00:00:00 2001 From: Leo Balter <leonardo.balter@gmail.com> Date: Tue, 11 Apr 2017 00:37:39 -0400 Subject: [PATCH] Update tests for Array.length --- test/built-ins/Array/S15.4.3_A2.1.js | 25 ------------------------- test/built-ins/Array/S15.4.3_A2.2.js | 25 ------------------------- test/built-ins/Array/S15.4.3_A2.3.js | 16 ---------------- test/built-ins/Array/S15.4.3_A2.4.js | 13 ------------- test/built-ins/Array/length.js | 24 ++++++++++++++++++++++++ 5 files changed, 24 insertions(+), 79 deletions(-) delete mode 100644 test/built-ins/Array/S15.4.3_A2.1.js delete mode 100644 test/built-ins/Array/S15.4.3_A2.2.js delete mode 100644 test/built-ins/Array/S15.4.3_A2.3.js delete mode 100644 test/built-ins/Array/S15.4.3_A2.4.js create mode 100644 test/built-ins/Array/length.js diff --git a/test/built-ins/Array/S15.4.3_A2.1.js b/test/built-ins/Array/S15.4.3_A2.1.js deleted file mode 100644 index 2427df1f74..0000000000 --- a/test/built-ins/Array/S15.4.3_A2.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 Array has the attribute DontEnum -es5id: 15.4.3_A2.1 -description: Checking use propertyIsEnumerable, for-in ----*/ - -//CHECK#1 -if (Array.propertyIsEnumerable('length') !== false) { - $ERROR('#1: Array.propertyIsEnumerable(\'length\') === false. Actual: ' + (Array.propertyIsEnumerable('length'))); -} - -//CHECK#2 -var result = true; -for (var p in Array){ - if (p === "length") { - result = false; - } -} - -if (result !== true) { - $ERROR('#2: result = true; for (p in Array.slice) { if (p === "length") result = false; } result === true;'); -} diff --git a/test/built-ins/Array/S15.4.3_A2.2.js b/test/built-ins/Array/S15.4.3_A2.2.js deleted file mode 100644 index 643b9e0a53..0000000000 --- a/test/built-ins/Array/S15.4.3_A2.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 Array does not have the attribute DontDelete -es5id: 15.4.3_A2.2 -description: Checking use hasOwnProperty, delete ----*/ - -//CHECK#1 -if (Array.hasOwnProperty('length') !== true) { - $ERROR('#1: Array.hasOwnProperty(\'length\') === true. Actual: ' + (Array.hasOwnProperty('length'))); -} - -delete Array.length; - -//CHECK#2 -if (Array.hasOwnProperty('length') !== false) { - $ERROR('#2: delete Array.length; Array.hasOwnProperty(\'length\') === false. Actual: ' + (Array.hasOwnProperty('length'))); -} - -//CHECK#3 -if (Array.length === undefined) { - $ERROR('#3: delete Array.length; Array.length !== undefined'); -} diff --git a/test/built-ins/Array/S15.4.3_A2.3.js b/test/built-ins/Array/S15.4.3_A2.3.js deleted file mode 100644 index 5e00bf2603..0000000000 --- a/test/built-ins/Array/S15.4.3_A2.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 Array has the attribute ReadOnly -es5id: 15.4.3_A2.3 -description: Checking if varying the length property fails -includes: [propertyHelper.js] ----*/ - -//CHECK#1 -var x = Array.length; -verifyNotWritable(Array, "length", null, Infinity); -if (Array.length !== x) { - $ERROR('#1: x = Array.length; Array.length = Infinity; Array.length === x. Actual: ' + (Array.length)); -} diff --git a/test/built-ins/Array/S15.4.3_A2.4.js b/test/built-ins/Array/S15.4.3_A2.4.js deleted file mode 100644 index 7106f12990..0000000000 --- a/test/built-ins/Array/S15.4.3_A2.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 Array is 1 -es5id: 15.4.3_A2.4 -description: Array.length === 1 ----*/ - -//CHECK#1 -if (Array.length !== 1) { - $ERROR('#1: Array.length === 1. Actual: ' + (Array.length)); -} diff --git a/test/built-ins/Array/length.js b/test/built-ins/Array/length.js new file mode 100644 index 0000000000..0d05fccf54 --- /dev/null +++ b/test/built-ins/Array/length.js @@ -0,0 +1,24 @@ +// Copyright (C) 2017 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array-constructor +description: > + Array has a "length" property whose value is 1. +info: | + 22.1.1 The Array Constructor + + The length property of the Array constructor function is 1. + ... + + ES7 section 17: 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.length, 1); + +verifyNotEnumerable(Array, 'length'); +verifyNotWritable(Array, 'length'); +verifyConfigurable(Array, 'length'); -- GitLab