summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/NumberFormat/prototype/format/unit-de-DE.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/intl402/NumberFormat/prototype/format/unit-de-DE.js')
-rw-r--r--js/src/tests/test262/intl402/NumberFormat/prototype/format/unit-de-DE.js71
1 files changed, 71 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/NumberFormat/prototype/format/unit-de-DE.js b/js/src/tests/test262/intl402/NumberFormat/prototype/format/unit-de-DE.js
new file mode 100644
index 0000000000..622496c60c
--- /dev/null
+++ b/js/src/tests/test262/intl402/NumberFormat/prototype/format/unit-de-DE.js
@@ -0,0 +1,71 @@
+// Copyright 2019 Igalia, S.L. 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 the unit style.
+locale: [de-DE]
+features: [Intl.NumberFormat-unified]
+---*/
+
+
+const tests = [
+ [
+ -987,
+ {
+ "short": "-987 km/h",
+ "narrow": "-987 km/h",
+ "long": "-987 Kilometer pro Stunde",
+ }
+ ],
+ [
+ -0.001,
+ {
+ "short": "-0,001 km/h",
+ "narrow": "-0,001 km/h",
+ "long": "-0,001 Kilometer pro Stunde",
+ }
+ ],
+ [
+ -0,
+ {
+ "short": "-0 km/h",
+ "narrow": "-0 km/h",
+ "long": "-0 Kilometer pro Stunde",
+ }
+ ],
+ [
+ 0,
+ {
+ "short": "0 km/h",
+ "narrow": "0 km/h",
+ "long": "0 Kilometer pro Stunde",
+ }
+ ],
+ [
+ 0.001,
+ {
+ "short": "0,001 km/h",
+ "narrow": "0,001 km/h",
+ "long": "0,001 Kilometer pro Stunde",
+ }
+ ],
+ [
+ 987,
+ {
+ "short": "987 km/h",
+ "narrow": "987 km/h",
+ "long": "987 Kilometer pro Stunde",
+ }
+ ],
+];
+
+for (const [number, expectedData] of tests) {
+ for (const [unitDisplay, expected] of Object.entries(expectedData)) {
+ const nf = new Intl.NumberFormat("de-DE", { style: "unit", unit: "kilometer-per-hour", unitDisplay });
+ assert.sameValue(nf.format(number), expected);
+ }
+}
+
+
+reportCompare(0, 0);