Skip to content

Commit d7e4ae1

Browse files
committed
test: add common.hasIntl
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>
1 parent 1e4fafc commit d7e4ae1

5 files changed

+10
-7
lines changed

test/common.js

+6
Original file line numberDiff line numberDiff line change
@@ -525,3 +525,9 @@ exports.expectWarning = function(name, expected) {
525525
expected.splice(expected.indexOf(warning.message), 1);
526526
}, expected.length));
527527
};
528+
529+
Object.defineProperty(exports, 'hasIntl', {
530+
get: function() {
531+
return process.binding('config').hasIntl;
532+
}
533+
});

test/parallel/test-intl-v8BreakIterator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
const common = require('../common');
33
const assert = require('assert');
44

5-
if (global.Intl === undefined || Intl.v8BreakIterator === undefined) {
5+
if (!common.hasIntl || Intl.v8BreakIterator === undefined) {
66
return common.skip('no Intl');
77
}
88

test/parallel/test-intl.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ if (enablei18n === undefined) {
88
enablei18n = 0;
99
}
1010

11-
// is the Intl object present?
12-
const haveIntl = (global.Intl !== undefined);
13-
1411
// Returns true if no specific locale ids were configured (i.e. "all")
1512
// Else, returns true if loc is in the configured list
1613
// Else, returns false
@@ -19,7 +16,7 @@ function haveLocale(loc) {
1916
return locs.indexOf(loc) !== -1;
2017
}
2118

22-
if (!haveIntl) {
19+
if (!common.hasIntl) {
2320
const erMsg =
2421
'"Intl" object is NOT present but v8_enable_i18n_support is ' +
2522
enablei18n;

test/parallel/test-process-versions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if (common.hasCrypto) {
99
expected_keys.push('openssl');
1010
}
1111

12-
if (typeof Intl !== 'undefined') {
12+
if (common.hasIntl) {
1313
expected_keys.push('icu');
1414
}
1515

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ const testNonGlobal = repl.start({
277277
const builtins = [['Infinity', '', 'Int16Array', 'Int32Array',
278278
'Int8Array'], 'I'];
279279

280-
if (typeof Intl === 'object') {
280+
if (common.hasIntl) {
281281
builtins[0].push('Intl');
282282
}
283283
testNonGlobal.complete('I', common.mustCall((error, data) => {

0 commit comments

Comments
 (0)