File Update-to-ICU-61-Part-3-Update-tests.patch of Package mozjs60

From: =?utf-8?q?Andr=C3=A9_Bargull?= <andre.bargull@gmail.com>
Date: Tue, 27 Mar 2018 07:40:40 -0700
Subject: Update to ICU 61, Part 3: Update tests

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1445465
Applied-upstream: 61, commit:https://hg.mozilla.org/mozilla-central/rev/3214fb35ccd6
---
 .../tests/non262/Intl/NumberFormat/StringBuffer.js | 26 +++++++++++++++++++---
 .../non262/Intl/NumberFormat/formatToParts.js      |  1 -
 2 files changed, 23 insertions(+), 4 deletions(-)

Index: mozjs-60.8.0/js/src/tests/non262/Intl/NumberFormat/StringBuffer.js
===================================================================
--- mozjs-60.8.0.orig/js/src/tests/non262/Intl/NumberFormat/StringBuffer.js
+++ mozjs-60.8.0/js/src/tests/non262/Intl/NumberFormat/StringBuffer.js
@@ -10,8 +10,28 @@
 
 var format = new Intl.NumberFormat("it-IT", {minimumFractionDigits: 1});
 
-assertEq(format.format(1123123123123123123123.1), "1.123.123.123.123.120.000.000,0");
-assertEq(format.format(12123123123123123123123.1), "12.123.123.123.123.100.000.000,0");
-assertEq(format.format(123123123123123123123123.1), "123.123.123.123.123.000.000.000,0");
+assertEq(format.format(1123123123123123123123.1), "1.123.123.123.123.123.100.000,0");
+assertEq(format.format(12123123123123123123123.1), "12.123.123.123.123.122.000.000,0");
+assertEq(format.format(123123123123123123123123.1), "123.123.123.123.123.120.000.000,0");
+
+// Ensure the ICU output matches Number.prototype.toFixed.
+function formatToFixed(x) {
+    var mfd = format.resolvedOptions().maximumFractionDigits;
+    var s = x.toFixed(mfd);
+
+    // To keep it simple we assume |s| is always in exponential form.
+    var m = s.match(/^(\d)\.(\d+)e\+(\d+)$/);
+    assertEq(m !== null, true);
+    s = m[1] + m[2].padEnd(m[3], "0");
+
+    // Group digits and append fractional part.
+    m = s.match(/\d{1,3}(?=(?:\d{3})*$)/g);
+    assertEq(m !== null, true);
+    return m.join(".") + ",0";
+}
+
+assertEq(formatToFixed(1123123123123123123123.1), "1.123.123.123.123.123.100.000,0");
+assertEq(formatToFixed(12123123123123123123123.1), "12.123.123.123.123.122.000.000,0");
+assertEq(formatToFixed(123123123123123123123123.1), "123.123.123.123.123.120.000.000,0");
 
 reportCompare(0, 0, "ok");
Index: mozjs-60.8.0/js/src/tests/non262/Intl/NumberFormat/formatToParts.js
===================================================================
--- mozjs-60.8.0.orig/js/src/tests/non262/Intl/NumberFormat/formatToParts.js
+++ mozjs-60.8.0/js/src/tests/non262/Intl/NumberFormat/formatToParts.js
@@ -215,7 +215,6 @@ assertParts(arPercentFormatter, -135.32,
              Integer("٥٣٢"),
              Decimal("٫"),
              Fraction("٠٠"),
-             Literal("\xA0"),
              PercentSign("٪\u{061C}")]);
 
 // Decimals.