From 9cd62ffbd70aa1f08b55730429e60fa9e14559c5 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Tue, 24 Sep 2019 14:13:59 -0400 Subject: [PATCH] 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();