blob: 24b97137a0795f0c4803d47b70332897b23eacf3 [file] [log] [blame]
keith_miller@apple.combcc77f22016-07-15 06:03:25 +00001// Copyright 2012 Mozilla Corporation. All rights reserved.
2// This code is governed by the BSD license found in the LICENSE file.
3
4/*---
5es5id: 9.2.1_8_c_ii
6description: Tests that values other than strings are not accepted as locales.
7author: Norbert Lindenberg
8includes: [testIntl.js]
9---*/
10
11var notStringOrObject = [undefined, null, true, false, 0, 5, -5, NaN];
12
13testWithIntlConstructors(function (Constructor) {
14 notStringOrObject.forEach(function (value) {
15 var error;
16 try {
17 var supported = Constructor.supportedLocalesOf([value]);
18 } catch (e) {
19 error = e;
20 }
21 if (error === undefined) {
22 $ERROR("" + value + " as locale was not rejected.");
23 } else if (error.name !== "TypeError") {
24 $ERROR("" + value + " as locale was rejected with wrong error " + error.name + ".");
25 }
26 });
27
28 return true;
29});