Skip to content
Snippets Groups Projects
Commit 9223f563 authored by Leonardo Balter's avatar Leonardo Balter Committed by Mike Pennisi
Browse files

Update and add basic prop-desc tests for Number

and Number.prototype
parent 8066b9ec
No related branches found
No related tags found
No related merge requests found
// 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");
// 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');
// 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');
}
// 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');
}
// 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');
}
}
// 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");
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment