test: remove unneeded string splitting

PR-URL: https://github.com/nodejs/node/pull/12992
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Luca Maraschi <luca.maraschi@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
This commit is contained in:
Vse Mozhet Byt 2017-05-12 03:09:13 +03:00 committed by Anna Henningsen
parent 32f01c8c11
commit 88d2e699d8
No known key found for this signature in database
GPG Key ID: D8B9F5AEAE84E4CF
22 changed files with 57 additions and 63 deletions

View File

@ -30,8 +30,7 @@ const dgram = require('dgram');
if (common.isWindows) { if (common.isWindows) {
common.skip('dgram clustering is currently not supported ' + common.skip('dgram clustering is currently not supported on Windows.');
'on windows.');
return; return;
} }

View File

@ -30,8 +30,7 @@ const assert = require('assert');
if (common.isWindows) { if (common.isWindows) {
common.skip('dgram clustering is currently not supported ' + common.skip('dgram clustering is currently not supported on Windows.');
'on windows.');
return; return;
} }

View File

@ -5,8 +5,7 @@ const cluster = require('cluster');
const dgram = require('dgram'); const dgram = require('dgram');
if (common.isWindows) { if (common.isWindows) {
common.skip('dgram clustering is currently not supported ' + common.skip('dgram clustering is currently not supported on windows.');
'on windows.');
return; return;
} }

View File

@ -57,8 +57,9 @@ if (cluster.isWorker) {
process.once('exit', function() { process.once('exit', function() {
assert.ok(checks.using, 'The worker did not receive the correct env.'); assert.ok(checks.using, 'The worker did not receive the correct env.');
assert.ok(checks.overwrite, 'The custom environment did not overwrite ' + assert.ok(
'the existing environment.'); checks.overwrite,
'The custom environment did not overwrite the existing environment.');
}); });
} }

View File

@ -27,8 +27,8 @@ const cluster = require('cluster');
const http = require('http'); const http = require('http');
if (common.isWindows) { if (common.isWindows) {
common.skip('It is not possible to send pipe handles over ' + common.skip(
'the IPC pipe on Windows'); 'It is not possible to send pipe handles over the IPC pipe on Windows');
return; return;
} }

View File

@ -5,14 +5,13 @@ const assert = require('assert');
if (cluster.isMaster) { if (cluster.isMaster) {
const worker = cluster.fork(); const worker = cluster.fork();
assert.ok(!worker.isDead(), assert.ok(
'isDead() should return false right after the worker has been ' + !worker.isDead(),
'created.'); 'isDead() should return false right after the worker has been created.');
worker.on('exit', function() { worker.on('exit', function() {
assert.ok(worker.isDead(), assert.ok(worker.isDead(),
'After an event has been emitted, ' + 'After an event has been emitted, isDead should return true');
'isDead should return true');
}); });
worker.on('message', function(msg) { worker.on('message', function(msg) {

View File

@ -66,8 +66,7 @@ const EVEN_LENGTH_ENCRYPTED =
// openssl enc -aes-128-cbc -e -K 5333632e722e652e742e4b2e652e5921 \ // openssl enc -aes-128-cbc -e -K 5333632e722e652e742e4b2e652e5921 \
// -iv 626c616846697a7a3230313142757a7a -nopad | xxd -p -c256 // -iv 626c616846697a7a3230313142757a7a -nopad | xxd -p -c256
const EVEN_LENGTH_ENCRYPTED_NOPAD = const EVEN_LENGTH_ENCRYPTED_NOPAD =
'7f57859550d4d2fdb9806da2a750461ab46e' + '7f57859550d4d2fdb9806da2a750461ab46e71b3d78ebe2d9684dfc87f7575b9';
'71b3d78ebe2d9684dfc87f7575b9';
/* /*

View File

@ -7,9 +7,9 @@ const assert = require('assert');
const d = domain.create(); const d = domain.create();
process.on('uncaughtException', common.mustCall(function onUncaught() { process.on('uncaughtException', common.mustCall(function onUncaught() {
assert.strictEqual(process.domain, null, assert.strictEqual(
'domains stack should be empty in uncaughtException' + process.domain, null,
' handler'); 'domains stack should be empty in uncaughtException handler');
})); }));
process.on('beforeExit', common.mustCall(function onBeforeExit() { process.on('beforeExit', common.mustCall(function onBeforeExit() {

View File

@ -31,8 +31,8 @@ let sent_continue = false;
let got_continue = false; let got_continue = false;
function handler(req, res) { function handler(req, res) {
assert.strictEqual(sent_continue, true, 'Full response sent before ' + assert.strictEqual(sent_continue, true,
'100 Continue'); 'Full response sent before 100 Continue');
console.error('Server sending full response...'); console.error('Server sending full response...');
res.writeHead(200, { res.writeHead(200, {
'Content-Type': 'text/plain', 'Content-Type': 'text/plain',

View File

@ -39,8 +39,8 @@ const server = http.createServer(function(request, response) {
}); });
server.listen(0, function() { server.listen(0, function() {
const testURL = url.parse('http://asdf:qwer@localhost:' + const testURL =
`${this.address().port}`); url.parse(`http://asdf:qwer@localhost:${this.address().port}`);
// the test here is if you set a specific authorization header in the // the test here is if you set a specific authorization header in the
// request we should not override that with basic auth // request we should not override that with basic auth
testURL.headers = { testURL.headers = {

View File

@ -30,8 +30,8 @@ assert.throws(function() {
http.request(url.parse('file:///whatever')); http.request(url.parse('file:///whatever'));
}, function(err) { }, function(err) {
if (err instanceof Error) { if (err instanceof Error) {
assert.strictEqual(err.message, 'Protocol "file:" not supported.' + assert.strictEqual(
' Expected "http:"'); err.message, 'Protocol "file:" not supported. Expected "http:"');
return true; return true;
} }
}); });
@ -40,8 +40,8 @@ assert.throws(function() {
http.request(url.parse('mailto:asdf@asdf.com')); http.request(url.parse('mailto:asdf@asdf.com'));
}, function(err) { }, function(err) {
if (err instanceof Error) { if (err instanceof Error) {
assert.strictEqual(err.message, 'Protocol "mailto:" not supported.' + assert.strictEqual(
' Expected "http:"'); err.message, 'Protocol "mailto:" not supported. Expected "http:"');
return true; return true;
} }
}); });
@ -50,8 +50,8 @@ assert.throws(function() {
http.request(url.parse('ftp://www.example.com')); http.request(url.parse('ftp://www.example.com'));
}, function(err) { }, function(err) {
if (err instanceof Error) { if (err instanceof Error) {
assert.strictEqual(err.message, 'Protocol "ftp:" not supported.' + assert.strictEqual(
' Expected "http:"'); err.message, 'Protocol "ftp:" not supported. Expected "http:"');
return true; return true;
} }
}); });
@ -60,8 +60,8 @@ assert.throws(function() {
http.request(url.parse('javascript:alert(\'hello\');')); http.request(url.parse('javascript:alert(\'hello\');'));
}, function(err) { }, function(err) {
if (err instanceof Error) { if (err instanceof Error) {
assert.strictEqual(err.message, 'Protocol "javascript:" not supported.' + assert.strictEqual(
' Expected "http:"'); err.message, 'Protocol "javascript:" not supported. Expected "http:"');
return true; return true;
} }
}); });
@ -70,8 +70,8 @@ assert.throws(function() {
http.request(url.parse('xmpp:isaacschlueter@jabber.org')); http.request(url.parse('xmpp:isaacschlueter@jabber.org'));
}, function(err) { }, function(err) {
if (err instanceof Error) { if (err instanceof Error) {
assert.strictEqual(err.message, 'Protocol "xmpp:" not supported.' + assert.strictEqual(
' Expected "http:"'); err.message, 'Protocol "xmpp:" not supported. Expected "http:"');
return true; return true;
} }
}); });
@ -80,8 +80,8 @@ assert.throws(function() {
http.request(url.parse('f://some.host/path')); http.request(url.parse('f://some.host/path'));
}, function(err) { }, function(err) {
if (err instanceof Error) { if (err instanceof Error) {
assert.strictEqual(err.message, 'Protocol "f:" not supported.' + assert.strictEqual(
' Expected "http:"'); err.message, 'Protocol "f:" not supported. Expected "http:"');
return true; return true;
} }
}); });

View File

@ -72,8 +72,8 @@ if (!common.hasIntl) {
// If list is specified and doesn't contain 'en' then return. // If list is specified and doesn't contain 'en' then return.
if (process.config.variables.icu_locales && !haveLocale('en')) { if (process.config.variables.icu_locales && !haveLocale('en')) {
common.skip('detailed Intl tests because English is not ' + common.skip(
'listed as supported.'); 'detailed Intl tests because English is not listed as supported.');
// Smoke test. Does it format anything, or fail? // Smoke test. Does it format anything, or fail?
console.log(`Date(0) formatted to: ${dtf.format(date0)}`); console.log(`Date(0) formatted to: ${dtf.format(date0)}`);
return; return;

View File

@ -7,8 +7,8 @@ if (!common.hasCrypto) {
} }
if (!process.features.tls_alpn || !process.features.tls_npn) { if (!process.features.tls_alpn || !process.features.tls_npn) {
common.skip('Skipping because node compiled without NPN or ALPN' + common.skip(
' feature of OpenSSL.'); 'Skipping because node compiled without NPN or ALPN feature of OpenSSL.');
return; return;
} }

View File

@ -53,8 +53,8 @@ function test(size, err, next) {
if (err) { if (err) {
client.on('error', function(e) { client.on('error', function(e) {
nerror++; nerror++;
assert.strictEqual(e.message, 'DH parameter size 1024 is less' + assert.strictEqual(e.message,
' than 2048'); 'DH parameter size 1024 is less than 2048');
server.close(); server.close();
}); });
} }

View File

@ -22,8 +22,7 @@
'use strict'; 'use strict';
const common = require('../common'); const common = require('../common');
if (!process.features.tls_npn) { if (!process.features.tls_npn) {
common.skip('Skipping because node compiled without NPN feature of' + common.skip('Skipping because node compiled without NPN feature of OpenSSL.');
' OpenSSL.');
return; return;
} }

View File

@ -23,8 +23,7 @@
const common = require('../common'); const common = require('../common');
if (!process.features.tls_ocsp) { if (!process.features.tls_ocsp) {
common.skip('node compiled without OpenSSL or ' + common.skip('node compiled without OpenSSL or with old OpenSSL version.');
'with old OpenSSL version.');
return; return;
} }
if (!common.opensslCli) { if (!common.opensslCli) {

View File

@ -22,8 +22,7 @@
'use strict'; 'use strict';
const common = require('../common'); const common = require('../common');
if (!process.features.tls_sni) { if (!process.features.tls_sni) {
common.skip('node compiled without OpenSSL or ' + common.skip('node compiled without OpenSSL or with old OpenSSL version.');
'with old OpenSSL version.');
return; return;
} }

View File

@ -22,8 +22,7 @@
'use strict'; 'use strict';
const common = require('../common'); const common = require('../common');
if (!process.features.tls_sni) { if (!process.features.tls_sni) {
common.skip('node compiled without OpenSSL or ' + common.skip('node compiled without OpenSSL or with old OpenSSL version.');
'with old OpenSSL version.');
return; return;
} }

View File

@ -14,8 +14,8 @@ const throwsObjsAndReportTypes = new Map([
]); ]);
for (const [obj, type] of throwsObjsAndReportTypes) { for (const [obj, type] of throwsObjsAndReportTypes) {
const error = new RegExp('^TypeError: Parameter "urlObj" must be an object' + const error = new RegExp(
`, not ${type}$`); `^TypeError: Parameter "urlObj" must be an object, not ${type}$`);
assert.throws(function() { url.format(obj); }, error); assert.throws(function() { url.format(obj); }, error);
} }
assert.strictEqual(url.format(''), ''); assert.strictEqual(url.format(''), '');

View File

@ -37,12 +37,14 @@ deflater.on('drain', function() {
}); });
process.once('exit', function() { process.once('exit', function() {
assert.strictEqual(beforeFlush, true, 'before calling flush, writable ' + assert.strictEqual(
'stream should need to drain'); beforeFlush, true,
assert.strictEqual(afterFlush, false, 'after calling flush, writable ' + 'before calling flush, writable stream should need to drain');
'stream should not need to drain'); assert.strictEqual(
assert.strictEqual(drainCount, 1, afterFlush, false,
'the deflater should have emitted a single drain event'); 'after calling flush, writable stream should not need to drain');
assert.strictEqual(flushCount, 2, assert.strictEqual(
'flush should be called twice'); drainCount, 1, 'the deflater should have emitted a single drain event');
assert.strictEqual(
flushCount, 2, 'flush should be called twice');
}); });

View File

@ -40,8 +40,8 @@ const echo_server = net.createServer(function(socket) {
}); });
socket.on('error', function(e) { socket.on('error', function(e) {
throw new Error('Server side socket should not get error. ' + throw new Error(
'We disconnect willingly.'); 'Server side socket should not get error. We disconnect willingly.');
}); });
socket.on('data', function(d) { socket.on('data', function(d) {