Change tests according to ecma402/pull/278 (#2031)

This commit is contained in:
Frank Yung-Fong Tang 2019-01-18 08:15:37 -08:00 committed by Leo Balter
parent d53256c971
commit 4f1155c566
4 changed files with 17 additions and 14 deletions

View File

@ -21,14 +21,13 @@ assert.sameValue(Object.isExtensible(result), true,
assert.notSameValue(result.length, 0); assert.notSameValue(result.length, 0);
for (let i = 0; i < result.length; ++i) { for (let i = 0; i < result.length; ++i) {
verifyProperty(result, String(i), { verifyProperty(result, String(i), {
"writable": false, "writable": true,
"enumerable": true, "enumerable": true,
"configurable": false, "configurable": true,
}); });
} }
verifyProperty(result, "length", { verifyProperty(result, "length", {
"writable": false,
"enumerable": false, "enumerable": false,
"configurable": false, "configurable": false,
}); });

View File

@ -21,14 +21,13 @@ assert.sameValue(Object.isExtensible(result), true,
assert.notSameValue(result.length, 0); assert.notSameValue(result.length, 0);
for (let i = 0; i < result.length; ++i) { for (let i = 0; i < result.length; ++i) {
verifyProperty(result, String(i), { verifyProperty(result, String(i), {
"writable": false, "writable": true,
"enumerable": true, "enumerable": true,
"configurable": false, "configurable": true,
}); });
} }
verifyProperty(result, "length", { verifyProperty(result, "length", {
"writable": false,
"enumerable": false, "enumerable": false,
"configurable": false, "configurable": false,
}); });

View File

@ -21,14 +21,13 @@ assert.sameValue(Object.isExtensible(result), true,
assert.notSameValue(result.length, 0); assert.notSameValue(result.length, 0);
for (let i = 0; i < result.length; ++i) { for (let i = 0; i < result.length; ++i) {
verifyProperty(result, String(i), { verifyProperty(result, String(i), {
"writable": false, "writable": true,
"enumerable": true, "enumerable": true,
"configurable": false, "configurable": true,
}); });
} }
verifyProperty(result, "length", { verifyProperty(result, "length", {
"writable": false,
"enumerable": false, "enumerable": false,
"configurable": false, "configurable": false,
}); });

View File

@ -5,14 +5,20 @@
es5id: 9.2.8_4 es5id: 9.2.8_4
description: > description: >
Tests that the array returned by SupportedLocales is extensible, Tests that the array returned by SupportedLocales is extensible,
but its properties are non-writable/non-configurable. writable and configurable.
author: Norbert Lindenberg author: Norbert Lindenberg
includes: [testIntl.js] includes: [testIntl.js]
---*/ ---*/
function testFrozenProperty(obj, property) { function testNormalProperty(obj, property) {
var desc = Object.getOwnPropertyDescriptor(obj, property); var desc = Object.getOwnPropertyDescriptor(obj, property);
assert.sameValue(desc.writable, false, "Property " + property + " of object returned by SupportedLocales is writable."); assert.sameValue(desc.writable, true, "Property " + property + " of object returned by SupportedLocales is not writable.");
assert.sameValue(desc.configurable, true, "Property " + property + " of object returned by SupportedLocales is not configurable.");
}
function testLengthProperty(obj, property) {
var desc = Object.getOwnPropertyDescriptor(obj, property);
assert.sameValue(desc.writable, true, "Property " + property + " of object returned by SupportedLocales is not writable.");
assert.sameValue(desc.configurable, false, "Property " + property + " of object returned by SupportedLocales is configurable."); assert.sameValue(desc.configurable, false, "Property " + property + " of object returned by SupportedLocales is configurable.");
} }
@ -21,7 +27,7 @@ testWithIntlConstructors(function (Constructor) {
var supported = Constructor.supportedLocalesOf([defaultLocale]); var supported = Constructor.supportedLocalesOf([defaultLocale]);
assert(Object.isExtensible(supported), "Object returned by SupportedLocales is not extensible."); assert(Object.isExtensible(supported), "Object returned by SupportedLocales is not extensible.");
for (var i = 0; i < supported.length; i++) { for (var i = 0; i < supported.length; i++) {
testFrozenProperty(supported, i); testNormalProperty(supported, i);
} }
testFrozenProperty(supported, "length"); testLengthProperty(supported, "length");
}); });