Skip to content
forked from v8/v8

Commit

Permalink
[Intl] Impl LocaleInfo PR 63
Browse files Browse the repository at this point in the history
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 <ftang@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84857}
  • Loading branch information
FrankYFTang authored and V8 LUCI CQ committed Dec 15, 2022
1 parent f0dfa87 commit 6bf3344
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/objects/js-locale.cc
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ MaybeHandle<JSArray> JSLocale::Collations(Isolate* isolate,
icu::Locale icu_locale(*(locale->icu_locale().raw()));
return GetKeywordValuesFromLocale<icu::Collator>(
isolate, "collations", "co", icu_locale, Intl::RemoveCollation, true,
false);
true);
}

MaybeHandle<JSArray> JSLocale::HourCycles(Isolate* isolate,
Expand Down
14 changes: 14 additions & 0 deletions test/intl/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,3 +292,17 @@ function assertLanguageTag(child, parent) {
fail(child, parent, 'language tag comparison');
}
}

function assertArrayEquals(expected, found, name_opt) {
var start = "";
if (name_opt) {
start = name_opt + " - ";
}
assertEquals(expected.length, found.length, start + "array length");
if (expected.length === found.length) {
for (var i = 0; i < expected.length; ++i) {
assertEquals(expected[i], found[i],
start + "array element at index " + i);
}
}
}
1 change: 1 addition & 0 deletions test/intl/locale/locale-collations.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ for (var i = 0; i < a_to_z.length; i++) {
locale + ".collations [" + locale.collations +
"] does not meet 'type: alphanum{3,8}(sep alphanum{3,8})*'");
});
assertArrayEquals(locale.collations, locale.collations.sort());
}
}

0 comments on commit 6bf3344

Please sign in to comment.