Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Use common.hasIntl in tests related to ICU #10841

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep all of the require()s together where possible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mscdex If I'm not wrong, we are doing the same for crypto, where we require the additional modules only if common.hasCrypto is true.

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