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>
This commit is contained in:
parent
1e4fafcb1a
commit
d7e4ae1eb0
@ -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,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');
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -9,7 +9,7 @@ if (common.hasCrypto) {
|
||||
expected_keys.push('openssl');
|
||||
}
|
||||
|
||||
if (typeof Intl !== 'undefined') {
|
||||
if (common.hasIntl) {
|
||||
expected_keys.push('icu');
|
||||
}
|
||||
|
||||
|
@ -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…
x
Reference in New Issue
Block a user