test: use common.hasIntl in tests related to ICU

We should use `common.hasIntl` in tests for test cases which are
related to ICU.
This way we can easily find the test cases that are Intl dependent.
Plus, it will be able to make the tests a little faster if we check
hasIntl first.

Also, this tweaks the log messages to unify the message.

Refs: https://github.com/nodejs/node/pull/10707
PR-URL: https://github.com/nodejs/node/pull/10841
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Daijiro Wachi 2017-01-16 22:34:04 +01:00 committed by Luigi Pinca
parent c4b4611e58
commit 71650aa8fc
6 changed files with 18 additions and 18 deletions

View File

@ -1,6 +1,11 @@
'use strict';
const common = require('../common');
if (!common.hasIntl) {
common.skip('missing Intl');
return;
}
const icu = getPunycode();
const assert = require('assert');
@ -12,11 +17,6 @@ function getPunycode() {
}
}
if (!icu) {
common.skip('icu punycode tests because ICU is not present.');
return;
}
// Credit for list: http://www.i18nguy.com/markup/idna-examples.html
const tests = [
'افغانستا.icom.museum',

View File

@ -1,15 +1,15 @@
// Flags: --expose_internals
'use strict';
const common = require('../common');
const assert = require('assert');
const readline = require('internal/readline');
if (!process.binding('config').hasIntl) {
common.skip('missing intl... skipping test');
if (!common.hasIntl) {
common.skip('missing Intl');
return;
}
const assert = require('assert');
const readline = require('internal/readline');
// Test column width
assert.strictEqual(readline.getStringWidth('a'), 1);
assert.strictEqual(readline.getStringWidth('丁'), 2);

View File

@ -1,14 +1,14 @@
'use strict';
const common = require('../common');
const buffer = require('buffer');
const assert = require('assert');
if (!common.hasIntl) {
common.skip('icu punycode tests because ICU is not present.');
common.skip('missing Intl');
return;
}
const buffer = require('buffer');
const assert = require('assert');
const orig = Buffer.from('tést €', 'utf8');
// Test Transcoding

View File

@ -1,11 +1,11 @@
'use strict';
const common = require('../common');
const assert = require('assert');
if (!common.hasIntl || Intl.v8BreakIterator === undefined) {
return common.skip('no Intl');
return common.skip('missing Intl');
}
const assert = require('assert');
const warning = 'Intl.v8BreakIterator is deprecated and will be removed soon.';
common.expectWarning('DeprecationWarning', warning);

View File

@ -4,7 +4,7 @@ const common = require('../common');
if (!common.hasIntl) {
// A handful of the tests fail when ICU is not included.
common.skip('missing Intl... skipping test');
common.skip('missing Intl');
return;
}

View File

@ -4,7 +4,7 @@ const common = require('../common');
if (!common.hasIntl) {
// A handful of the tests fail when ICU is not included.
common.skip('missing Intl... skipping test');
common.skip('missing Intl');
return;
}