From 06fc24ae6991fbc8b77142ae27058b89265f84b9 Mon Sep 17 00:00:00 2001 From: Asheem Mamoowala Date: Tue, 23 Jul 2019 12:42:09 -0700 Subject: [PATCH 1/3] Fix expression test. The tests are run in node, whose default small-icu implementations don't have support for ja and de locales. Use en-US locale for consistency and adjust expectations --- .../expression-tests/number-format/currency/test.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/integration/expression-tests/number-format/currency/test.json b/test/integration/expression-tests/number-format/currency/test.json index 7ad0292da34..a25b057baad 100644 --- a/test/integration/expression-tests/number-format/currency/test.json +++ b/test/integration/expression-tests/number-format/currency/test.json @@ -8,8 +8,8 @@ } ], "inputs": [ - [{}, {"properties": {"locale": "ja-JP", "currency": "JPY"}}], - [{}, {"properties": {"locale": "de-DE", "currency": "EUR"}}] + [{}, {"properties": {"locale": "en-US", "currency": "JPY"}}], + [{}, {"properties": {"locale": "en-US", "currency": "EUR"}}] ], "expected": { "compiled": { @@ -18,7 +18,7 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["JP¥ 123,457", "€ 123,456.79"], + "outputs": ["¥123,457", "€123,456.79"], "serialized": [ "number-format", 123456.789, From afd9637b0cf302bf61259e6a97cb8f14e5f1f042 Mon Sep 17 00:00:00 2001 From: Asheem Mamoowala Date: Tue, 23 Jul 2019 12:45:55 -0700 Subject: [PATCH 2/3] Fix number-format/precision expression test. Node v8 and v10 have different rounding behavior in Intl.NumberFormat. The test is not trying to validate rounding behavior, so reduce post-decimal precision and adjust expectations --- .../expression-tests/number-format/precision/test.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/integration/expression-tests/number-format/precision/test.json b/test/integration/expression-tests/number-format/precision/test.json index 837ffa4bedd..c4266201f22 100644 --- a/test/integration/expression-tests/number-format/precision/test.json +++ b/test/integration/expression-tests/number-format/precision/test.json @@ -1,7 +1,7 @@ { "expression": [ "number-format", - 987654321.23456789, + 987654321.234567, { "locale": ["get", "locale"], "min-fraction-digits": ["get", "min"], @@ -19,10 +19,10 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["987,654,321.234568000000000", "987,654,321.2346"], + "outputs": ["987,654,321.234567000000000", "987,654,321.2346"], "serialized": [ "number-format", - 987654321.2345679, + 987654321.234567, { "locale": ["string", ["get", "locale"]], "min-fraction-digits": ["number", ["get", "min"]], From d67263a67955f5aa344ffc18bc7a229e76f1ed5b Mon Sep 17 00:00:00 2001 From: Asheem Mamoowala Date: Tue, 23 Jul 2019 13:17:59 -0700 Subject: [PATCH 3/3] Add expressions tests to the test-suite script --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8aae1f6b389..3785bf90b17 100644 --- a/package.json +++ b/package.json @@ -139,8 +139,8 @@ "lint-css": "stylelint 'src/css/mapbox-gl.css'", "open-changed-examples": "git diff --name-only publisher-production HEAD -- docs/pages/example/*.html | awk '{print \"http://127.0.0.1:4000/mapbox-gl-js/example/\" substr($0,33,length($0)-37)}' | xargs open", "test": "run-s lint lint-css test-flow test-unit", - "test-suite": "run-s test-render test-query", - "test-suite-clean": "find test/integration/{render,query}-tests -mindepth 2 -type d -exec test -e \"{}/actual.png\" \\; -not \\( -exec test -e \"{}/style.json\" \\; \\) -print | xargs -t rm -r", + "test-suite": "run-s test-render test-query test-expressions", + "test-suite-clean": "find test/integration/{render,query, expressions}-tests -mindepth 2 -type d -exec test -e \"{}/actual.png\" \\; -not \\( -exec test -e \"{}/style.json\" \\; \\) -print | xargs -t rm -r", "test-unit": "build/run-tap --reporter classic --no-coverage test/unit", "test-build": "build/run-tap --no-coverage test/build/**/*.test.js", "test-render": "node --max-old-space-size=2048 test/render.test.js",