Skip to content

Commit aa8771f

Browse files
watildeitaloacasas
authored andcommitted
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: #10707 PR-URL: #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]>
1 parent 2641cd4 commit aa8771f

6 files changed

+18
-18
lines changed

test/parallel/test-icu-punycode.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
'use strict';
2-
32
const common = require('../common');
3+
4+
if (!common.hasIntl) {
5+
common.skip('missing Intl');
6+
return;
7+
}
8+
49
const icu = getPunycode();
510
const assert = require('assert');
611

@@ -12,11 +17,6 @@ function getPunycode() {
1217
}
1318
}
1419

15-
if (!icu) {
16-
common.skip('icu punycode tests because ICU is not present.');
17-
return;
18-
}
19-
2020
// Credit for list: http://www.i18nguy.com/markup/idna-examples.html
2121
const tests = [
2222
'افغانستا.icom.museum',

test/parallel/test-icu-stringwidth.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// Flags: --expose_internals
22
'use strict';
3-
43
const common = require('../common');
5-
const assert = require('assert');
6-
const readline = require('internal/readline');
74

8-
if (!process.binding('config').hasIntl) {
9-
common.skip('missing intl... skipping test');
5+
if (!common.hasIntl) {
6+
common.skip('missing Intl');
107
return;
118
}
129

10+
const assert = require('assert');
11+
const readline = require('internal/readline');
12+
1313
// Test column width
1414
assert.strictEqual(readline.getStringWidth('a'), 1);
1515
assert.strictEqual(readline.getStringWidth('丁'), 2);

test/parallel/test-icu-transcode.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict';
22

33
const common = require('../common');
4-
const buffer = require('buffer');
5-
const assert = require('assert');
64

75
if (!common.hasIntl) {
8-
common.skip('icu punycode tests because ICU is not present.');
6+
common.skip('missing Intl');
97
return;
108
}
119

10+
const buffer = require('buffer');
11+
const assert = require('assert');
1212
const orig = Buffer.from('tést €', 'utf8');
1313

1414
// Test Transcoding

test/parallel/test-intl-v8BreakIterator.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
'use strict';
22
const common = require('../common');
3-
const assert = require('assert');
43

54
if (!common.hasIntl || Intl.v8BreakIterator === undefined) {
6-
return common.skip('no Intl');
5+
return common.skip('missing Intl');
76
}
87

8+
const assert = require('assert');
99
const warning = 'Intl.v8BreakIterator is deprecated and will be removed soon.';
1010
common.expectWarning('DeprecationWarning', warning);
1111

test/parallel/test-whatwg-url-parsing.js

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

55
if (!common.hasIntl) {
66
// A handful of the tests fail when ICU is not included.
7-
common.skip('missing Intl... skipping test');
7+
common.skip('missing Intl');
88
return;
99
}
1010

test/parallel/test-whatwg-url-setters.js

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

55
if (!common.hasIntl) {
66
// A handful of the tests fail when ICU is not included.
7-
common.skip('missing Intl... skipping test');
7+
common.skip('missing Intl');
88
return;
99
}
1010

0 commit comments

Comments
 (0)