Skip to content

Commit

Permalink
test: add common.hasIntl
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
jasnell authored and evanlucas committed Nov 2, 2016
1 parent efb62aa commit a39b98e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
6 changes: 6 additions & 0 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 1 addition & 1 deletion test/parallel/test-intl-v8BreakIterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down
5 changes: 1 addition & 4 deletions test/parallel/test-intl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-process-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (common.hasCrypto) {
expected_keys.push('openssl');
}

if (typeof Intl !== 'undefined') {
if (common.hasIntl) {
expected_keys.push('icu');
}

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-repl-tab-complete.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit a39b98e

Please sign in to comment.