add instance checks

This commit is contained in:
Romulo Cintra 2022-01-10 15:55:27 +01:00 committed by Rick Waldron
parent e87b0048c4
commit 9f8ac1aace
7 changed files with 174 additions and 0 deletions

View File

@ -0,0 +1,22 @@
// Copyright 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-Intl.DurationFormat
description: Intl.DurationFormat instance object extensibility
info: |
17 ECMAScript Standard Built-in Objects:
Unless specified otherwise, the [[Extensible]] internal slot
of a built-in object initially has the value true.
features: [Intl.DurationFormat]
---*/
assert.sameValue(
Object.isExtensible(new Intl.DurationFormat()),
true,
"Object.isExtensible(new Intl.DurationFormat()) returns true"
);

View File

@ -0,0 +1,32 @@
// Copyright 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-intl.DurationFormat
description: >
Intl.DurationFormat.length is 0.
info: |
Intl.DurationFormat ( [ locales [ , options ] ] )
17 ECMAScript Standard Built-in Objects:
Every built-in function object, including constructors, has a length
property whose value is an integer. Unless otherwise specified, this
value is equal to the largest number of named arguments shown in the
subclause headings for the function description. Optional parameters
(which are indicated with brackets: [ ]) or rest parameters (which
are shown using the form «...name») are not included in the default
argument count.
Unless otherwise specified, the length property of a built-in function
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
features: [Intl.DurationFormat]
includes: [propertyHelper.js]
---*/
assert.sameValue(Intl.DurationFormat.length, 0);
verifyNotEnumerable(Intl.DurationFormat, "length");
verifyNotWritable(Intl.DurationFormat, "length");
verifyConfigurable(Intl.DurationFormat, "length");

View File

@ -0,0 +1,28 @@
// Copyright 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-Intl.DurationFormat
description: >
Intl.DurationFormat.name is "DurationFormat".
info: |
Intl.DurationFormat ([ locales [ , options ]])
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value
is a String.
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
features: [Intl.DurationFormat]
includes: [propertyHelper.js]
---*/
assert.sameValue(Intl.DurationFormat.name, "DurationFormat");
verifyNotEnumerable(Intl.DurationFormat, "name");
verifyNotWritable(Intl.DurationFormat, "name");
verifyConfigurable(Intl.DurationFormat, "name");

View File

@ -0,0 +1,30 @@
// Copyright 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-intl.DurationFormat
description: >
"DurationFormat" property of Intl.
info: |
Intl.DurationFormat ([ locales [ , options ]])
7 Requirements for Standard Built-in ECMAScript Objects
Unless specified otherwise in this document, the objects, functions, and constructors
described in this standard are subject to the generic requirements and restrictions
specified for standard built-in ECMAScript objects in the ECMAScript 2018 Language
Specification, 9th edition, clause 17, or successor.
17 ECMAScript Standard Built-in Objects:
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.
features: [Intl.DurationFormat]
includes: [propertyHelper.js]
---*/
verifyNotEnumerable(Intl, "DurationFormat");
verifyWritable(Intl, "DurationFormat");
verifyConfigurable(Intl, "DurationFormat");

View File

@ -0,0 +1,20 @@
// Copyright 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-Intl.DurationFormat
description: Intl.DurationFormat instance object is created from %DurationFormatPrototype%.
info: |
Intl.DurationFormat ([ locales [ , options ]])
2. Let durationFormat be ? OrdinaryCreateFromConstructor(NewTarget, "%DurationFormatPrototype%", « [[InitializedDurationFormat]], [[Locale]], [[DataLocale]], [[NumberingSystem]], [[Style]], [[YearsStyle]], [[YearsDisplay]], [[MonthsStyle]], [[MonthsDisplay]] , [[WeeksStyle]], [[WeeksDisplay]] , [[DaysStyle]], [[DaysDisplay]] , [[HoursStyle]], [[HoursDisplay]] , [[MinutesStyle]], [[MinutesDisplay]] , [[SecondsStyle]], [[SecondsDisplay]] , [[MillisecondsStyle]], [[MillisecondsDisplay]] , [[MicrosecondsStyle]], [[MicrosecondsDisplay]] , [[NanosecondsStyle]], [[NanosecondsDisplay]], [[FractionalDigits]] »).
features: [Intl.DurationFormat]
---*/
const value = new Intl.DurationFormat();
assert.sameValue(
Object.getPrototypeOf(value),
Intl.DurationFormat.prototype,
"Object.getPrototypeOf(value) equals the value of Intl.DurationFormat.prototype"
);

View File

@ -0,0 +1,30 @@
// Copyright 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-intl.DurationFormat
description: >
"constructor" property of Intl.DurationFormat.prototype.
info: |
Intl.DurationFormat.prototype.constructor
7 Requirements for Standard Built-in ECMAScript Objects
Unless specified otherwise in this document, the objects, functions, and constructors
described in this standard are subject to the generic requirements and restrictions
specified for standard built-in ECMAScript objects in the ECMAScript 2018 Language
Specification, 9th edition, clause 17, or successor.
17 ECMAScript Standard Built-in Objects:
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.
features: [Intl.DurationFormat]
includes: [propertyHelper.js]
---*/
verifyNotEnumerable(Intl.DurationFormat.prototype, "constructor");
verifyWritable(Intl.DurationFormat.prototype, "constructor");
verifyConfigurable(Intl.DurationFormat.prototype, "constructor");

View File

@ -0,0 +1,12 @@
// Copyright 2012 Google Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-intl.DurationFormat
description: >
Tests that Intl.DurationFormat.prototype.constructor is the Intl.DurationFormat.
features: [Intl.DurationFormat]
---*/
assert.sameValue(Intl.DurationFormat.prototype.constructor, Intl.DurationFormat, "Intl.DurationFormat.prototype.constructor is not the same as Intl.DurationFormat");