| 1 |
// Copyright 2016 Mozilla Corporation. All rights reserved. |
| 2 |
// This code is governed by the license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
esid: sec-intl.getcanonicallocales |
| 6 |
description: Tests for scenario where locales is not a string |
| 7 |
info: | |
| 8 |
8.2.1 Intl.getCanonicalLocales (locales) |
| 9 |
1. Let ll be ? CanonicalizeLocaleList(locales). |
| 10 |
2. Return CreateArrayFromList(ll). |
| 11 |
includes: [compareArray.js] |
| 12 |
features: [Symbol] |
| 13 |
---*/ |
| 14 |
|
| 15 |
var gCL = Intl.getCanonicalLocales; |
| 16 |
|
| 17 |
function assertArray(l, r) { |
| 18 |
assert(compareArray(l, r), r); |
| 19 |
} |
| 20 |
|
| 21 |
assertArray(gCL(), []); |
| 22 |
assertArray(gCL(undefined), []); |
| 23 |
assertArray(gCL(false), []); |
| 24 |
assertArray(gCL(true), []); |
| 25 |
assertArray(gCL(Symbol("foo")), []); |
| 26 |
assertArray(gCL(NaN), []); |
| 27 |
assertArray(gCL(1), []); |
| 28 |
|
| 29 |
Number.prototype[0] = "en-US"; |
| 30 |
Number.prototype.length = 1; |
| 31 |
assertArray(gCL(NaN), ["en-US"]); |