Use verifyProperty in remaining test/intl402 tests

This commit is contained in:
André Bargull 2023-09-11 15:44:04 +02:00 committed by Ms2ger
parent f32dc36f3e
commit 99096762ca
10 changed files with 73 additions and 50 deletions

View File

@ -24,8 +24,9 @@ info: |
includes: [propertyHelper.js] includes: [propertyHelper.js]
---*/ ---*/
assert.sameValue(Date.prototype.toLocaleDateString.length, 0); verifyProperty(Date.prototype.toLocaleDateString, "length", {
value: 0,
verifyNotEnumerable(Date.prototype.toLocaleDateString, "length"); writable: false,
verifyNotWritable(Date.prototype.toLocaleDateString, "length"); enumerable: false,
verifyConfigurable(Date.prototype.toLocaleDateString, "length"); configurable: true,
});

View File

@ -24,8 +24,9 @@ info: |
includes: [propertyHelper.js] includes: [propertyHelper.js]
---*/ ---*/
assert.sameValue(Date.prototype.toLocaleString.length, 0); verifyProperty(Date.prototype.toLocaleString, "length", {
value: 0,
verifyNotEnumerable(Date.prototype.toLocaleString, "length"); writable: false,
verifyNotWritable(Date.prototype.toLocaleString, "length"); enumerable: false,
verifyConfigurable(Date.prototype.toLocaleString, "length"); configurable: true,
});

View File

@ -24,8 +24,9 @@ info: |
includes: [propertyHelper.js] includes: [propertyHelper.js]
---*/ ---*/
assert.sameValue(Date.prototype.toLocaleTimeString.length, 0); verifyProperty(Date.prototype.toLocaleTimeString, "length", {
value: 0,
verifyNotEnumerable(Date.prototype.toLocaleTimeString, "length"); writable: false,
verifyNotWritable(Date.prototype.toLocaleTimeString, "length"); enumerable: false,
verifyConfigurable(Date.prototype.toLocaleTimeString, "length"); configurable: true,
});

View File

@ -25,6 +25,8 @@ features: [Intl.DurationFormat]
includes: [propertyHelper.js] includes: [propertyHelper.js]
---*/ ---*/
verifyNotEnumerable(Intl.DurationFormat.prototype, "constructor"); verifyProperty(Intl.DurationFormat.prototype, "constructor", {
verifyWritable(Intl.DurationFormat.prototype, "constructor"); writable: true,
verifyConfigurable(Intl.DurationFormat.prototype, "constructor"); enumerable: false,
configurable: true,
});

View File

@ -10,6 +10,9 @@ features: [Intl.DurationFormat]
includes: [propertyHelper.js] includes: [propertyHelper.js]
---*/ ---*/
verifyNotEnumerable(Intl.DurationFormat, "prototype"); verifyProperty(Intl.DurationFormat, "prototype", {
verifyNotWritable(Intl.DurationFormat, "prototype"); value: Intl.DurationFormat.prototype,
verifyNotConfigurable(Intl.DurationFormat, "prototype"); writable: false,
enumerable: false,
configurable: false,
});

View File

@ -17,6 +17,8 @@ assert.sameValue(
'`typeof Intl.getCanonicalLocales` is `function`' '`typeof Intl.getCanonicalLocales` is `function`'
); );
verifyNotEnumerable(Intl, 'getCanonicalLocales'); verifyProperty(Intl, "getCanonicalLocales", {
verifyWritable(Intl, 'getCanonicalLocales'); writable: true,
verifyConfigurable(Intl, 'getCanonicalLocales'); enumerable: false,
configurable: true,
});

View File

@ -11,8 +11,9 @@ info: |
includes: [propertyHelper.js] includes: [propertyHelper.js]
---*/ ---*/
assert.sameValue(Intl.getCanonicalLocales.length, 1); verifyProperty(Intl.getCanonicalLocales, "length", {
value: 1,
verifyNotEnumerable(Intl.getCanonicalLocales, "length"); writable: false,
verifyNotWritable(Intl.getCanonicalLocales, "length"); enumerable: false,
verifyConfigurable(Intl.getCanonicalLocales, "length"); configurable: true,
});

View File

@ -11,10 +11,9 @@ info: |
includes: [propertyHelper.js] includes: [propertyHelper.js]
---*/ ---*/
assert.sameValue(Intl.getCanonicalLocales.name, 'getCanonicalLocales', verifyProperty(Intl.getCanonicalLocales, "name", {
'The value of `Intl.getCanonicalLocales.name` is `"getCanonicalLocales"`' value: "getCanonicalLocales",
); writable: false,
enumerable: false,
verifyNotEnumerable(Intl.getCanonicalLocales, 'name'); configurable: true,
verifyNotWritable(Intl.getCanonicalLocales, 'name'); });
verifyConfigurable(Intl.getCanonicalLocales, 'name');

View File

@ -14,22 +14,34 @@ includes: [propertyHelper.js]
var locales = ['en-US', 'fr']; var locales = ['en-US', 'fr'];
var result = Intl.getCanonicalLocales(locales); var result = Intl.getCanonicalLocales(locales);
verifyEnumerable(result, 0); verifyProperty(result, 0, {
verifyWritable(result, 0); value: 'en-US',
verifyConfigurable(result, 0); writable: true,
enumerable: true,
configurable: true,
});
result = Intl.getCanonicalLocales(locales); result = Intl.getCanonicalLocales(locales);
verifyEnumerable(result, 1);
verifyWritable(result, 1); verifyProperty(result, 1, {
verifyConfigurable(result, 1); value: 'fr',
writable: true,
enumerable: true,
configurable: true,
});
result = Intl.getCanonicalLocales(locales); result = Intl.getCanonicalLocales(locales);
verifyNotEnumerable(result, 'length');
verifyNotConfigurable(result, 'length');
assert.sameValue(result.length, 2); verifyProperty(result, "length", {
value: 2,
writable: true,
enumerable: false,
configurable: false,
});
result.length = 42; result.length = 42;
assert.sameValue(result.length, 42); assert.sameValue(result.length, 42);
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
result.length = "Leo"; result.length = "Leo";
}, "a non-numeric value can't be set to result.length"); }, "a non-numeric value can't be set to result.length");

View File

@ -24,8 +24,9 @@ info: |
includes: [propertyHelper.js] includes: [propertyHelper.js]
---*/ ---*/
assert.sameValue(String.prototype.localeCompare.length, 1); verifyProperty(String.prototype.localeCompare, "length", {
value: 1,
verifyNotEnumerable(String.prototype.localeCompare, "length"); writable: false,
verifyNotWritable(String.prototype.localeCompare, "length"); enumerable: false,
verifyConfigurable(String.prototype.localeCompare, "length"); configurable: true,
});