Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
test: add common.hasIntl
  • Loading branch information
jasnell committed Oct 24, 2016
commit f4ce7c1ee72d898a855a21a4f9ef1e726ae772d3
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