From: Evan Lucas Date: Sun, 27 Sep 2015 15:59:02 +0000 (-0500) Subject: src: add process.versions.icu X-Git-Tag: v4.2.0~58 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7271cb047cbf2ad0f719142c1e00e4392cb44721;p=platform%2Fupstream%2Fnodejs.git src: add process.versions.icu If i18n support is present, add the icu version to process.versions Fixes: https://github.com/nodejs/node/issues/3089 PR-URL: https://github.com/nodejs/node/pull/3102 Reviewed-By: Steven R Loomis Reviewed-By: Roman Reiss Reviewed-By: Rod Vagg --- diff --git a/doc/api/process.markdown b/doc/api/process.markdown index ee6f540..7195376 100644 --- a/doc/api/process.markdown +++ b/doc/api/process.markdown @@ -648,6 +648,7 @@ Will print something like: zlib: '1.2.8', ares: '1.10.0-DEV', modules: '43', + icu: '55.1', openssl: '1.0.1k' } ## process.config diff --git a/src/node.cc b/src/node.cc index b6acc9d..501caf2 100644 --- a/src/node.cc +++ b/src/node.cc @@ -52,6 +52,10 @@ #include #include +#if defined(NODE_HAVE_I18N_SUPPORT) +#include +#endif + #if defined(LEAK_SANITIZER) #include #endif @@ -2681,6 +2685,12 @@ void SetupProcessObject(Environment* env, "ares", FIXED_ONE_BYTE_STRING(env->isolate(), ARES_VERSION_STR)); +#if defined(NODE_HAVE_I18N_SUPPORT) && defined(U_ICU_VERSION) + READONLY_PROPERTY(versions, + "icu", + OneByteString(env->isolate(), U_ICU_VERSION)); +#endif + const char node_modules_version[] = NODE_STRINGIFY(NODE_MODULE_VERSION); READONLY_PROPERTY( versions, diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index 637ada7..900143d 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -9,4 +9,8 @@ if (common.hasCrypto) { expected_keys.push('openssl'); } +if (typeof Intl !== 'undefined') { + expected_keys.push('icu'); +} + assert.deepEqual(Object.keys(process.versions).sort(), expected_keys.sort());