Browse Source

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>
v7.x
Daijiro Wachi 8 years ago
committed by Italo A. Casas
parent
commit
aa8771f842
  1. 12
      test/parallel/test-icu-punycode.js
  2. 10
      test/parallel/test-icu-stringwidth.js
  3. 6
      test/parallel/test-icu-transcode.js
  4. 4
      test/parallel/test-intl-v8BreakIterator.js
  5. 2
      test/parallel/test-whatwg-url-parsing.js
  6. 2
      test/parallel/test-whatwg-url-setters.js

12
test/parallel/test-icu-punycode.js

@ -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',

10
test/parallel/test-icu-stringwidth.js

@ -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);

6
test/parallel/test-icu-transcode.js

@ -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

4
test/parallel/test-intl-v8BreakIterator.js

@ -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);

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

@ -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;
}

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

@ -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;
}

Loading…
Cancel
Save