Improve coverage: func props of the global object

Prior to this commit, the descriptors of the function properties of the
global object were verified inconsistently, many independent 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:46:21 -04:00
parent f8957be8a7
commit 1f079a3525
9 changed files with 114 additions and 61 deletions

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-decodeuri-encodeduri
description: >
Property descriptor for decodeURI
info: |
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, "decodeURI");
verifyWritable(this, "decodeURI");
verifyConfigurable(this, "decodeURI");

View File

@ -0,0 +1,16 @@
// Copyright (C) 2019 Bocoup. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-decodeuricomponent-encodeduricomponent
description: Property descriptor for decodeURIComponent
info: |
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, "decodeURIComponent");
verifyWritable(this, "decodeURIComponent");
verifyConfigurable(this, "decodeURIComponent");

View File

@ -0,0 +1,16 @@
// Copyright (C) 2019 Bocoup. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-encodeuri-uri
description: Property descriptor for encodeURI
info: |
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, "encodeURI");
verifyWritable(this, "encodeURI");
verifyConfigurable(this, "encodeURI");

View File

@ -0,0 +1,16 @@
// Copyright (C) 2019 Bocoup. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-encodeuricomponent-uricomponent
description: Property descriptor for encodeURIComponent
info: |
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, "encodeURIComponent");
verifyWritable(this, "encodeURIComponent");
verifyConfigurable(this, "encodeURIComponent");

View File

@ -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 eval property has the attribute DontEnum
esid: sec-eval-x
description: Checking use propertyIsEnumerable, for-in
---*/
//CHECK#1
if (this.propertyIsEnumerable('eval') !== false) {
$ERROR('#1: this.propertyIsEnumerable(\'eval\') === false. Actual: ' + (this.propertyIsEnumerable('eval')));
}
//CHECK#2
var result = true;
for (var p in this) {
if (p === "eval") {
result = false;
}
}
if (result !== true) {
$ERROR('#2: result = true; for (p in this) { if (p === "eval") result = false; } result === true;');
}

View File

@ -0,0 +1,16 @@
// Copyright (C) 2019 Bocoup. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-eval-x
description: Property descriptor for eval
info: |
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, "eval");
verifyWritable(this, "eval");
verifyConfigurable(this, "eval");

View File

@ -1,36 +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_T2
description: Function execution context - Function Properties
flags: [noStrict]
---*/
function test() {
//CHECK#1
for (var x in this) {
if (x === 'eval') {
$ERROR("#1: 'eval' have attribute DontEnum");
} else if (x === 'parseInt') {
$ERROR("#1: 'parseInt' have attribute DontEnum");
} else if (x === 'parseFloat') {
$ERROR("#1: 'parseFloat' have attribute DontEnum");
} else if (x === 'isNaN') {
$ERROR("#1: 'isNaN' have attribute DontEnum");
} else if (x === 'isFinite') {
$ERROR("#1: 'isFinite' have attribute DontEnum");
} else if (x === 'decodeURI') {
$ERROR("#1: 'decodeURI' have attribute DontEnum");
} else if (x === 'decodeURIComponent') {
$ERROR("#1: 'decodeURIComponent' have attribute DontEnum");
} else if (x === 'encodeURI') {
$ERROR("#1: 'encodeURI' have attribute DontEnum");
} else if (x === 'encodeURIComponent') {
$ERROR("#1: 'encodeURIComponent' have attribute DontEnum");
}
}
}
test();

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-parsefloat-string
description: >
Property descriptor for parseFloat
info: |
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, "parseFloat");
verifyWritable(this, "parseFloat");
verifyConfigurable(this, "parseFloat");

View File

@ -0,0 +1,16 @@
// Copyright (C) 2019 Bocoup. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-parseint-string-radix
description: Property descriptor for parseInt
info: |
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, "parseInt");
verifyWritable(this, "parseInt");
verifyConfigurable(this, "parseInt");