check-kn-option.js 709 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
// 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);
}
);