From 2cba585a89a80c7cb07c5b3596459df3dc29ac07 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sat, 11 Feb 2017 14:04:58 +0100 Subject: [PATCH] src: fix --icu-data-dir= regression Commit a8734af ("src: make copies of startup environment variables") from two weeks ago introduced a regression in the capturing of the `--icu-data-dir=` switch: it captured the string up to the `=` instead of what comes after it. PR-URL: https://github.com/nodejs/node/pull/11255 Reviewed-By: James M Snell Reviewed-By: Sam Roberts --- src/node.cc | 2 +- test/parallel/test-intl-no-icu-data.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/node.cc b/src/node.cc index fc4ac88ba3d360..30c44c18ecb26e 100644 --- a/src/node.cc +++ b/src/node.cc @@ -3742,7 +3742,7 @@ static void ParseArgs(int* argc, #endif /* HAVE_OPENSSL */ #if defined(NODE_HAVE_I18N_SUPPORT) } else if (strncmp(arg, "--icu-data-dir=", 15) == 0) { - icu_data_dir.assign(arg, 15); + icu_data_dir.assign(arg + 15); #endif } else if (strcmp(arg, "--expose-internals") == 0 || strcmp(arg, "--expose_internals") == 0) { diff --git a/test/parallel/test-intl-no-icu-data.js b/test/parallel/test-intl-no-icu-data.js index dd14c146719fb1..ce5e9a08121cdc 100644 --- a/test/parallel/test-intl-no-icu-data.js +++ b/test/parallel/test-intl-no-icu-data.js @@ -2,6 +2,8 @@ 'use strict'; require('../common'); const assert = require('assert'); +const config = process.binding('config'); // No-op when ICU case mappings are unavailable. assert.strictEqual('ç'.toLocaleUpperCase('el'), 'ç'); +assert.strictEqual(config.icuDataDir, 'test/fixtures/empty/');