Update and add basic prop-desc tests for Number

and Number.prototype
This commit is contained in:
Leonardo Balter 2016-06-21 13:26:20 -04:00 committed by Mike Pennisi
parent 8066b9ecaf
commit 9223f56344
6 changed files with 39 additions and 81 deletions

View File

@ -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");

View File

@ -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');

View File

@ -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');
}

View File

@ -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');
}

View File

@ -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');
}
}

View File

@ -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");