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]
---*/
assert.sameValue(Date.prototype.toLocaleDateString.length, 0);
verifyNotEnumerable(Date.prototype.toLocaleDateString, "length");
verifyNotWritable(Date.prototype.toLocaleDateString, "length");
verifyConfigurable(Date.prototype.toLocaleDateString, "length");
verifyProperty(Date.prototype.toLocaleDateString, "length", {
value: 0,
writable: false,
enumerable: false,
configurable: true,
});

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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