Skip to content

Commit 6bf3344

Browse files
FrankYFTangV8 LUCI CQ
authored andcommitted
[Intl] Impl LocaleInfo PR 63
tc39/proposal-intl-locale-info#63 Sort collation code alphabetically before return. Bug: v8:13542 Change-Id: I1c7df69af483a96a1fc7625b11c2b850edc59283 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4094503 Commit-Queue: Frank Tang <[email protected]> Reviewed-by: Shu-yu Guo <[email protected]> Cr-Commit-Position: refs/heads/main@{#84857}
1 parent f0dfa87 commit 6bf3344

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

src/objects/js-locale.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ MaybeHandle<JSArray> JSLocale::Collations(Isolate* isolate,
531531
icu::Locale icu_locale(*(locale->icu_locale().raw()));
532532
return GetKeywordValuesFromLocale<icu::Collator>(
533533
isolate, "collations", "co", icu_locale, Intl::RemoveCollation, true,
534-
false);
534+
true);
535535
}
536536

537537
MaybeHandle<JSArray> JSLocale::HourCycles(Isolate* isolate,

test/intl/assert.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,3 +292,17 @@ function assertLanguageTag(child, parent) {
292292
fail(child, parent, 'language tag comparison');
293293
}
294294
}
295+
296+
function assertArrayEquals(expected, found, name_opt) {
297+
var start = "";
298+
if (name_opt) {
299+
start = name_opt + " - ";
300+
}
301+
assertEquals(expected.length, found.length, start + "array length");
302+
if (expected.length === found.length) {
303+
for (var i = 0; i < expected.length; ++i) {
304+
assertEquals(expected[i], found[i],
305+
start + "array element at index " + i);
306+
}
307+
}
308+
}

test/intl/locale/locale-collations.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ for (var i = 0; i < a_to_z.length; i++) {
1515
locale + ".collations [" + locale.collations +
1616
"] does not meet 'type: alphanum{3,8}(sep alphanum{3,8})*'");
1717
});
18+
assertArrayEquals(locale.collations, locale.collations.sort());
1819
}
1920
}

0 commit comments

Comments
 (0)