mirror of
https://github.com/tc39/test262.git
synced 2025-04-08 19:35:28 +02:00
No longer use testBuiltInObject for built-in constructors
This commit is contained in:
parent
4337b396bd
commit
ecf814bb4c
@ -10,11 +10,10 @@ description: |
|
||||
* defined by the introduction of chapter 15 of the ECMAScript Language Specification.
|
||||
* @param {Object} obj the object to be tested.
|
||||
* @param {boolean} isFunction whether the specification describes obj as a function.
|
||||
* @param {boolean} isConstructor whether the specification describes obj as a constructor.
|
||||
* @author Norbert Lindenberg
|
||||
*/
|
||||
|
||||
function testBuiltInObject(obj, isFunction, isConstructor) {
|
||||
function testBuiltInObject(obj, isFunction) {
|
||||
|
||||
if (obj === undefined) {
|
||||
$ERROR("Object being tested is undefined.");
|
||||
@ -41,12 +40,8 @@ function testBuiltInObject(obj, isFunction, isConstructor) {
|
||||
$ERROR("Built-in functions must have Function.prototype as their prototype.");
|
||||
}
|
||||
|
||||
if (isConstructor && Object.getPrototypeOf(obj.prototype) !== Object.prototype) {
|
||||
$ERROR("Built-in prototype objects must have Object.prototype as their prototype.");
|
||||
}
|
||||
|
||||
var exception;
|
||||
if (isFunction && !isConstructor) {
|
||||
if (isFunction) {
|
||||
// this is not a complete test for the presence of [[Construct]]:
|
||||
// if it's absent, the exception must be thrown, but it may also
|
||||
// be thrown if it's present and just has preconditions related to
|
||||
@ -63,7 +58,7 @@ function testBuiltInObject(obj, isFunction, isConstructor) {
|
||||
}
|
||||
}
|
||||
|
||||
if (isFunction && !isConstructor && obj.hasOwnProperty("prototype")) {
|
||||
if (isFunction && obj.hasOwnProperty("prototype")) {
|
||||
$ERROR("Built-in functions that aren't constructors must not have a prototype property.");
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,12 @@ description: >
|
||||
objects defined by the introduction of chapter 17 of the
|
||||
ECMAScript Language Specification.
|
||||
author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Intl.Collator, true, true);
|
||||
assert.sameValue(Object.prototype.toString.call(Intl.Collator), "[object Function]",
|
||||
"The [[Class]] internal property of a built-in function must be " +
|
||||
"\"Function\".");
|
||||
|
||||
assert(Object.isExtensible(Intl.Collator), "Built-in objects must be extensible.");
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(Intl.Collator), Function.prototype);
|
||||
|
10
test/intl402/Collator/prototype/10.3_L15.js
vendored
10
test/intl402/Collator/prototype/10.3_L15.js
vendored
@ -8,7 +8,13 @@ description: >
|
||||
built-in objects defined by the introduction of chapter 17 of the
|
||||
ECMAScript Language Specification.
|
||||
author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Intl.Collator.prototype, false, false);
|
||||
assert.sameValue(Object.prototype.toString.call(Intl.Collator.prototype), "[object Object]",
|
||||
"The [[Class]] internal property of a built-in non-function object must be " +
|
||||
"\"Object\".");
|
||||
|
||||
assert(Object.isExtensible(Intl.Collator.prototype), "Built-in objects must be extensible.");
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(Intl.Collator.prototype), Object.prototype,
|
||||
"Built-in prototype objects must have Object.prototype as their prototype.");
|
||||
|
@ -12,4 +12,4 @@ author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(new Intl.Collator().compare, true, false);
|
||||
testBuiltInObject(new Intl.Collator().compare, true);
|
||||
|
@ -11,4 +11,4 @@ author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Object.getOwnPropertyDescriptor(Intl.Collator.prototype, "compare").get , true, false);
|
||||
testBuiltInObject(Object.getOwnPropertyDescriptor(Intl.Collator.prototype, "compare").get , true);
|
||||
|
@ -11,4 +11,4 @@ author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Intl.Collator.prototype.resolvedOptions, true, false);
|
||||
testBuiltInObject(Intl.Collator.prototype.resolvedOptions, true);
|
||||
|
@ -11,4 +11,4 @@ author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Intl.Collator.supportedLocalesOf, true, false);
|
||||
testBuiltInObject(Intl.Collator.supportedLocalesOf, true);
|
||||
|
@ -11,4 +11,4 @@ author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Date.prototype.toLocaleDateString, true, false);
|
||||
testBuiltInObject(Date.prototype.toLocaleDateString, true);
|
||||
|
@ -11,4 +11,4 @@ author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Date.prototype.toLocaleString, true, false);
|
||||
testBuiltInObject(Date.prototype.toLocaleString, true);
|
||||
|
@ -11,4 +11,4 @@ author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Date.prototype.toLocaleTimeString, true, false);
|
||||
testBuiltInObject(Date.prototype.toLocaleTimeString, true);
|
||||
|
@ -8,7 +8,12 @@ description: >
|
||||
built-in objects defined by the introduction of chapter 17 of the
|
||||
ECMAScript Language Specification.
|
||||
author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Intl.DateTimeFormat, true, true);
|
||||
assert.sameValue(Object.prototype.toString.call(Intl.DateTimeFormat), "[object Function]",
|
||||
"The [[Class]] internal property of a built-in function must be " +
|
||||
"\"Function\".");
|
||||
|
||||
assert(Object.isExtensible(Intl.DateTimeFormat), "Built-in objects must be extensible.");
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(Intl.DateTimeFormat), Function.prototype);
|
||||
|
@ -8,7 +8,13 @@ description: >
|
||||
for built-in objects defined by the introduction of chapter 17 of
|
||||
the ECMAScript Language Specification.
|
||||
author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Intl.DateTimeFormat.prototype, false, false);
|
||||
assert.sameValue(Object.prototype.toString.call(Intl.DateTimeFormat.prototype), "[object Object]",
|
||||
"The [[Class]] internal property of a built-in non-function object must be " +
|
||||
"\"Object\".");
|
||||
|
||||
assert(Object.isExtensible(Intl.DateTimeFormat.prototype), "Built-in objects must be extensible.");
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(Intl.DateTimeFormat.prototype), Object.prototype,
|
||||
"Built-in prototype objects must have Object.prototype as their prototype.");
|
||||
|
@ -12,4 +12,4 @@ author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(new Intl.DateTimeFormat().format, true, false);
|
||||
testBuiltInObject(new Intl.DateTimeFormat().format, true);
|
||||
|
@ -12,4 +12,4 @@ author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, "format").get , true, false);
|
||||
testBuiltInObject(Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, "format").get , true);
|
||||
|
@ -11,4 +11,4 @@ author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Intl.DateTimeFormat.prototype.resolvedOptions, true, false);
|
||||
testBuiltInObject(Intl.DateTimeFormat.prototype.resolvedOptions, true);
|
||||
|
@ -11,4 +11,4 @@ author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Intl.DateTimeFormat.supportedLocalesOf, true, false);
|
||||
testBuiltInObject(Intl.DateTimeFormat.supportedLocalesOf, true);
|
||||
|
@ -11,5 +11,5 @@ author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(this.Intl, false, false);
|
||||
testBuiltInObject(Intl, false, false);
|
||||
testBuiltInObject(this.Intl, false);
|
||||
testBuiltInObject(Intl, false);
|
||||
|
@ -11,4 +11,4 @@ author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Number.prototype.toLocaleString, true, false);
|
||||
testBuiltInObject(Number.prototype.toLocaleString, true);
|
||||
|
@ -8,7 +8,12 @@ description: >
|
||||
objects defined by the introduction of chapter 17 of the
|
||||
ECMAScript Language Specification.
|
||||
author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Intl.NumberFormat, true, true);
|
||||
assert.sameValue(Object.prototype.toString.call(Intl.NumberFormat), "[object Function]",
|
||||
"The [[Class]] internal property of a built-in function must be " +
|
||||
"\"Function\".");
|
||||
|
||||
assert(Object.isExtensible(Intl.NumberFormat), "Built-in objects must be extensible.");
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(Intl.NumberFormat), Function.prototype);
|
||||
|
10
test/intl402/NumberFormat/prototype/11.3_L15.js
vendored
10
test/intl402/NumberFormat/prototype/11.3_L15.js
vendored
@ -8,7 +8,13 @@ description: >
|
||||
built-in objects defined by the introduction of chapter 17 of the
|
||||
ECMAScript Language Specification.
|
||||
author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Intl.NumberFormat.prototype, false, false);
|
||||
assert.sameValue(Object.prototype.toString.call(Intl.NumberFormat.prototype), "[object Object]",
|
||||
"The [[Class]] internal property of a built-in non-function object must be " +
|
||||
"\"Object\".");
|
||||
|
||||
assert(Object.isExtensible(Intl.NumberFormat.prototype), "Built-in objects must be extensible.");
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(Intl.NumberFormat.prototype), Object.prototype,
|
||||
"Built-in prototype objects must have Object.prototype as their prototype.");
|
||||
|
@ -12,4 +12,4 @@ author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(new Intl.NumberFormat().format, true, false);
|
||||
testBuiltInObject(new Intl.NumberFormat().format, true);
|
||||
|
@ -12,4 +12,4 @@ author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Object.getOwnPropertyDescriptor(Intl.NumberFormat.prototype, "format").get , true, false);
|
||||
testBuiltInObject(Object.getOwnPropertyDescriptor(Intl.NumberFormat.prototype, "format").get , true);
|
||||
|
@ -11,4 +11,4 @@ author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Intl.NumberFormat.prototype.resolvedOptions, true, false);
|
||||
testBuiltInObject(Intl.NumberFormat.prototype.resolvedOptions, true);
|
||||
|
@ -11,4 +11,4 @@ author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Intl.NumberFormat.supportedLocalesOf, true, false);
|
||||
testBuiltInObject(Intl.NumberFormat.supportedLocalesOf, true);
|
||||
|
@ -8,7 +8,12 @@ description: >
|
||||
built-in objects defined by the introduction of chapter 17 of the
|
||||
ECMAScript Language Specification.
|
||||
author: Zibi Braniecki
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Intl.PluralRules, true, true);
|
||||
assert.sameValue(Object.prototype.toString.call(Intl.PluralRules), "[object Function]",
|
||||
"The [[Class]] internal property of a built-in function must be " +
|
||||
"\"Function\".");
|
||||
|
||||
assert(Object.isExtensible(Intl.PluralRules), "Built-in objects must be extensible.");
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(Intl.PluralRules), Function.prototype);
|
||||
|
10
test/intl402/PluralRules/prototype/builtins.js
vendored
10
test/intl402/PluralRules/prototype/builtins.js
vendored
@ -8,7 +8,13 @@ description: >
|
||||
built-in objects defined by the introduction of chapter 17 of the
|
||||
ECMAScript Language Specification.
|
||||
author: Zibi Braniecki
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Intl.PluralRules.prototype, false, false);
|
||||
assert.sameValue(Object.prototype.toString.call(Intl.PluralRules.prototype), "[object Object]",
|
||||
"The [[Class]] internal property of a built-in non-function object must be " +
|
||||
"\"Object\".");
|
||||
|
||||
assert(Object.isExtensible(Intl.PluralRules.prototype), "Built-in objects must be extensible.");
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(Intl.PluralRules.prototype), Object.prototype,
|
||||
"Built-in prototype objects must have Object.prototype as their prototype.");
|
||||
|
@ -11,4 +11,4 @@ author: Zibi Braniecki
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Intl.PluralRules.prototype.resolvedOptions, true, false);
|
||||
testBuiltInObject(Intl.PluralRules.prototype.resolvedOptions, true);
|
||||
|
@ -11,4 +11,4 @@ author: Zibi Braniecki
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(Intl.PluralRules.supportedLocalesOf, true, false);
|
||||
testBuiltInObject(Intl.PluralRules.supportedLocalesOf, true);
|
||||
|
@ -11,4 +11,4 @@ author: Norbert Lindenberg
|
||||
includes: [testBuiltInObject.js]
|
||||
---*/
|
||||
|
||||
testBuiltInObject(String.prototype.localeCompare, true, false);
|
||||
testBuiltInObject(String.prototype.localeCompare, true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user