Move remaining testBuiltInObject callers to use normal assert calls

This commit is contained in:
André Bargull 2017-12-21 12:08:29 -08:00 committed by Rick Waldron
parent c81370348d
commit 60692bb6e0
21 changed files with 314 additions and 38 deletions

View File

@ -1,3 +1,4 @@
typeCoercion.js: [Symbol.toPrimitive, BigInt]
testAtomics.js: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, arrow-function, let, for-of]
testTypedArray.js: [TypedArray]
isConstructor.js: [Reflect.construct]

16
harness/isConstructor.js Normal file
View File

@ -0,0 +1,16 @@
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Test if a given function is a constructor function.
---*/
function isConstructor(f) {
try {
Reflect.construct(function(){}, [], f);
} catch (e) {
return false;
}
return true;
}

View File

@ -9,7 +9,22 @@ description: >
built-in objects defined by the introduction of chapter 17 of the
ECMAScript Language Specification.
author: Norbert Lindenberg
includes: [testBuiltInObject.js]
includes: [isConstructor.js]
---*/
testBuiltInObject(new Intl.Collator().compare);
var compareFn = new Intl.Collator().compare;
assert.sameValue(Object.prototype.toString.call(compareFn), "[object Function]",
"The [[Class]] internal property of a built-in function must be " +
"\"Function\".");
assert(Object.isExtensible(compareFn),
"Built-in objects must be extensible.");
assert.sameValue(Object.getPrototypeOf(compareFn), Function.prototype);
assert.sameValue(compareFn.hasOwnProperty("prototype"), false,
"Built-in functions that aren't constructors must not have a prototype property.");
assert.sameValue(isConstructor(compareFn), false,
"Built-in functions don't implement [[Construct]] unless explicitly specified.");

View File

@ -8,7 +8,22 @@ description: >
the requirements for built-in objects defined by the introduction
of chapter 17 of the ECMAScript Language Specification.
author: Norbert Lindenberg
includes: [testBuiltInObject.js]
includes: [isConstructor.js]
---*/
testBuiltInObject(Object.getOwnPropertyDescriptor(Intl.Collator.prototype, "compare").get);
var compareFn = Object.getOwnPropertyDescriptor(Intl.Collator.prototype, "compare").get;
assert.sameValue(Object.prototype.toString.call(compareFn), "[object Function]",
"The [[Class]] internal property of a built-in function must be " +
"\"Function\".");
assert(Object.isExtensible(compareFn),
"Built-in objects must be extensible.");
assert.sameValue(Object.getPrototypeOf(compareFn), Function.prototype);
assert.sameValue(compareFn.hasOwnProperty("prototype"), false,
"Built-in functions that aren't constructors must not have a prototype property.");
assert.sameValue(isConstructor(compareFn), false,
"Built-in functions don't implement [[Construct]] unless explicitly specified.");

View File

@ -8,7 +8,20 @@ description: >
requirements for built-in objects defined by the introduction of
chapter 17 of the ECMAScript Language Specification.
author: Norbert Lindenberg
includes: [testBuiltInObject.js]
includes: [isConstructor.js]
---*/
testBuiltInObject(Intl.Collator.prototype.resolvedOptions);
assert.sameValue(Object.prototype.toString.call(Intl.Collator.prototype.resolvedOptions), "[object Function]",
"The [[Class]] internal property of a built-in function must be " +
"\"Function\".");
assert(Object.isExtensible(Intl.Collator.prototype.resolvedOptions),
"Built-in objects must be extensible.");
assert.sameValue(Object.getPrototypeOf(Intl.Collator.prototype.resolvedOptions), Function.prototype);
assert.sameValue(Intl.Collator.prototype.resolvedOptions.hasOwnProperty("prototype"), false,
"Built-in functions that aren't constructors must not have a prototype property.");
assert.sameValue(isConstructor(Intl.Collator.prototype.resolvedOptions), false,
"Built-in functions don't implement [[Construct]] unless explicitly specified.");

View File

@ -8,7 +8,20 @@ description: >
requirements for built-in objects defined by the introduction of
chapter 17 of the ECMAScript Language Specification.
author: Norbert Lindenberg
includes: [testBuiltInObject.js]
includes: [isConstructor.js]
---*/
testBuiltInObject(Intl.Collator.supportedLocalesOf);
assert.sameValue(Object.prototype.toString.call(Intl.Collator.supportedLocalesOf), "[object Function]",
"The [[Class]] internal property of a built-in function must be " +
"\"Function\".");
assert(Object.isExtensible(Intl.Collator.supportedLocalesOf),
"Built-in objects must be extensible.");
assert.sameValue(Object.getPrototypeOf(Intl.Collator.supportedLocalesOf), Function.prototype);
assert.sameValue(Intl.Collator.supportedLocalesOf.hasOwnProperty("prototype"), false,
"Built-in functions that aren't constructors must not have a prototype property.");
assert.sameValue(isConstructor(Intl.Collator.supportedLocalesOf), false,
"Built-in functions don't implement [[Construct]] unless explicitly specified.");

View File

@ -8,7 +8,20 @@ description: >
requirements for built-in objects defined by the introduction of
chapter 17 of the ECMAScript Language Specification.
author: Norbert Lindenberg
includes: [testBuiltInObject.js]
includes: [isConstructor.js]
---*/
testBuiltInObject(Date.prototype.toLocaleDateString);
assert.sameValue(Object.prototype.toString.call(Date.prototype.toLocaleDateString), "[object Function]",
"The [[Class]] internal property of a built-in function must be " +
"\"Function\".");
assert(Object.isExtensible(Date.prototype.toLocaleDateString),
"Built-in objects must be extensible.");
assert.sameValue(Object.getPrototypeOf(Date.prototype.toLocaleDateString), Function.prototype);
assert.sameValue(Date.prototype.toLocaleDateString.hasOwnProperty("prototype"), false,
"Built-in functions that aren't constructors must not have a prototype property.");
assert.sameValue(isConstructor(Date.prototype.toLocaleDateString), false,
"Built-in functions don't implement [[Construct]] unless explicitly specified.");

View File

@ -8,7 +8,20 @@ description: >
for built-in objects defined by the introduction of chapter 17 of
the ECMAScript Language Specification.
author: Norbert Lindenberg
includes: [testBuiltInObject.js]
includes: [isConstructor.js]
---*/
testBuiltInObject(Date.prototype.toLocaleString);
assert.sameValue(Object.prototype.toString.call(Date.prototype.toLocaleString), "[object Function]",
"The [[Class]] internal property of a built-in function must be " +
"\"Function\".");
assert(Object.isExtensible(Date.prototype.toLocaleString),
"Built-in objects must be extensible.");
assert.sameValue(Object.getPrototypeOf(Date.prototype.toLocaleString), Function.prototype);
assert.sameValue(Date.prototype.toLocaleString.hasOwnProperty("prototype"), false,
"Built-in functions that aren't constructors must not have a prototype property.");
assert.sameValue(isConstructor(Date.prototype.toLocaleString), false,
"Built-in functions don't implement [[Construct]] unless explicitly specified.");

View File

@ -8,7 +8,20 @@ description: >
requirements for built-in objects defined by the introduction of
chapter 17 of the ECMAScript Language Specification.
author: Norbert Lindenberg
includes: [testBuiltInObject.js]
includes: [isConstructor.js]
---*/
testBuiltInObject(Date.prototype.toLocaleTimeString);
assert.sameValue(Object.prototype.toString.call(Date.prototype.toLocaleTimeString), "[object Function]",
"The [[Class]] internal property of a built-in function must be " +
"\"Function\".");
assert(Object.isExtensible(Date.prototype.toLocaleTimeString),
"Built-in objects must be extensible.");
assert.sameValue(Object.getPrototypeOf(Date.prototype.toLocaleTimeString), Function.prototype);
assert.sameValue(Date.prototype.toLocaleTimeString.hasOwnProperty("prototype"), false,
"Built-in functions that aren't constructors must not have a prototype property.");
assert.sameValue(isConstructor(Date.prototype.toLocaleTimeString), false,
"Built-in functions don't implement [[Construct]] unless explicitly specified.");

View File

@ -9,7 +9,22 @@ description: >
built-in objects defined by the introduction of chapter 17 of the
ECMAScript Language Specification.
author: Norbert Lindenberg
includes: [testBuiltInObject.js]
includes: [isConstructor.js]
---*/
testBuiltInObject(new Intl.DateTimeFormat().format);
var formatFn = new Intl.DateTimeFormat().format;
assert.sameValue(Object.prototype.toString.call(formatFn), "[object Function]",
"The [[Class]] internal property of a built-in function must be " +
"\"Function\".");
assert(Object.isExtensible(formatFn),
"Built-in objects must be extensible.");
assert.sameValue(Object.getPrototypeOf(formatFn), Function.prototype);
assert.sameValue(formatFn.hasOwnProperty("prototype"), false,
"Built-in functions that aren't constructors must not have a prototype property.");
assert.sameValue(isConstructor(formatFn), false,
"Built-in functions don't implement [[Construct]] unless explicitly specified.");

View File

@ -9,7 +9,22 @@ description: >
introduction of chapter 17 of the ECMAScript Language
Specification.
author: Norbert Lindenberg
includes: [testBuiltInObject.js]
includes: [isConstructor.js]
---*/
testBuiltInObject(Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, "format").get);
var formatFn = Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, "format").get;
assert.sameValue(Object.prototype.toString.call(formatFn), "[object Function]",
"The [[Class]] internal property of a built-in function must be " +
"\"Function\".");
assert(Object.isExtensible(formatFn),
"Built-in objects must be extensible.");
assert.sameValue(Object.getPrototypeOf(formatFn), Function.prototype);
assert.sameValue(formatFn.hasOwnProperty("prototype"), false,
"Built-in functions that aren't constructors must not have a prototype property.");
assert.sameValue(isConstructor(formatFn), false,
"Built-in functions don't implement [[Construct]] unless explicitly specified.");

View File

@ -8,7 +8,20 @@ description: >
the requirements for built-in objects defined by the introduction
of chapter 17 of the ECMAScript Language Specification.
author: Norbert Lindenberg
includes: [testBuiltInObject.js]
includes: [isConstructor.js]
---*/
testBuiltInObject(Intl.DateTimeFormat.prototype.resolvedOptions);
assert.sameValue(Object.prototype.toString.call(Intl.DateTimeFormat.prototype.resolvedOptions), "[object Function]",
"The [[Class]] internal property of a built-in function must be " +
"\"Function\".");
assert(Object.isExtensible(Intl.DateTimeFormat.prototype.resolvedOptions),
"Built-in objects must be extensible.");
assert.sameValue(Object.getPrototypeOf(Intl.DateTimeFormat.prototype.resolvedOptions), Function.prototype);
assert.sameValue(Intl.DateTimeFormat.prototype.resolvedOptions.hasOwnProperty("prototype"), false,
"Built-in functions that aren't constructors must not have a prototype property.");
assert.sameValue(isConstructor(Intl.DateTimeFormat.prototype.resolvedOptions), false,
"Built-in functions don't implement [[Construct]] unless explicitly specified.");

View File

@ -8,7 +8,20 @@ description: >
requirements for built-in objects defined by the introduction of
chapter 17 of the ECMAScript Language Specification.
author: Norbert Lindenberg
includes: [testBuiltInObject.js]
includes: [isConstructor.js]
---*/
testBuiltInObject(Intl.DateTimeFormat.supportedLocalesOf);
assert.sameValue(Object.prototype.toString.call(Intl.DateTimeFormat.supportedLocalesOf), "[object Function]",
"The [[Class]] internal property of a built-in function must be " +
"\"Function\".");
assert(Object.isExtensible(Intl.DateTimeFormat.supportedLocalesOf),
"Built-in objects must be extensible.");
assert.sameValue(Object.getPrototypeOf(Intl.DateTimeFormat.supportedLocalesOf), Function.prototype);
assert.sameValue(Intl.DateTimeFormat.supportedLocalesOf.hasOwnProperty("prototype"), false,
"Built-in functions that aren't constructors must not have a prototype property.");
assert.sameValue(isConstructor(Intl.DateTimeFormat.supportedLocalesOf), false,
"Built-in functions don't implement [[Construct]] unless explicitly specified.");

View File

@ -8,7 +8,20 @@ description: >
for built-in objects defined by the introduction of chapter 17 of
the ECMAScript Language Specification.
author: Norbert Lindenberg
includes: [testBuiltInObject.js]
includes: [isConstructor.js]
---*/
testBuiltInObject(Number.prototype.toLocaleString);
assert.sameValue(Object.prototype.toString.call(Number.prototype.toLocaleString), "[object Function]",
"The [[Class]] internal property of a built-in function must be " +
"\"Function\".");
assert(Object.isExtensible(Number.prototype.toLocaleString),
"Built-in objects must be extensible.");
assert.sameValue(Object.getPrototypeOf(Number.prototype.toLocaleString), Function.prototype);
assert.sameValue(Number.prototype.toLocaleString.hasOwnProperty("prototype"), false,
"Built-in functions that aren't constructors must not have a prototype property.");
assert.sameValue(isConstructor(Number.prototype.toLocaleString), false,
"Built-in functions don't implement [[Construct]] unless explicitly specified.");

View File

@ -9,7 +9,22 @@ description: >
built-in objects defined by the introduction of chapter 17 of the
ECMAScript Language Specification.
author: Norbert Lindenberg
includes: [testBuiltInObject.js]
includes: [isConstructor.js]
---*/
testBuiltInObject(new Intl.NumberFormat().format);
var formatFn = new Intl.NumberFormat().format;
assert.sameValue(Object.prototype.toString.call(formatFn), "[object Function]",
"The [[Class]] internal property of a built-in function must be " +
"\"Function\".");
assert(Object.isExtensible(formatFn),
"Built-in objects must be extensible.");
assert.sameValue(Object.getPrototypeOf(formatFn), Function.prototype);
assert.sameValue(formatFn.hasOwnProperty("prototype"), false,
"Built-in functions that aren't constructors must not have a prototype property.");
assert.sameValue(isConstructor(formatFn), false,
"Built-in functions don't implement [[Construct]] unless explicitly specified.");

View File

@ -9,7 +9,22 @@ description: >
introduction of chapter 17 of the ECMAScript Language
Specification.
author: Norbert Lindenberg
includes: [testBuiltInObject.js]
includes: [isConstructor.js]
---*/
testBuiltInObject(Object.getOwnPropertyDescriptor(Intl.NumberFormat.prototype, "format").get);
var formatFn = Object.getOwnPropertyDescriptor(Intl.NumberFormat.prototype, "format").get;
assert.sameValue(Object.prototype.toString.call(formatFn), "[object Function]",
"The [[Class]] internal property of a built-in function must be " +
"\"Function\".");
assert(Object.isExtensible(formatFn),
"Built-in objects must be extensible.");
assert.sameValue(Object.getPrototypeOf(formatFn), Function.prototype);
assert.sameValue(formatFn.hasOwnProperty("prototype"), false,
"Built-in functions that aren't constructors must not have a prototype property.");
assert.sameValue(isConstructor(formatFn), false,
"Built-in functions don't implement [[Construct]] unless explicitly specified.");

View File

@ -8,7 +8,20 @@ description: >
requirements for built-in objects defined by the introduction of
chapter 17 of the ECMAScript Language Specification.
author: Norbert Lindenberg
includes: [testBuiltInObject.js]
includes: [isConstructor.js]
---*/
testBuiltInObject(Intl.NumberFormat.prototype.resolvedOptions);
assert.sameValue(Object.prototype.toString.call(Intl.NumberFormat.prototype.resolvedOptions), "[object Function]",
"The [[Class]] internal property of a built-in function must be " +
"\"Function\".");
assert(Object.isExtensible(Intl.NumberFormat.prototype.resolvedOptions),
"Built-in objects must be extensible.");
assert.sameValue(Object.getPrototypeOf(Intl.NumberFormat.prototype.resolvedOptions), Function.prototype);
assert.sameValue(Intl.NumberFormat.prototype.resolvedOptions.hasOwnProperty("prototype"), false,
"Built-in functions that aren't constructors must not have a prototype property.");
assert.sameValue(isConstructor(Intl.NumberFormat.prototype.resolvedOptions), false,
"Built-in functions don't implement [[Construct]] unless explicitly specified.");

View File

@ -8,7 +8,20 @@ description: >
requirements for built-in objects defined by the introduction of
chapter 17 of the ECMAScript Language Specification.
author: Norbert Lindenberg
includes: [testBuiltInObject.js]
includes: [isConstructor.js]
---*/
testBuiltInObject(Intl.NumberFormat.supportedLocalesOf);
assert.sameValue(Object.prototype.toString.call(Intl.NumberFormat.supportedLocalesOf), "[object Function]",
"The [[Class]] internal property of a built-in function must be " +
"\"Function\".");
assert(Object.isExtensible(Intl.NumberFormat.supportedLocalesOf),
"Built-in objects must be extensible.");
assert.sameValue(Object.getPrototypeOf(Intl.NumberFormat.supportedLocalesOf), Function.prototype);
assert.sameValue(Intl.NumberFormat.supportedLocalesOf.hasOwnProperty("prototype"), false,
"Built-in functions that aren't constructors must not have a prototype property.");
assert.sameValue(isConstructor(Intl.NumberFormat.supportedLocalesOf), false,
"Built-in functions don't implement [[Construct]] unless explicitly specified.");

View File

@ -8,7 +8,20 @@ description: >
built-in objects defined by the introduction of chapter 17 of the
ECMAScript Language Specification.
author: Zibi Braniecki
includes: [testBuiltInObject.js]
includes: [isConstructor.js]
---*/
testBuiltInObject(Intl.PluralRules.prototype.resolvedOptions);
assert.sameValue(Object.prototype.toString.call(Intl.PluralRules.prototype.resolvedOptions), "[object Function]",
"The [[Class]] internal property of a built-in function must be " +
"\"Function\".");
assert(Object.isExtensible(Intl.PluralRules.prototype.resolvedOptions),
"Built-in objects must be extensible.");
assert.sameValue(Object.getPrototypeOf(Intl.PluralRules.prototype.resolvedOptions), Function.prototype);
assert.sameValue(Intl.PluralRules.prototype.resolvedOptions.hasOwnProperty("prototype"), false,
"Built-in functions that aren't constructors must not have a prototype property.");
assert.sameValue(isConstructor(Intl.PluralRules.prototype.resolvedOptions), false,
"Built-in functions don't implement [[Construct]] unless explicitly specified.");

View File

@ -8,7 +8,20 @@ description: >
built-in objects defined by the introduction of chapter 17 of the
ECMAScript Language Specification.
author: Zibi Braniecki
includes: [testBuiltInObject.js]
includes: [isConstructor.js]
---*/
testBuiltInObject(Intl.PluralRules.supportedLocalesOf);
assert.sameValue(Object.prototype.toString.call(Intl.PluralRules.supportedLocalesOf), "[object Function]",
"The [[Class]] internal property of a built-in function must be " +
"\"Function\".");
assert(Object.isExtensible(Intl.PluralRules.supportedLocalesOf),
"Built-in objects must be extensible.");
assert.sameValue(Object.getPrototypeOf(Intl.PluralRules.supportedLocalesOf), Function.prototype);
assert.sameValue(Intl.PluralRules.supportedLocalesOf.hasOwnProperty("prototype"), false,
"Built-in functions that aren't constructors must not have a prototype property.");
assert.sameValue(isConstructor(Intl.PluralRules.supportedLocalesOf), false,
"Built-in functions don't implement [[Construct]] unless explicitly specified.");

View File

@ -8,7 +8,20 @@ description: >
for built-in objects defined by the introduction of chapter 17 of
the ECMAScript Language Specification.
author: Norbert Lindenberg
includes: [testBuiltInObject.js]
includes: [isConstructor.js]
---*/
testBuiltInObject(String.prototype.localeCompare);
assert.sameValue(Object.prototype.toString.call(String.prototype.localeCompare), "[object Function]",
"The [[Class]] internal property of a built-in function must be " +
"\"Function\".");
assert(Object.isExtensible(String.prototype.localeCompare),
"Built-in objects must be extensible.");
assert.sameValue(Object.getPrototypeOf(String.prototype.localeCompare), Function.prototype);
assert.sameValue(String.prototype.localeCompare.hasOwnProperty("prototype"), false,
"Built-in functions that aren't constructors must not have a prototype property.");
assert.sameValue(isConstructor(String.prototype.localeCompare), false,
"Built-in functions don't implement [[Construct]] unless explicitly specified.");