From f5d60d419229209d4fec79b83123b13df3ad6e79 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Mon, 23 Sep 2019 19:28:34 -0400 Subject: [PATCH 1/5] Improve coverage The modified tests are equally valid in strict mode and outside of strict mode. Remove the flag which limits their use to only one of these two contexts. Rename tests using the legacy ES5-based naming scheme to remove the pattern which designates strict mode. --- .../Map/prototype/forEach/callback-result-is-abrupt.js | 1 - .../global/{10.2.1.1.3-4-22-s.js => 10.2.1.1.3-4-22.js} | 6 ++---- .../global/{10.2.1.1.3-4-27-s.js => 10.2.1.1.3-4-27.js} | 6 ++---- .../yield-as-generator-method-binding-identifier.js | 4 +--- .../postfix-increment/{11.3.1-2-3-s.js => 11.3.1-2-3.js} | 5 ++--- .../expressions/this/{11.1.1-1gs.js => 11.1.1-1.js} | 5 +---- test/language/expressions/this/S11.1.1_A3.2.js | 1 - 7 files changed, 8 insertions(+), 20 deletions(-) rename test/built-ins/global/{10.2.1.1.3-4-22-s.js => 10.2.1.1.3-4-22.js} (60%) rename test/built-ins/global/{10.2.1.1.3-4-27-s.js => 10.2.1.1.3-4-27.js} (60%) rename test/language/expressions/postfix-increment/{11.3.1-2-3-s.js => 11.3.1-2-3.js} (69%) rename test/language/expressions/this/{11.1.1-1gs.js => 11.1.1-1.js} (64%) diff --git a/test/built-ins/Map/prototype/forEach/callback-result-is-abrupt.js b/test/built-ins/Map/prototype/forEach/callback-result-is-abrupt.js index d61bb4e2db..7d6acbe7ef 100644 --- a/test/built-ins/Map/prototype/forEach/callback-result-is-abrupt.js +++ b/test/built-ins/Map/prototype/forEach/callback-result-is-abrupt.js @@ -16,7 +16,6 @@ info: | i. Let funcResult be Call(callbackfn, T, «e.[[value]], e.[[key]], M»). ii. ReturnIfAbrupt(funcResult). ... -flags: [noStrict] ---*/ var map = new Map([[0, 0]]); diff --git a/test/built-ins/global/10.2.1.1.3-4-22-s.js b/test/built-ins/global/10.2.1.1.3-4-22.js similarity index 60% rename from test/built-ins/global/10.2.1.1.3-4-22-s.js rename to test/built-ins/global/10.2.1.1.3-4-22.js index 6bcae23963..542460687c 100644 --- a/test/built-ins/global/10.2.1.1.3-4-22-s.js +++ b/test/built-ins/global/10.2.1.1.3-4-22.js @@ -4,10 +4,8 @@ /*--- es5id: 10.2.1.1.3-4-22-s description: > - Strict Mode - TypeError is not thrown when changing the value of - the Constructor Properties of the Global Object under strict mode - (Object) -flags: [onlyStrict] + TypeError is not thrown when changing the value of the Constructor Properties + of the Global Object ---*/ var objBak = Object; diff --git a/test/built-ins/global/10.2.1.1.3-4-27-s.js b/test/built-ins/global/10.2.1.1.3-4-27.js similarity index 60% rename from test/built-ins/global/10.2.1.1.3-4-27-s.js rename to test/built-ins/global/10.2.1.1.3-4-27.js index cb8f60ae48..adc96d9000 100644 --- a/test/built-ins/global/10.2.1.1.3-4-27-s.js +++ b/test/built-ins/global/10.2.1.1.3-4-27.js @@ -4,10 +4,8 @@ /*--- es5id: 10.2.1.1.3-4-27-s description: > - Strict Mode - TypeError is not thrown when changing the value of - the Constructor Properties of the Global Object under strict mode - (Number) -flags: [onlyStrict] + TypeError is not thrown when changing the value of the Constructor Properties + of the Global Object (Number) ---*/ var numBak = Number; diff --git a/test/language/expressions/object/method-definition/yield-as-generator-method-binding-identifier.js b/test/language/expressions/object/method-definition/yield-as-generator-method-binding-identifier.js index b2a125af66..03fd4ee6b0 100644 --- a/test/language/expressions/object/method-definition/yield-as-generator-method-binding-identifier.js +++ b/test/language/expressions/object/method-definition/yield-as-generator-method-binding-identifier.js @@ -3,11 +3,9 @@ /*--- description: > - `yield` is a valid BindingIdentifier for GeneratorMethods outside of - strict mode. + `yield` is a valid BindingIdentifier for GeneratorMethods features: [generators] es6id: 12.1.1 - flags: [noStrict] ---*/ var iter, result; diff --git a/test/language/expressions/postfix-increment/11.3.1-2-3-s.js b/test/language/expressions/postfix-increment/11.3.1-2-3.js similarity index 69% rename from test/language/expressions/postfix-increment/11.3.1-2-3-s.js rename to test/language/expressions/postfix-increment/11.3.1-2-3.js index ac7b860457..d1d6e56c2e 100644 --- a/test/language/expressions/postfix-increment/11.3.1-2-3-s.js +++ b/test/language/expressions/postfix-increment/11.3.1-2-3.js @@ -4,9 +4,8 @@ /*--- es5id: 11.3.1-2-3-s description: > - Strict Mode - SyntaxError is not thrown if the identifier - 'arguments[...]' appears as a PostfixExpression(arguments++) -flags: [onlyStrict] + SyntaxError is not thrown if the identifier 'arguments[...]' appears as a + PostfixExpression(arguments++) ---*/ function testcase() { diff --git a/test/language/expressions/this/11.1.1-1gs.js b/test/language/expressions/this/11.1.1-1.js similarity index 64% rename from test/language/expressions/this/11.1.1-1gs.js rename to test/language/expressions/this/11.1.1-1.js index 569fc6139a..8f7b954c9a 100644 --- a/test/language/expressions/this/11.1.1-1gs.js +++ b/test/language/expressions/this/11.1.1-1.js @@ -3,10 +3,7 @@ /*--- es5id: 11.1.1-1gs -description: Strict Mode - 'this' object at the global scope is not undefined -flags: [onlyStrict] +description: the 'this' object at the global scope is not undefined ---*/ -"use strict"; - assert.notSameValue(this, undefined); diff --git a/test/language/expressions/this/S11.1.1_A3.2.js b/test/language/expressions/this/S11.1.1_A3.2.js index e27889d0a1..56718518ba 100644 --- a/test/language/expressions/this/S11.1.1_A3.2.js +++ b/test/language/expressions/this/S11.1.1_A3.2.js @@ -7,7 +7,6 @@ info: | constructors, return the object es5id: 11.1.1_A3.2 description: Create function. It have property, that returned "this" -flags: [noStrict] ---*/ //CHECK#1 From f8957be8a73e13c87b4592c9a008f585daefb30b Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Tue, 24 Sep 2019 13:10:38 -0400 Subject: [PATCH 2/5] 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. --- test/built-ins/Infinity/S15.1.1.2_A2_T1.js | 15 ------------- test/built-ins/Infinity/S15.1.1.2_A3_T1.js | 21 ------------------ test/built-ins/Infinity/prop-desc.js | 17 +++++++++++++++ test/built-ins/NaN/S15.1.1.1_A2_T1.js | 15 ------------- test/built-ins/NaN/S15.1.1.1_A3_T1.js | 21 ------------------ test/built-ins/NaN/prop-desc.js | 17 +++++++++++++++ test/built-ins/global/S10.2.3_A2.2_T1.js | 24 --------------------- test/built-ins/undefined/S15.1.1.3_A3_T1.js | 21 ------------------ test/built-ins/undefined/prop-desc.js | 17 +++++++++++++++ 9 files changed, 51 insertions(+), 117 deletions(-) delete mode 100644 test/built-ins/Infinity/S15.1.1.2_A2_T1.js delete mode 100644 test/built-ins/Infinity/S15.1.1.2_A3_T1.js create mode 100644 test/built-ins/Infinity/prop-desc.js delete mode 100644 test/built-ins/NaN/S15.1.1.1_A2_T1.js delete mode 100644 test/built-ins/NaN/S15.1.1.1_A3_T1.js create mode 100644 test/built-ins/NaN/prop-desc.js delete mode 100644 test/built-ins/global/S10.2.3_A2.2_T1.js delete mode 100644 test/built-ins/undefined/S15.1.1.3_A3_T1.js create mode 100644 test/built-ins/undefined/prop-desc.js diff --git a/test/built-ins/Infinity/S15.1.1.2_A2_T1.js b/test/built-ins/Infinity/S15.1.1.2_A2_T1.js deleted file mode 100644 index 1575771b24..0000000000 --- a/test/built-ins/Infinity/S15.1.1.2_A2_T1.js +++ /dev/null @@ -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))); -} diff --git a/test/built-ins/Infinity/S15.1.1.2_A3_T1.js b/test/built-ins/Infinity/S15.1.1.2_A3_T1.js deleted file mode 100644 index 2674825444..0000000000 --- a/test/built-ins/Infinity/S15.1.1.2_A3_T1.js +++ /dev/null @@ -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); -} diff --git a/test/built-ins/Infinity/prop-desc.js b/test/built-ins/Infinity/prop-desc.js new file mode 100644 index 0000000000..19f775da29 --- /dev/null +++ b/test/built-ins/Infinity/prop-desc.js @@ -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 +}); diff --git a/test/built-ins/NaN/S15.1.1.1_A2_T1.js b/test/built-ins/NaN/S15.1.1.1_A2_T1.js deleted file mode 100644 index 0fe23aa65e..0000000000 --- a/test/built-ins/NaN/S15.1.1.1_A2_T1.js +++ /dev/null @@ -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))); -} diff --git a/test/built-ins/NaN/S15.1.1.1_A3_T1.js b/test/built-ins/NaN/S15.1.1.1_A3_T1.js deleted file mode 100644 index fba6441c96..0000000000 --- a/test/built-ins/NaN/S15.1.1.1_A3_T1.js +++ /dev/null @@ -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); -} diff --git a/test/built-ins/NaN/prop-desc.js b/test/built-ins/NaN/prop-desc.js new file mode 100644 index 0000000000..1d86ac75de --- /dev/null +++ b/test/built-ins/NaN/prop-desc.js @@ -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 +}); diff --git a/test/built-ins/global/S10.2.3_A2.2_T1.js b/test/built-ins/global/S10.2.3_A2.2_T1.js deleted file mode 100644 index 427a4bcf5f..0000000000 --- a/test/built-ins/global/S10.2.3_A2.2_T1.js +++ /dev/null @@ -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(); diff --git a/test/built-ins/undefined/S15.1.1.3_A3_T1.js b/test/built-ins/undefined/S15.1.1.3_A3_T1.js deleted file mode 100644 index 6fff629f87..0000000000 --- a/test/built-ins/undefined/S15.1.1.3_A3_T1.js +++ /dev/null @@ -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); -} diff --git a/test/built-ins/undefined/prop-desc.js b/test/built-ins/undefined/prop-desc.js new file mode 100644 index 0000000000..2d7426cd21 --- /dev/null +++ b/test/built-ins/undefined/prop-desc.js @@ -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 +}); From 1f079a352573b517551b579859396c40ec3f7c09 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Tue, 24 Sep 2019 13:46:21 -0400 Subject: [PATCH 3/5] 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. --- test/built-ins/decodeURI/prop-desc.js | 17 +++++++++ .../built-ins/decodeURIComponent/prop-desc.js | 16 +++++++++ test/built-ins/encodeURI/prop-desc.js | 16 +++++++++ .../built-ins/encodeURIComponent/prop-desc.js | 16 +++++++++ test/built-ins/eval/prop-desc-enumerable.js | 25 ------------- test/built-ins/eval/prop-desc.js | 16 +++++++++ test/built-ins/global/S10.2.3_A2.2_T2.js | 36 ------------------- test/built-ins/parseFloat/prop-desc.js | 17 +++++++++ test/built-ins/parseInt/prop-desc.js | 16 +++++++++ 9 files changed, 114 insertions(+), 61 deletions(-) create mode 100644 test/built-ins/decodeURI/prop-desc.js create mode 100644 test/built-ins/decodeURIComponent/prop-desc.js create mode 100644 test/built-ins/encodeURI/prop-desc.js create mode 100644 test/built-ins/encodeURIComponent/prop-desc.js delete mode 100644 test/built-ins/eval/prop-desc-enumerable.js create mode 100644 test/built-ins/eval/prop-desc.js delete mode 100644 test/built-ins/global/S10.2.3_A2.2_T2.js create mode 100644 test/built-ins/parseFloat/prop-desc.js create mode 100644 test/built-ins/parseInt/prop-desc.js diff --git a/test/built-ins/decodeURI/prop-desc.js b/test/built-ins/decodeURI/prop-desc.js new file mode 100644 index 0000000000..8f599cb66e --- /dev/null +++ b/test/built-ins/decodeURI/prop-desc.js @@ -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"); diff --git a/test/built-ins/decodeURIComponent/prop-desc.js b/test/built-ins/decodeURIComponent/prop-desc.js new file mode 100644 index 0000000000..820c51678f --- /dev/null +++ b/test/built-ins/decodeURIComponent/prop-desc.js @@ -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"); diff --git a/test/built-ins/encodeURI/prop-desc.js b/test/built-ins/encodeURI/prop-desc.js new file mode 100644 index 0000000000..72ca41f8f9 --- /dev/null +++ b/test/built-ins/encodeURI/prop-desc.js @@ -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"); diff --git a/test/built-ins/encodeURIComponent/prop-desc.js b/test/built-ins/encodeURIComponent/prop-desc.js new file mode 100644 index 0000000000..59b3eb586d --- /dev/null +++ b/test/built-ins/encodeURIComponent/prop-desc.js @@ -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"); diff --git a/test/built-ins/eval/prop-desc-enumerable.js b/test/built-ins/eval/prop-desc-enumerable.js deleted file mode 100644 index 08a2a13963..0000000000 --- a/test/built-ins/eval/prop-desc-enumerable.js +++ /dev/null @@ -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;'); -} diff --git a/test/built-ins/eval/prop-desc.js b/test/built-ins/eval/prop-desc.js new file mode 100644 index 0000000000..33220788fa --- /dev/null +++ b/test/built-ins/eval/prop-desc.js @@ -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"); diff --git a/test/built-ins/global/S10.2.3_A2.2_T2.js b/test/built-ins/global/S10.2.3_A2.2_T2.js deleted file mode 100644 index 1a7ca58628..0000000000 --- a/test/built-ins/global/S10.2.3_A2.2_T2.js +++ /dev/null @@ -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(); diff --git a/test/built-ins/parseFloat/prop-desc.js b/test/built-ins/parseFloat/prop-desc.js new file mode 100644 index 0000000000..5016eb1834 --- /dev/null +++ b/test/built-ins/parseFloat/prop-desc.js @@ -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"); diff --git a/test/built-ins/parseInt/prop-desc.js b/test/built-ins/parseInt/prop-desc.js new file mode 100644 index 0000000000..9b148ad0bf --- /dev/null +++ b/test/built-ins/parseInt/prop-desc.js @@ -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"); From 9cd62ffbd70aa1f08b55730429e60fa9e14559c5 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Tue, 24 Sep 2019 14:13:59 -0400 Subject: [PATCH 4/5] Improve coverage: ctor props of the global object Prior to this commit, the descriptors of the constructor 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. --- test/built-ins/Boolean/prop-desc.js | 16 +++++++ test/built-ins/Date/prop-desc.js | 16 +++++++ test/built-ins/Error/prop-desc.js | 16 +++++++ test/built-ins/Function/prop-desc.js | 16 +++++++ .../NativeErrors/EvalError/prop-desc.js | 16 +++++++ .../NativeErrors/RangeError/prop-desc.js | 16 +++++++ .../NativeErrors/ReferenceError/prop-desc.js | 16 +++++++ .../NativeErrors/SyntaxError/prop-desc.js | 16 +++++++ .../NativeErrors/TypeError/prop-desc.js | 16 +++++++ .../NativeErrors/URIError/prop-desc.js | 16 +++++++ test/built-ins/Object/prop-desc.js | 16 +++++++ test/built-ins/RegExp/prop-desc.js | 16 +++++++ test/built-ins/String/prop-desc.js | 16 +++++++ test/built-ins/global/S10.2.3_A2.2_T3.js | 48 ------------------- 14 files changed, 208 insertions(+), 48 deletions(-) create mode 100644 test/built-ins/Boolean/prop-desc.js create mode 100644 test/built-ins/Date/prop-desc.js create mode 100644 test/built-ins/Error/prop-desc.js create mode 100644 test/built-ins/Function/prop-desc.js create mode 100644 test/built-ins/NativeErrors/EvalError/prop-desc.js create mode 100644 test/built-ins/NativeErrors/RangeError/prop-desc.js create mode 100644 test/built-ins/NativeErrors/ReferenceError/prop-desc.js create mode 100644 test/built-ins/NativeErrors/SyntaxError/prop-desc.js create mode 100644 test/built-ins/NativeErrors/TypeError/prop-desc.js create mode 100644 test/built-ins/NativeErrors/URIError/prop-desc.js create mode 100644 test/built-ins/Object/prop-desc.js create mode 100644 test/built-ins/RegExp/prop-desc.js create mode 100644 test/built-ins/String/prop-desc.js delete mode 100644 test/built-ins/global/S10.2.3_A2.2_T3.js diff --git a/test/built-ins/Boolean/prop-desc.js b/test/built-ins/Boolean/prop-desc.js new file mode 100644 index 0000000000..e3d5a7573f --- /dev/null +++ b/test/built-ins/Boolean/prop-desc.js @@ -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-constructor-properties-of-the-global-object-boolean +description: Property descriptor for Boolean +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, "Boolean"); +verifyWritable(this, "Boolean"); +verifyConfigurable(this, "Boolean"); diff --git a/test/built-ins/Date/prop-desc.js b/test/built-ins/Date/prop-desc.js new file mode 100644 index 0000000000..e8e26f20ba --- /dev/null +++ b/test/built-ins/Date/prop-desc.js @@ -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-constructor-properties-of-the-global-object-date +description: Property descriptor for Date +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, "Date"); +verifyWritable(this, "Date"); +verifyConfigurable(this, "Date"); diff --git a/test/built-ins/Error/prop-desc.js b/test/built-ins/Error/prop-desc.js new file mode 100644 index 0000000000..658d9c96fa --- /dev/null +++ b/test/built-ins/Error/prop-desc.js @@ -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-constructor-properties-of-the-global-object-error +description: Property descriptor for Error +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, "Error"); +verifyWritable(this, "Error"); +verifyConfigurable(this, "Error"); diff --git a/test/built-ins/Function/prop-desc.js b/test/built-ins/Function/prop-desc.js new file mode 100644 index 0000000000..4a86757e38 --- /dev/null +++ b/test/built-ins/Function/prop-desc.js @@ -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-constructor-properties-of-the-global-object-function +description: Property descriptor for Function +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, "Function"); +verifyWritable(this, "Function"); +verifyConfigurable(this, "Function"); diff --git a/test/built-ins/NativeErrors/EvalError/prop-desc.js b/test/built-ins/NativeErrors/EvalError/prop-desc.js new file mode 100644 index 0000000000..620d3d8a1c --- /dev/null +++ b/test/built-ins/NativeErrors/EvalError/prop-desc.js @@ -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-constructor-properties-of-the-global-object-evalerror +description: Property descriptor for EvalError +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, "EvalError"); +verifyWritable(this, "EvalError"); +verifyConfigurable(this, "EvalError"); diff --git a/test/built-ins/NativeErrors/RangeError/prop-desc.js b/test/built-ins/NativeErrors/RangeError/prop-desc.js new file mode 100644 index 0000000000..9d31ccf85e --- /dev/null +++ b/test/built-ins/NativeErrors/RangeError/prop-desc.js @@ -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-constructor-properties-of-the-global-object-rangeerror +description: Property descriptor for RangeError +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, "RangeError"); +verifyWritable(this, "RangeError"); +verifyConfigurable(this, "RangeError"); diff --git a/test/built-ins/NativeErrors/ReferenceError/prop-desc.js b/test/built-ins/NativeErrors/ReferenceError/prop-desc.js new file mode 100644 index 0000000000..5e5e0d747a --- /dev/null +++ b/test/built-ins/NativeErrors/ReferenceError/prop-desc.js @@ -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-constructor-properties-of-the-global-object-referenceerror +description: Property descriptor for ReferenceError +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, "ReferenceError"); +verifyWritable(this, "ReferenceError"); +verifyConfigurable(this, "ReferenceError"); diff --git a/test/built-ins/NativeErrors/SyntaxError/prop-desc.js b/test/built-ins/NativeErrors/SyntaxError/prop-desc.js new file mode 100644 index 0000000000..7e204af2d0 --- /dev/null +++ b/test/built-ins/NativeErrors/SyntaxError/prop-desc.js @@ -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-constructor-properties-of-the-global-object-syntaxerror +description: Property descriptor for SyntaxError +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, "SyntaxError"); +verifyWritable(this, "SyntaxError"); +verifyConfigurable(this, "SyntaxError"); diff --git a/test/built-ins/NativeErrors/TypeError/prop-desc.js b/test/built-ins/NativeErrors/TypeError/prop-desc.js new file mode 100644 index 0000000000..755843e6c0 --- /dev/null +++ b/test/built-ins/NativeErrors/TypeError/prop-desc.js @@ -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-constructor-properties-of-the-global-object-typeerror +description: Property descriptor for TypeError +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, "TypeError"); +verifyWritable(this, "TypeError"); +verifyConfigurable(this, "TypeError"); diff --git a/test/built-ins/NativeErrors/URIError/prop-desc.js b/test/built-ins/NativeErrors/URIError/prop-desc.js new file mode 100644 index 0000000000..447a84c651 --- /dev/null +++ b/test/built-ins/NativeErrors/URIError/prop-desc.js @@ -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-constructor-properties-of-the-global-object-urierror +description: Property descriptor for URIError +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, "URIError"); +verifyWritable(this, "URIError"); +verifyConfigurable(this, "URIError"); diff --git a/test/built-ins/Object/prop-desc.js b/test/built-ins/Object/prop-desc.js new file mode 100644 index 0000000000..c0bce6dad7 --- /dev/null +++ b/test/built-ins/Object/prop-desc.js @@ -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-constructor-properties-of-the-global-object-object +description: Property descriptor for Object +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, "Object"); +verifyWritable(this, "Object"); +verifyConfigurable(this, "Object"); diff --git a/test/built-ins/RegExp/prop-desc.js b/test/built-ins/RegExp/prop-desc.js new file mode 100644 index 0000000000..feb3b59e79 --- /dev/null +++ b/test/built-ins/RegExp/prop-desc.js @@ -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-constructor-properties-of-the-global-object-regexp +description: Property descriptor for RegExp +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, "RegExp"); +verifyWritable(this, "RegExp"); +verifyConfigurable(this, "RegExp"); diff --git a/test/built-ins/String/prop-desc.js b/test/built-ins/String/prop-desc.js new file mode 100644 index 0000000000..b8bf525af9 --- /dev/null +++ b/test/built-ins/String/prop-desc.js @@ -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-constructor-properties-of-the-global-object-string +description: Property descriptor for String +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, "String"); +verifyWritable(this, "String"); +verifyConfigurable(this, "String"); diff --git a/test/built-ins/global/S10.2.3_A2.2_T3.js b/test/built-ins/global/S10.2.3_A2.2_T3.js deleted file mode 100644 index ee17f77c4d..0000000000 --- a/test/built-ins/global/S10.2.3_A2.2_T3.js +++ /dev/null @@ -1,48 +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_T3 -description: Function execution context - Constructor Properties -flags: [noStrict] ----*/ - -function test() { - //CHECK#1 - for (var x in this) { - if (x === 'Object') { - $ERROR("#1: 'property 'Object' have attribute DontEnum"); - } else if (x === 'Function') { - $ERROR("#1: 'Function' have attribute DontEnum"); - } else if (x === 'String') { - $ERROR("#1: 'String' have attribute DontEnum"); - } else if (x === 'Number') { - $ERROR("#1: 'Number' have attribute DontEnum"); - } else if (x === 'Array') { - $ERROR("#1: 'Array' have attribute DontEnum"); - } else if (x === 'Boolean') { - $ERROR("#1: 'Boolean' have attribute DontEnum"); - } else if (x === 'Date') { - $ERROR("#1: 'Date' have attribute DontEnum"); - } else if (x === 'RegExp') { - $ERROR("#1: 'RegExp' have attribute DontEnum"); - } else if (x === 'Error') { - $ERROR("#1: 'Error' have attribute DontEnum"); - } else if (x === 'EvalError') { - $ERROR("#1: 'EvalError' have attribute DontEnum"); - } else if (x === 'RangeError') { - $ERROR("#1: 'RangeError' have attribute DontEnum"); - } else if (x === 'ReferenceError') { - $ERROR("#1: 'ReferenceError' have attribute DontEnum"); - } else if (x === 'SyntaxError') { - $ERROR("#1: 'SyntaxError' have attribute DontEnum"); - } else if (x === 'TypeError') { - $ERROR("#1: 'TypeError' have attribute DontEnum"); - } else if (x === 'URIError') { - $ERROR("#1: 'URIError' have attribute DontEnum"); - } - } -} - -test(); From d4a91a163b1a99e42bae0a74fe9636ed44d7b1e4 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Tue, 24 Sep 2019 16:45:56 -0400 Subject: [PATCH 5/5] Improve coverage: function declarations Previously, these tests were limited to strict mode. The syntactic restriction under test also applied outside of strict mode even when Annex B is observed, so configure the tests to also run outside of strict mode. --- .../in-statement-position-do-statement-while-expression.js | 3 +-- .../in-statement-position-for-statement.js | 3 +-- .../in-statement-position-while-expression-statement.js | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-do-statement-while-expression.js b/test/language/block-scope/syntax/function-declarations/in-statement-position-do-statement-while-expression.js index 1912694265..c9f35f2ed1 100644 --- a/test/language/block-scope/syntax/function-declarations/in-statement-position-do-statement-while-expression.js +++ b/test/language/block-scope/syntax/function-declarations/in-statement-position-do-statement-while-expression.js @@ -3,12 +3,11 @@ /*--- es6id: 13.1 description: > - function declarations in statement position in strict mode: + function declarations in statement position: do Statement while ( Expression ) negative: phase: parse type: SyntaxError -flags: [onlyStrict] ---*/ $DONOTEVALUATE(); diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-for-statement.js b/test/language/block-scope/syntax/function-declarations/in-statement-position-for-statement.js index 52628c11d4..bd5d9fb7de 100644 --- a/test/language/block-scope/syntax/function-declarations/in-statement-position-for-statement.js +++ b/test/language/block-scope/syntax/function-declarations/in-statement-position-for-statement.js @@ -3,12 +3,11 @@ /*--- es6id: 13.1 description: > - function declarations in statement position in strict mode: + function declarations in statement position: for ( ;;) Statement negative: phase: parse type: SyntaxError -flags: [onlyStrict] ---*/ $DONOTEVALUATE(); diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-while-expression-statement.js b/test/language/block-scope/syntax/function-declarations/in-statement-position-while-expression-statement.js index 85d0135301..740bf874ff 100644 --- a/test/language/block-scope/syntax/function-declarations/in-statement-position-while-expression-statement.js +++ b/test/language/block-scope/syntax/function-declarations/in-statement-position-while-expression-statement.js @@ -3,12 +3,11 @@ /*--- es6id: 13.1 description: > - function declarations in statement position in strict mode: + function declarations in statement position: while ( Expression ) Statement negative: phase: parse type: SyntaxError -flags: [onlyStrict] ---*/ $DONOTEVALUATE();