Skip to content

Commit

Permalink
test: use common.hasIntl in tests related to ICU
Browse files Browse the repository at this point in the history
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: nodejs#10707
PR-URL: nodejs#10841
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
watilde authored and italoacasas committed Jan 27, 2017
1 parent 2641cd4 commit aa8771f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions test/parallel/test-icu-punycode.js
Original file line number Diff line number Diff line change
@@ -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');

Expand All @@ -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',
Expand Down
10 changes: 5 additions & 5 deletions test/parallel/test-icu-stringwidth.js
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-icu-transcode.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-intl-v8BreakIterator.js
Original file line number Diff line number Diff line change
@@ -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);

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-whatwg-url-parsing.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-whatwg-url-setters.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit aa8771f

Please sign in to comment.