Improve coverage: value props of the global object

Prior to this commit, the enumerability of the value properties of the
global object were only verified in strict mode, the assertions occured
in the same file, and that file test was poorly located.

Restructure the relevant tests to improve coverage, follow convention,
and promote discoverability.
This commit is contained in:
Mike Pennisi 2019-09-24 13:10:38 -04:00
parent f5d60d4192
commit f8957be8a7
9 changed files with 51 additions and 117 deletions

View File

@ -1,15 +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 Infinity is ReadOnly
es5id: 15.1.1.2_A2_T1
description: Checking typeof Functions
includes: [propertyHelper.js]
---*/
// CHECK#1
verifyNotWritable(this, "Infinity", null, true);
if (typeof(Infinity) === "boolean") {
$ERROR('#1: Infinity = true; typeof(Infinity) !== "boolean". Actual: ' + (typeof(Infinity)));
}

View File

@ -1,21 +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 Infinity is DontDelete
es5id: 15.1.1.2_A3_T1
description: Use delete
includes: [propertyHelper.js]
---*/
// CHECK#1
verifyNotConfigurable(this, "Infinity");
try {
if (delete this.Infinity !== false) {
$ERROR('#1: delete Infinity === false.');
}
} catch (e) {
if (e instanceof Test262Error) throw e;
assert(e instanceof TypeError);
}

View File

@ -0,0 +1,17 @@
// Copyright (C) 2019 Bocoup. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-value-properties-of-the-global-object-infinity
description: Property descriptor of Infinity
info: |
This property has the attributes { [[Writable]]: false, [[Enumerable]]:
false, [[Configurable]]: false }.
includes: [propertyHelper.js]
---*/
verifyProperty(this, "Infinity", {
enumerable: false,
writable: false,
configurable: false
});

View File

@ -1,15 +0,0 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: The NaN is ReadOnly
es5id: 15.1.1.1_A2_T1
description: Checking typeof Functions
includes: [propertyHelper.js]
---*/
// CHECK#1
verifyNotWritable(this, "NaN", null, true);
if (typeof(NaN) === "boolean") {
$ERROR('#1: NaN = true; typeof(NaN) !== "boolean". Actual: ' + (typeof(NaN)));
}

View File

@ -1,21 +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 NaN is DontDelete
es5id: 15.1.1.2_A3_T1
description: Use delete
includes: [propertyHelper.js]
---*/
// CHECK#1
verifyNotConfigurable(this, "NaN");
try {
if (delete this.NaN !== false) {
$ERROR('#1: delete NaN === false.');
}
} catch (e) {
if (e instanceof Test262Error) throw e;
assert(e instanceof TypeError);
}

View File

@ -0,0 +1,17 @@
// Copyright (C) 2019 Bocoup. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-value-properties-of-the-global-object-nan
description: Property descriptor of NaN
info: |
This property has the attributes { [[Writable]]: false, [[Enumerable]]:
false, [[Configurable]]: false }.
includes: [propertyHelper.js]
---*/
verifyProperty(this, "NaN", {
enumerable: false,
writable: false,
configurable: false
});

View File

@ -1,24 +0,0 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Global object properties have attributes { DontEnum }
es5id: 10.2.3_A2.2_T1
description: Function execution context - Value Properties
flags: [noStrict]
---*/
function test() {
//CHECK#1
for (var x in this) {
if (x === 'NaN') {
$ERROR("#1: 'NaN' have attribute DontEnum");
} else if (x === 'Infinity') {
$ERROR("#1: 'Infinity' have attribute DontEnum");
} else if (x === 'undefined') {
$ERROR("#1: 'undefined' have attribute DontEnum");
}
}
}
test();

View File

@ -1,21 +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 undefined is DontDelete
esid: sec-undefined
description: Use delete
includes: [propertyHelper.js]
---*/
// CHECK#1
verifyNotConfigurable(this, "undefined");
try {
if (delete this.undefined !== false) {
$ERROR('#1: delete undefined === false.');
}
} catch (e) {
if (e instanceof Test262Error) throw e;
assert(e instanceof TypeError);
}

View File

@ -0,0 +1,17 @@
// Copyright (C) 2019 Bocoup. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-undefined
description: Property descriptor of undefined
info: |
This property has the attributes { [[Writable]]: false, [[Enumerable]]:
false, [[Configurable]]: false }.
includes: [propertyHelper.js]
---*/
verifyProperty(this, "undefined", {
enumerable: false,
writable: false,
configurable: false
});