Browse Source

lib,test: use consistent operator linebreak style

We have a tacit rule that for multiline statements, the operator should
be placed before the linebreak. This commit commit fixes the few
violations of this rule in the code base.
This allows us to enable the corresponding ESLint rule.

PR-URL: https://github.com/nodejs/node/pull/10178
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
v6
Michaël Zasso 8 years ago
parent
commit
4d11c2ce5c
  1. 4
      lib/timers.js
  2. 52
      test/parallel/test-preload.js
  3. 4
      test/parallel/test-repl-domain.js
  4. 4
      test/parallel/test-tls-client-mindhsize.js

4
lib/timers.js

@ -473,8 +473,8 @@ function unrefdHandle() {
// Make sure we clean up if the callback is no longer a function // Make sure we clean up if the callback is no longer a function
// even if the timer is an interval. // even if the timer is an interval.
if (!this.owner._repeat if (!this.owner._repeat ||
|| typeof this.owner._onTimeout !== 'function') { typeof this.owner._onTimeout !== 'function') {
this.owner.close(); this.owner.close();
} }
} }

52
test/parallel/test-preload.js

@ -32,27 +32,27 @@ const fixtureD = fixture('define-global.js');
const fixtureThrows = fixture('throws_error4.js'); const fixtureThrows = fixture('throws_error4.js');
// test preloading a single module works // test preloading a single module works
childProcess.exec(nodeBinary + ' ' childProcess.exec(nodeBinary + ' ' +
+ preloadOption([fixtureA]) + ' ' preloadOption([fixtureA]) + ' ' +
+ fixtureB, fixtureB,
function(err, stdout, stderr) { function(err, stdout, stderr) {
if (err) throw err; if (err) throw err;
assert.strictEqual(stdout, 'A\nB\n'); assert.strictEqual(stdout, 'A\nB\n');
}); });
// test preloading multiple modules works // test preloading multiple modules works
childProcess.exec(nodeBinary + ' ' childProcess.exec(nodeBinary + ' ' +
+ preloadOption([fixtureA, fixtureB]) + ' ' preloadOption([fixtureA, fixtureB]) + ' ' +
+ fixtureC, fixtureC,
function(err, stdout, stderr) { function(err, stdout, stderr) {
if (err) throw err; if (err) throw err;
assert.strictEqual(stdout, 'A\nB\nC\n'); assert.strictEqual(stdout, 'A\nB\nC\n');
}); });
// test that preloading a throwing module aborts // test that preloading a throwing module aborts
childProcess.exec(nodeBinary + ' ' childProcess.exec(nodeBinary + ' ' +
+ preloadOption([fixtureA, fixtureThrows]) + ' ' preloadOption([fixtureA, fixtureThrows]) + ' ' +
+ fixtureB, fixtureB,
function(err, stdout, stderr) { function(err, stdout, stderr) {
if (err) { if (err) {
assert.strictEqual(stdout, 'A\n'); assert.strictEqual(stdout, 'A\n');
@ -62,9 +62,9 @@ childProcess.exec(nodeBinary + ' '
}); });
// test that preload can be used with --eval // test that preload can be used with --eval
childProcess.exec(nodeBinary + ' ' childProcess.exec(nodeBinary + ' ' +
+ preloadOption([fixtureA]) preloadOption([fixtureA]) +
+ '-e "console.log(\'hello\');"', '-e "console.log(\'hello\');"',
function(err, stdout, stderr) { function(err, stdout, stderr) {
if (err) throw err; if (err) throw err;
assert.strictEqual(stdout, 'A\nhello\n'); assert.strictEqual(stdout, 'A\nhello\n');
@ -108,19 +108,19 @@ replProc.on('close', function(code) {
// test that preload placement at other points in the cmdline // test that preload placement at other points in the cmdline
// also test that duplicated preload only gets loaded once // also test that duplicated preload only gets loaded once
childProcess.exec(nodeBinary + ' ' childProcess.exec(nodeBinary + ' ' +
+ preloadOption([fixtureA]) preloadOption([fixtureA]) +
+ '-e "console.log(\'hello\');" ' '-e "console.log(\'hello\');" ' +
+ preloadOption([fixtureA, fixtureB]), preloadOption([fixtureA, fixtureB]),
function(err, stdout, stderr) { function(err, stdout, stderr) {
if (err) throw err; if (err) throw err;
assert.strictEqual(stdout, 'A\nB\nhello\n'); assert.strictEqual(stdout, 'A\nB\nhello\n');
}); });
// test that preload works with -i // test that preload works with -i
const interactive = childProcess.exec(nodeBinary + ' ' const interactive = childProcess.exec(nodeBinary + ' ' +
+ preloadOption([fixtureD]) preloadOption([fixtureD]) +
+ '-i', '-i',
common.mustCall(function(err, stdout, stderr) { common.mustCall(function(err, stdout, stderr) {
assert.ifError(err); assert.ifError(err);
assert.strictEqual(stdout, "> 'test'\n> "); assert.strictEqual(stdout, "> 'test'\n> ");
@ -129,9 +129,9 @@ const interactive = childProcess.exec(nodeBinary + ' '
interactive.stdin.write('a\n'); interactive.stdin.write('a\n');
interactive.stdin.write('process.exit()\n'); interactive.stdin.write('process.exit()\n');
childProcess.exec(nodeBinary + ' ' childProcess.exec(nodeBinary + ' ' +
+ '--require ' + fixture('cluster-preload.js') + ' ' '--require ' + fixture('cluster-preload.js') + ' ' +
+ fixture('cluster-preload-test.js'), fixture('cluster-preload-test.js'),
function(err, stdout, stderr) { function(err, stdout, stderr) {
if (err) throw err; if (err) throw err;
assert.ok(/worker terminated with code 43/.test(stdout)); assert.ok(/worker terminated with code 43/.test(stdout));
@ -139,10 +139,10 @@ childProcess.exec(nodeBinary + ' '
// https://github.com/nodejs/node/issues/1691 // https://github.com/nodejs/node/issues/1691
process.chdir(common.fixturesDir); process.chdir(common.fixturesDir);
childProcess.exec(nodeBinary + ' ' childProcess.exec(nodeBinary + ' ' +
+ '--expose_debug_as=v8debug ' '--expose_debug_as=v8debug ' +
+ '--require ' + fixture('cluster-preload.js') + ' ' '--require ' + fixture('cluster-preload.js') + ' ' +
+ 'cluster-preload-test.js', 'cluster-preload-test.js',
function(err, stdout, stderr) { function(err, stdout, stderr) {
if (err) throw err; if (err) throw err;
assert.ok(/worker terminated with code 43/.test(stdout)); assert.ok(/worker terminated with code 43/.test(stdout));

4
test/parallel/test-repl-domain.js

@ -18,6 +18,6 @@ putIn.write = function(data) {
}; };
putIn.run([ putIn.run([
'require("domain").create().on("error", function() { console.log("OK") })' 'require("domain").create().on("error", function() { console.log("OK") })' +
+ '.run(function() { throw new Error("threw") })' '.run(function() { throw new Error("threw") })'
]); ]);

4
test/parallel/test-tls-client-mindhsize.js

@ -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, 'DH parameter size 1024 is less' +
+ ' than 2048'); ' than 2048');
server.close(); server.close();
}); });
} }

Loading…
Cancel
Save