Bug 854320 - ECMA-402 tests ch10/10.1/10.1.1_a.js, ch11/11.1/11.1.1_a.js, ch12/12.1/12.1.1_a.js failing. r=jwalden

This commit is contained in:
Norbert Lindenberg 2013-07-11 09:54:09 -04:00
parent 10b91a604a
commit 83509983f7
2 changed files with 23 additions and 12 deletions

View File

@ -67,7 +67,21 @@ function toASCIIUpperCase(s) {
*/
var unicodeLocaleExtensionSequence = "-u(-[a-z0-9]{2,8})+";
var unicodeLocaleExtensionSequenceRE = new RegExp(unicodeLocaleExtensionSequence);
var unicodeLocaleExtensionSequenceGlobalRE = new RegExp(unicodeLocaleExtensionSequence, "g");
/**
* Removes Unicode locale extension sequences from the given language tag.
*/
function removeUnicodeExtensions(locale) {
// Don't use std_String_replace directly with a regular expression,
// as that would set RegExp statics.
var extensions;
while ((extensions = regexp_exec_no_statics(unicodeLocaleExtensionSequenceRE, locale)) !== null) {
locale = callFunction(std_String_replace, locale, extensions[0], "");
unicodeLocaleExtensionSequenceRE.lastIndex = 0;
}
return locale;
}
/**
@ -247,7 +261,7 @@ var duplicateSingletonRE = (function () {
*/
function IsStructurallyValidLanguageTag(locale) {
assert(typeof locale === "string", "IsStructurallyValidLanguageTag");
if (!callFunction(std_RegExp_test, languageTagRE, locale))
if (!regexp_test_no_statics(languageTagRE, locale))
return false;
// Before checking for duplicate variant or singleton subtags with
@ -260,8 +274,8 @@ function IsStructurallyValidLanguageTag(locale) {
locale = callFunction(std_String_substring, locale, 0, pos);
// Check for duplicate variant or singleton subtags.
return !callFunction(std_RegExp_test, duplicateVariantRE, locale) &&
!callFunction(std_RegExp_test, duplicateSingletonRE, locale);
return !regexp_test_no_statics(duplicateVariantRE, locale) &&
!regexp_test_no_statics(duplicateSingletonRE, locale);
}
@ -443,7 +457,7 @@ function IsWellFormedCurrencyCode(currency) {
var normalized = toASCIIUpperCase(c);
if (normalized.length !== 3)
return false;
return !callFunction(std_RegExp_test, /[^A-Z]/, normalized);
return !regexp_test_no_statics(/[^A-Z]/, normalized);
}
@ -548,7 +562,7 @@ function LookupMatcher(availableLocales, requestedLocales) {
var locale, noExtensionsLocale;
while (i < len && availableLocale === undefined) {
locale = requestedLocales[i];
noExtensionsLocale = callFunction(std_String_replace, locale, unicodeLocaleExtensionSequenceGlobalRE, "");
noExtensionsLocale = removeUnicodeExtensions(locale);
availableLocale = BestAvailableLocale(availableLocales, noExtensionsLocale);
i++;
}
@ -557,7 +571,7 @@ function LookupMatcher(availableLocales, requestedLocales) {
if (availableLocale !== undefined) {
result.locale = availableLocale;
if (locale !== noExtensionsLocale) {
var extensionMatch = callFunction(std_String_match, locale, unicodeLocaleExtensionSequenceRE);
var extensionMatch = regexp_exec_no_statics(unicodeLocaleExtensionSequenceRE, locale);
var extension = extensionMatch[0];
var extensionIndex = extensionMatch.index;
result.extension = extension;
@ -741,7 +755,7 @@ function LookupSupportedLocales(availableLocales, requestedLocales) {
while (k < len) {
// Steps 4.a-b.
var locale = requestedLocales[k];
var noExtensionsLocale = callFunction(std_String_replace, locale, unicodeLocaleExtensionSequenceGlobalRE, "");
var noExtensionsLocale = removeUnicodeExtensions(locale);
// Step 4.c-d.
var availableLocale = BestAvailableLocale(availableLocales, noExtensionsLocale);
@ -1378,7 +1392,7 @@ var currencyDigits = {
*/
function CurrencyDigits(currency) {
assert(typeof currency === "string", "CurrencyDigits");
assert(callFunction(std_RegExp_test, /^[A-Z]{3}$/, currency), "CurrencyDigits");
assert(regexp_test_no_statics(/^[A-Z]{3}$/, currency), "CurrencyDigits");
if (callFunction(std_Object_hasOwnProperty, currencyDigits, currency))
return currencyDigits[currency];

View File

@ -36,12 +36,9 @@ skip-if(!xulRuntime.shell) script test262/ch10/10.4/10.4.2/S10.4.2_A1.2_T11.js
skip script test262/ch10/10.4/10.4.3/10.4.3-1-104.js # bug 603201
skip script test262/ch10/10.4/10.4.3/10.4.3-1-106.js # bug 603201
skip script test262/intl402/ch10/10.1/10.1.1_a.js # bug 854320
skip script test262/intl402/ch10/10.1/10.1.1_13.js # bug 853704
skip script test262/intl402/ch10/10.1/10.1.1_19_c.js # bug 853704
skip script test262/intl402/ch11/11.1/11.1.1_a.js # bug 854320
skip script test262/intl402/ch11/11.3/11.3.2_TRP.js # bug 853706
skip script test262/intl402/ch12/12.1/12.1.1_a.js # bug 854320
#######################################################################
# Tests disabled due to jstest limitations wrt imported test262 tests #