v8/test/intl/collator/check-kn-option.js
Frank Tang 8d0942499c [Intl] Validate u extension type
Fix intl402/*/ignore-invalid-unicode-ext-values
Add tests for other valid/invalid -u- ext values.

Bug: v8:7481
Change-Id: I429effd071bb03599a1e767bb2a9e9918a91b850
Reviewed-on: https://chromium-review.googlesource.com/c/1351307
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58173}
2018-12-12 02:03:38 +00:00

30 lines
709 B
JavaScript

// Copyright 2018 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.
let invalid_kn = [
"invalid",
"search",
"standard",
"abce",
];
let valid_kn = [
["en-u-kn", true, "en-u-kn"],
["en-u-kn-true", true, "en-u-kn"],
["en-u-kn-false",false, "en-u-kn-false"],
];
invalid_kn.forEach(function(kn) {
let col = new Intl.Collator(["en-u-kn-" + kn]);
assertEquals("en", col.resolvedOptions().locale);
}
);
valid_kn.forEach(function(l) {
let col = new Intl.Collator([l[0] + "-fo-obar"]);
assertEquals(l[1], col.resolvedOptions().numeric);
assertEquals(l[2], col.resolvedOptions().locale);
}
);