-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic tests for proposal-intl-locale-info (#2987)
* Add basic tests for weekInfo * Add basic tests for textInfo * Add basic tests for timeZones * Add basic tests for numberingSystems * Add basic tests for hourCycles * Add basic tests for collations * Add basic tests for calendars * Add feature for Intl.Locale-info * add validation to branding tests for locale-info Add additional assertion to branding tests for proposal-intl-locale-info to make sure they don't pass spuriously when the proposal is not implemented.
- Loading branch information
Showing
22 changed files
with
550 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2021 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-Intl.Locale.prototype.calendars | ||
description: > | ||
Verifies the branding check for the "calendars" property of the Locale prototype object. | ||
info: | | ||
Intl.Locale.prototype.calendars | ||
2. If Type(loc) is not Object or loc does not have an [[InitializedLocale]] internal slot, then | ||
a. Throw a TypeError exception. | ||
features: [Intl.Locale,Intl.Locale-info] | ||
---*/ | ||
|
||
const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "calendars"); | ||
assert.sameValue(typeof propdesc.get, "function"); | ||
const invalidValues = [ | ||
undefined, | ||
null, | ||
true, | ||
"", | ||
Symbol(), | ||
1, | ||
{}, | ||
Intl.Locale.prototype, | ||
]; | ||
|
||
for (const invalidValue of invalidValues) { | ||
assert.throws(TypeError, () => propdesc.get.call(invalidValue)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2021 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-intl.locale.prototype.calendars | ||
description: > | ||
Checks the "name" property of Intl.Locale.prototype.calendars. | ||
info: | | ||
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 2019 Language Specification, 10th edition, clause 17, or successor. | ||
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, this value is the name that is given to the function in this specification. Functions that are specified as get or set accessor functions of built-in properties have "get " or "set " prepended to the property name 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 }. | ||
includes: [propertyHelper.js] | ||
features: [Intl.Locale,Intl.Locale-info] | ||
---*/ | ||
|
||
const getter = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "calendars").get; | ||
verifyProperty(getter, "name", { | ||
value: "get calendars", | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2021 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-intl.locale | ||
description: > | ||
Checks the "calendars" property of the Locale prototype object. | ||
info: | | ||
Intl.Locale.prototype.calendars | ||
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 2019 script Specification, 10th edition, clause 17, or successor. | ||
Every accessor property described in clauses 18 through 26 and in Annex B.2 has the attributes { [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. If only a get accessor function is described, the set accessor function is the default value, undefined. | ||
includes: [propertyHelper.js] | ||
features: [Intl.Locale,Intl.Locale-info] | ||
---*/ | ||
|
||
const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "calendars"); | ||
assert.sameValue(propdesc.set, undefined); | ||
assert.sameValue(typeof propdesc.get, "function"); | ||
|
||
verifyProperty(Intl.Locale.prototype, "calendars", { | ||
enumerable: false, | ||
configurable: true, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2021 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-Intl.Locale.prototype.collations | ||
description: > | ||
Verifies the branding check for the "collations" property of the Locale prototype object. | ||
info: | | ||
Intl.Locale.prototype.collations | ||
2. If Type(loc) is not Object or loc does not have an [[InitializedLocale]] internal slot, then | ||
a. Throw a TypeError exception. | ||
features: [Intl.Locale,Intl.Locale-info] | ||
---*/ | ||
|
||
const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "collations"); | ||
assert.sameValue(typeof propdesc.get, "function"); | ||
const invalidValues = [ | ||
undefined, | ||
null, | ||
true, | ||
"", | ||
Symbol(), | ||
1, | ||
{}, | ||
Intl.Locale.prototype, | ||
]; | ||
|
||
for (const invalidValue of invalidValues) { | ||
assert.throws(TypeError, () => propdesc.get.call(invalidValue)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2021 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-intl.locale.prototype.collations | ||
description: > | ||
Checks the "name" property of Intl.Locale.prototype.collations. | ||
info: | | ||
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 2019 Language Specification, 10th edition, clause 17, or successor. | ||
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, this value is the name that is given to the function in this specification. Functions that are specified as get or set accessor functions of built-in properties have "get " or "set " prepended to the property name 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 }. | ||
includes: [propertyHelper.js] | ||
features: [Intl.Locale,Intl.Locale-info] | ||
---*/ | ||
|
||
const getter = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "collations").get; | ||
verifyProperty(getter, "name", { | ||
value: "get collations", | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2021 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-intl.locale | ||
description: > | ||
Checks the "collations" property of the Locale prototype object. | ||
info: | | ||
Intl.Locale.prototype.collations | ||
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 2019 script Specification, 10th edition, clause 17, or successor. | ||
Every accessor property described in clauses 18 through 26 and in Annex B.2 has the attributes { [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. If only a get accessor function is described, the set accessor function is the default value, undefined. | ||
includes: [propertyHelper.js] | ||
features: [Intl.Locale,Intl.Locale-info] | ||
---*/ | ||
|
||
const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "collations"); | ||
assert.sameValue(propdesc.set, undefined); | ||
assert.sameValue(typeof propdesc.get, "function"); | ||
|
||
verifyProperty(Intl.Locale.prototype, "collations", { | ||
enumerable: false, | ||
configurable: true, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2021 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-Intl.Locale.prototype.hourCycles | ||
description: > | ||
Verifies the branding check for the "hourCycles" property of the Locale prototype object. | ||
info: | | ||
Intl.Locale.prototype.hourCycles | ||
2. If Type(loc) is not Object or loc does not have an [[InitializedLocale]] internal slot, then | ||
a. Throw a TypeError exception. | ||
features: [Intl.Locale,Intl.Locale-info] | ||
---*/ | ||
|
||
const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "hourCycles"); | ||
assert.sameValue(typeof propdesc.get, "function"); | ||
const invalidValues = [ | ||
undefined, | ||
null, | ||
true, | ||
"", | ||
Symbol(), | ||
1, | ||
{}, | ||
Intl.Locale.prototype, | ||
]; | ||
|
||
for (const invalidValue of invalidValues) { | ||
assert.throws(TypeError, () => propdesc.get.call(invalidValue)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2021 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-intl.locale.prototype.hourCycles | ||
description: > | ||
Checks the "name" property of Intl.Locale.prototype.hourCycles. | ||
info: | | ||
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 2019 Language Specification, 10th edition, clause 17, or successor. | ||
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, this value is the name that is given to the function in this specification. Functions that are specified as get or set accessor functions of built-in properties have "get " or "set " prepended to the property name 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 }. | ||
includes: [propertyHelper.js] | ||
features: [Intl.Locale,Intl.Locale-info] | ||
---*/ | ||
|
||
const getter = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "hourCycles").get; | ||
verifyProperty(getter, "name", { | ||
value: "get hourCycles", | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2021 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-intl.locale | ||
description: > | ||
Checks the "hourCycles" property of the Locale prototype object. | ||
info: | | ||
Intl.Locale.prototype.hourCycles | ||
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 2019 script Specification, 10th edition, clause 17, or successor. | ||
Every accessor property described in clauses 18 through 26 and in Annex B.2 has the attributes { [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. If only a get accessor function is described, the set accessor function is the default value, undefined. | ||
includes: [propertyHelper.js] | ||
features: [Intl.Locale,Intl.Locale-info] | ||
---*/ | ||
|
||
const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "hourCycles"); | ||
assert.sameValue(propdesc.set, undefined); | ||
assert.sameValue(typeof propdesc.get, "function"); | ||
|
||
verifyProperty(Intl.Locale.prototype, "hourCycles", { | ||
enumerable: false, | ||
configurable: true, | ||
}); |
31 changes: 31 additions & 0 deletions
31
test/intl402/Locale/prototype/numberingSystems/branding.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2021 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-Intl.Locale.prototype.numberingSystems | ||
description: > | ||
Verifies the branding check for the "numberingSystems" property of the Locale prototype object. | ||
info: | | ||
Intl.Locale.prototype.numberingSystems | ||
2. If Type(loc) is not Object or loc does not have an [[InitializedLocale]] internal slot, then | ||
a. Throw a TypeError exception. | ||
features: [Intl.Locale,Intl.Locale-info] | ||
---*/ | ||
|
||
const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "numberingSystems"); | ||
assert.sameValue(typeof propdesc.get, "function"); | ||
const invalidValues = [ | ||
undefined, | ||
null, | ||
true, | ||
"", | ||
Symbol(), | ||
1, | ||
{}, | ||
Intl.Locale.prototype, | ||
]; | ||
|
||
for (const invalidValue of invalidValues) { | ||
assert.throws(TypeError, () => propdesc.get.call(invalidValue)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2021 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-intl.locale.prototype.numberingSystems | ||
description: > | ||
Checks the "name" property of Intl.Locale.prototype.numberingSystems. | ||
info: | | ||
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 2019 Language Specification, 10th edition, clause 17, or successor. | ||
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, this value is the name that is given to the function in this specification. Functions that are specified as get or set accessor functions of built-in properties have "get " or "set " prepended to the property name 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 }. | ||
includes: [propertyHelper.js] | ||
features: [Intl.Locale,Intl.Locale-info] | ||
---*/ | ||
|
||
const getter = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "numberingSystems").get; | ||
verifyProperty(getter, "name", { | ||
value: "get numberingSystems", | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); |
25 changes: 25 additions & 0 deletions
25
test/intl402/Locale/prototype/numberingSystems/prop-desc.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2021 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-intl.locale | ||
description: > | ||
Checks the "numberingSystems" property of the Locale prototype object. | ||
info: | | ||
Intl.Locale.prototype.numberingSystems | ||
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 2019 script Specification, 10th edition, clause 17, or successor. | ||
Every accessor property described in clauses 18 through 26 and in Annex B.2 has the attributes { [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. If only a get accessor function is described, the set accessor function is the default value, undefined. | ||
includes: [propertyHelper.js] | ||
features: [Intl.Locale,Intl.Locale-info] | ||
---*/ | ||
|
||
const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "numberingSystems"); | ||
assert.sameValue(propdesc.set, undefined); | ||
assert.sameValue(typeof propdesc.get, "function"); | ||
|
||
verifyProperty(Intl.Locale.prototype, "numberingSystems", { | ||
enumerable: false, | ||
configurable: true, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2021 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-Intl.Locale.prototype.textInfo | ||
description: > | ||
Verifies the branding check for the "textInfo" property of the Locale prototype object. | ||
info: | | ||
Intl.Locale.prototype.textInfo | ||
2. If Type(loc) is not Object or loc does not have an [[InitializedLocale]] internal slot, then | ||
a. Throw a TypeError exception. | ||
features: [Intl.Locale,Intl.Locale-info] | ||
---*/ | ||
|
||
const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "textInfo"); | ||
assert.sameValue(typeof propdesc.get, "function"); | ||
const invalidValues = [ | ||
undefined, | ||
null, | ||
true, | ||
"", | ||
Symbol(), | ||
1, | ||
{}, | ||
Intl.Locale.prototype, | ||
]; | ||
|
||
for (const invalidValue of invalidValues) { | ||
assert.throws(TypeError, () => propdesc.get.call(invalidValue)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2021 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-intl.locale.prototype.textInfo | ||
description: > | ||
Checks the "name" property of Intl.Locale.prototype.textInfo. | ||
info: | | ||
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 2019 Language Specification, 10th edition, clause 17, or successor. | ||
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, this value is the name that is given to the function in this specification. Functions that are specified as get or set accessor functions of built-in properties have "get " or "set " prepended to the property name 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 }. | ||
includes: [propertyHelper.js] | ||
features: [Intl.Locale,Intl.Locale-info] | ||
---*/ | ||
|
||
const getter = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "textInfo").get; | ||
verifyProperty(getter, "name", { | ||
value: "get textInfo", | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); |
Oops, something went wrong.