From 9223f5634413efe142ed03b3dd1c434e01445adf Mon Sep 17 00:00:00 2001 From: Leonardo Balter <leonardo.balter@gmail.com> Date: Tue, 21 Jun 2016 13:26:20 -0400 Subject: [PATCH] Update and add basic prop-desc tests for Number and Number.prototype --- test/built-ins/Number/prop-desc.js | 20 ++++++++++++++ test/built-ins/Number/prototype/15.7.3.1-1.js | 16 ----------- .../Number/prototype/S15.7.3.1_A1_T1.js | 18 ------------- .../Number/prototype/S15.7.3.1_A1_T2.js | 27 ------------------- .../Number/prototype/S15.7.3.1_A1_T3.js | 20 -------------- test/built-ins/Number/prototype/prop-desc.js | 19 +++++++++++++ 6 files changed, 39 insertions(+), 81 deletions(-) create mode 100644 test/built-ins/Number/prop-desc.js delete mode 100644 test/built-ins/Number/prototype/15.7.3.1-1.js delete mode 100644 test/built-ins/Number/prototype/S15.7.3.1_A1_T1.js delete mode 100644 test/built-ins/Number/prototype/S15.7.3.1_A1_T2.js delete mode 100644 test/built-ins/Number/prototype/S15.7.3.1_A1_T3.js create mode 100644 test/built-ins/Number/prototype/prop-desc.js diff --git a/test/built-ins/Number/prop-desc.js b/test/built-ins/Number/prop-desc.js new file mode 100644 index 0000000000..79b322472c --- /dev/null +++ b/test/built-ins/Number/prop-desc.js @@ -0,0 +1,20 @@ +// Copyright (C) 2016 The V8 Project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.1.1.1 +esid: sec-number-constructor-number-value +description: > + Property descriptor of Number +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] +---*/ + +verifyNotEnumerable(this, "Number"); +verifyWritable(this, "Number"); +verifyConfigurable(this, "Number"); diff --git a/test/built-ins/Number/prototype/15.7.3.1-1.js b/test/built-ins/Number/prototype/15.7.3.1-1.js deleted file mode 100644 index cd834c8615..0000000000 --- a/test/built-ins/Number/prototype/15.7.3.1-1.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.7.3.1-1 -description: > - Number.prototype is a data property with default attribute values - (false) ----*/ - - var d = Object.getOwnPropertyDescriptor(Number, 'prototype'); - - -assert.sameValue(d.writable, false, 'd.writable'); -assert.sameValue(d.enumerable, false, 'd.enumerable'); -assert.sameValue(d.configurable, false, 'd.configurable'); diff --git a/test/built-ins/Number/prototype/S15.7.3.1_A1_T1.js b/test/built-ins/Number/prototype/S15.7.3.1_A1_T1.js deleted file mode 100644 index bb585b229c..0000000000 --- a/test/built-ins/Number/prototype/S15.7.3.1_A1_T1.js +++ /dev/null @@ -1,18 +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 Number property "prototype" has { DontEnum, DontDelete, ReadOnly } - attributes -es5id: 15.7.3.1_A1_T1 -description: Checking if varying the Number.prototype property fails -includes: [propertyHelper.js] ----*/ - -//CHECK#1 -var x = Number.prototype; -verifyNotWritable(Number, "prototype", null, 1); -if (Number.prototype !== x) { - $ERROR('#1: The Number.prototype property has the attributes ReadOnly'); -} diff --git a/test/built-ins/Number/prototype/S15.7.3.1_A1_T2.js b/test/built-ins/Number/prototype/S15.7.3.1_A1_T2.js deleted file mode 100644 index d15410dc1c..0000000000 --- a/test/built-ins/Number/prototype/S15.7.3.1_A1_T2.js +++ /dev/null @@ -1,27 +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 Number property "prototype" has { DontEnum, DontDelete, ReadOnly } - attributes -es5id: 15.7.3.1_A1_T2 -description: Checking if deleting the Number.prototype property fails -includes: [propertyHelper.js] ----*/ - -verifyNotConfigurable(Number, "prototype"); - -// CHECK#1 -try { - if (delete Number.prototype !== false) { - $ERROR('#1: The Number.prototype property has the attributes DontDelete'); - } -} catch (e) { - if (e instanceof Test262Error) throw e; - assert(e instanceof TypeError); -} - -if (!Number.hasOwnProperty('prototype')) { - $ERROR('#2: The Number.prototype property has the attributes DontDelete'); -} diff --git a/test/built-ins/Number/prototype/S15.7.3.1_A1_T3.js b/test/built-ins/Number/prototype/S15.7.3.1_A1_T3.js deleted file mode 100644 index 1dbca405ba..0000000000 --- a/test/built-ins/Number/prototype/S15.7.3.1_A1_T3.js +++ /dev/null @@ -1,20 +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 Number property "prototype" has { DontEnum, DontDelete, ReadOnly } - attributes -es5id: 15.7.3.1_A1_T3 -description: Checking if enumerating the Number.prototype property fails ----*/ - -if (Number.propertyIsEnumerable('prototype')) { - $ERROR('#1: The Number.prototype property has the attribute DontEnum'); -} - -for(var x in Number) { - if(x === "prototype") { - $ERROR('#2: The Number.prototype has the attribute DontEnum'); - } -} diff --git a/test/built-ins/Number/prototype/prop-desc.js b/test/built-ins/Number/prototype/prop-desc.js new file mode 100644 index 0000000000..17e3a42131 --- /dev/null +++ b/test/built-ins/Number/prototype/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2016 The V8 Project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.1.2.15 +esid: sec-number.prototype +description: > + "prototype" property of Number +info: > + Number.prototype + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: false }. +includes: [propertyHelper.js] +---*/ + +verifyNotEnumerable(Number, "prototype"); +verifyNotWritable(Number, "prototype"); +verifyNotConfigurable(Number, "prototype"); -- GitLab