2347c81ad6
1. Add test to ensure none of the array contains undefined 2. Calculate the fixed array size by considering the code may filter out some itmes returned by ICU. 3. Add test to check there are no undefined. 4. Add test to check the locale.timeZones return sorted array. 5. Also refactor the JSArray generation code. Bug: v8:11871 Change-Id: I8ad4a779d137d9b7e2deead7a1aa38e599e1af2e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2953517 Commit-Queue: Frank Tang <ftang@chromium.org> Reviewed-by: Shu-yu Guo <syg@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/master@{#75162}
31 lines
848 B
JavaScript
31 lines
848 B
JavaScript
// Copyright 2021 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// Flags: --harmony_intl_locale_info
|
|
|
|
// Check the return array has no undefined
|
|
function checkNoUndefined(l, items) {
|
|
items.forEach( function(item) {
|
|
assertNotUndefined(item, l + ": [" +items + "] should not have undefined");
|
|
});
|
|
}
|
|
function checkLocale(locale) {
|
|
let l = new Intl.Locale(locale)
|
|
checkNoUndefined(l, l.calendars);
|
|
checkNoUndefined(l, l.collations);
|
|
checkNoUndefined(l, l.hourCycles);
|
|
checkNoUndefined(l, l.numberingSystems);
|
|
if (l.region != undefined) {
|
|
checkNoUndefined(l, l.timeZones);
|
|
}
|
|
}
|
|
|
|
checkLocale("ar");
|
|
checkLocale("en");
|
|
checkLocale("fr");
|
|
checkLocale("en-GB");
|
|
checkLocale("en-US");
|
|
checkLocale("zh-TW");
|
|
checkLocale("zh-CN");
|