summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/NumberFormat/prototype/format/units-invalid.js
blob: 904cf29ed9a3ac63f69a848e3dc5f96e6e7c6e10 (plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// Copyright 2019 Igalia, S.L., Google, Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-intl.numberformat.prototype.format
description: Checks handling of units.
features: [Intl.NumberFormat-unified]
---*/

const units = [
  "acre-foot",
  "ampere",
  "arc-minute",
  "arc-second",
  "astronomical-unit",
  "atmosphere",
  "bushel",
  "calorie",
  "carat",
  "centiliter",
  "century",
  "cubic-centimeter",
  "cubic-foot",
  "cubic-inch",
  "cubic-kilometer",
  "cubic-meter",
  "cubic-mile",
  "cubic-yard",
  "cup-metric",
  "cup",
  "day-person",
  "deciliter",
  "decimeter",
  "fathom",
  "foodcalorie",
  "furlong",
  "g-force",
  "gallon-imperial",
  "generic",
  "gigahertz",
  "gigawatt",
  "hectoliter",
  "hectopascal",
  "hertz",
  "horsepower",
  "inch-hg",
  "joule",
  "karat",
  "kelvin",
  "kilocalorie",
  "kilohertz",
  "kilojoule",
  "kilowatt-hour",
  "kilowatt",
  "knot",
  "light-year",
  "lux",
  "megahertz",
  "megaliter",
  "megawatt",
  "metric-ton",
  "microgram",
  "micrometer",
  "milliampere",
  "millibar",
  "milligram",
  "millimeter-of-mercury",
  "milliwatt",
  "month-person",
  "nanometer",
  "nautical-mile",
  "ohm",
  "ounce-troy",
  "parsec",
  "permille",
  "picometer",
  "pint-metric",
  "pint",
  "point",
  "quart",
  "radian",
  "revolution",
  "square-centimeter",
  "square-foot",
  "square-inch",
  "square-kilometer",
  "square-meter",
  "square-mile",
  "square-yard",
  "tablespoon",
  "teaspoon",
  "ton",
  "volt",
  "watt",
  "week-person",
  "year-person",
  "liter-per-100kilometers",
  "meter-per-second-squared",
  "mile-per-gallon-imperial",
  "milligram-per-deciliter",
  "millimole-per-liter",
  "part-per-million",
  "pound-per-square-inch",
];

for (const unit of units) {
  assert.throws(RangeError, () => new Intl.NumberFormat(undefined, { style: "unit", unit }), `Throw for ${unit}`);
}

reportCompare(0, 0);