Browse Source

test: add common.hasIntl

PR-URL: https://github.com/nodejs/node/pull/9246
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
v6
James M Snell 8 years ago
parent
commit
d7e4ae1eb0
  1. 6
      test/common.js
  2. 2
      test/parallel/test-intl-v8BreakIterator.js
  3. 5
      test/parallel/test-intl.js
  4. 2
      test/parallel/test-process-versions.js
  5. 2
      test/parallel/test-repl-tab-complete.js

6
test/common.js

@ -525,3 +525,9 @@ exports.expectWarning = function(name, expected) {
expected.splice(expected.indexOf(warning.message), 1);
}, expected.length));
};
Object.defineProperty(exports, 'hasIntl', {
get: function() {
return process.binding('config').hasIntl;
}
});

2
test/parallel/test-intl-v8BreakIterator.js

@ -2,7 +2,7 @@
const common = require('../common');
const assert = require('assert');
if (global.Intl === undefined || Intl.v8BreakIterator === undefined) {
if (!common.hasIntl || Intl.v8BreakIterator === undefined) {
return common.skip('no Intl');
}

5
test/parallel/test-intl.js

@ -8,9 +8,6 @@ if (enablei18n === undefined) {
enablei18n = 0;
}
// is the Intl object present?
const haveIntl = (global.Intl !== undefined);
// Returns true if no specific locale ids were configured (i.e. "all")
// Else, returns true if loc is in the configured list
// Else, returns false
@ -19,7 +16,7 @@ function haveLocale(loc) {
return locs.indexOf(loc) !== -1;
}
if (!haveIntl) {
if (!common.hasIntl) {
const erMsg =
'"Intl" object is NOT present but v8_enable_i18n_support is ' +
enablei18n;

2
test/parallel/test-process-versions.js

@ -9,7 +9,7 @@ if (common.hasCrypto) {
expected_keys.push('openssl');
}
if (typeof Intl !== 'undefined') {
if (common.hasIntl) {
expected_keys.push('icu');
}

2
test/parallel/test-repl-tab-complete.js

@ -277,7 +277,7 @@ const testNonGlobal = repl.start({
const builtins = [['Infinity', '', 'Int16Array', 'Int32Array',
'Int8Array'], 'I'];
if (typeof Intl === 'object') {
if (common.hasIntl) {
builtins[0].push('Intl');
}
testNonGlobal.complete('I', common.mustCall((error, data) => {

Loading…
Cancel
Save