mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 14:04:51 +02:00
Remove caching of getLocaleSupportInfo() return value
This commit is contained in:
parent
123259733b
commit
017fa6d55f
@ -33,26 +33,6 @@ function testWithIntlConstructors(f) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the name of the given constructor object, which must be one of
|
|
||||||
* Intl.Collator, Intl.NumberFormat, or Intl.DateTimeFormat.
|
|
||||||
* @param {object} Constructor a constructor
|
|
||||||
* @return {string} the name of the constructor
|
|
||||||
*/
|
|
||||||
function getConstructorName(Constructor) {
|
|
||||||
switch (Constructor) {
|
|
||||||
case Intl.Collator:
|
|
||||||
return "Collator";
|
|
||||||
case Intl.NumberFormat:
|
|
||||||
return "NumberFormat";
|
|
||||||
case Intl.DateTimeFormat:
|
|
||||||
return "DateTimeFormat";
|
|
||||||
default:
|
|
||||||
$ERROR("test internal error: unknown Constructor");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Taints a named data property of the given object by installing
|
* Taints a named data property of the given object by installing
|
||||||
* a setter that throws an exception.
|
* a setter that throws an exception.
|
||||||
@ -121,7 +101,6 @@ function taintArray() {
|
|||||||
var languages = ["zh", "es", "en", "hi", "ur", "ar", "ja", "pa"];
|
var languages = ["zh", "es", "en", "hi", "ur", "ar", "ja", "pa"];
|
||||||
var scripts = ["Latn", "Hans", "Deva", "Arab", "Jpan", "Hant"];
|
var scripts = ["Latn", "Hans", "Deva", "Arab", "Jpan", "Hant"];
|
||||||
var countries = ["CN", "IN", "US", "PK", "JP", "TW", "HK", "SG"];
|
var countries = ["CN", "IN", "US", "PK", "JP", "TW", "HK", "SG"];
|
||||||
var localeSupportInfo = {};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,11 +113,6 @@ var localeSupportInfo = {};
|
|||||||
* unsupported: array of unsupported language tags
|
* unsupported: array of unsupported language tags
|
||||||
*/
|
*/
|
||||||
function getLocaleSupportInfo(Constructor) {
|
function getLocaleSupportInfo(Constructor) {
|
||||||
var constructorName = getConstructorName(Constructor);
|
|
||||||
if (localeSupportInfo[constructorName] !== undefined) {
|
|
||||||
return localeSupportInfo[constructorName];
|
|
||||||
}
|
|
||||||
|
|
||||||
var allTags = [];
|
var allTags = [];
|
||||||
var i, j, k;
|
var i, j, k;
|
||||||
var language, script, country;
|
var language, script, country;
|
||||||
@ -174,13 +148,11 @@ function getLocaleSupportInfo(Constructor) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
localeSupportInfo[constructorName] = {
|
return {
|
||||||
supported: supported,
|
supported: supported,
|
||||||
byFallback: byFallback,
|
byFallback: byFallback,
|
||||||
unsupported: unsupported
|
unsupported: unsupported
|
||||||
};
|
};
|
||||||
|
|
||||||
return localeSupportInfo[constructorName];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,9 +11,10 @@ includes: [testIntl.js]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
testWithIntlConstructors(function (Constructor) {
|
testWithIntlConstructors(function (Constructor) {
|
||||||
|
var info = getLocaleSupportInfo(Constructor);
|
||||||
|
|
||||||
// this test should work equally for both matching algorithms
|
// this test should work equally for both matching algorithms
|
||||||
["lookup", "best fit"].forEach(function (matcher) {
|
["lookup", "best fit"].forEach(function (matcher) {
|
||||||
var info = getLocaleSupportInfo(Constructor);
|
|
||||||
var allLocales = info.supported.concat(info.byFallback, info.unsupported);
|
var allLocales = info.supported.concat(info.byFallback, info.unsupported);
|
||||||
allLocales.forEach(function (locale) {
|
allLocales.forEach(function (locale) {
|
||||||
var validExtension = "-u-co-phonebk-nu-latn";
|
var validExtension = "-u-co-phonebk-nu-latn";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user