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>
v4.x
Michaël Zasso 8 years ago
committed by Myles Borins
parent
commit
2eda3c7c75
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 4
      lib/timers.js
  2. 46
      test/parallel/test-preload.js
  3. 4
      test/parallel/test-repl-domain.js

4
lib/timers.js

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

46
test/parallel/test-preload.js

@ -24,27 +24,27 @@ var fixtureC = fixture('printC.js');
var fixtureThrows = fixture('throws_error4.js');
// test preloading a single module works
child_process.exec(nodeBinary + ' '
+ preloadOption([fixtureA]) + ' '
+ fixtureB,
child_process.exec(nodeBinary + ' ' +
preloadOption([fixtureA]) + ' ' +
fixtureB,
function(err, stdout, stderr) {
if (err) throw err;
assert.strictEqual(stdout, 'A\nB\n');
});
// test preloading multiple modules works
child_process.exec(nodeBinary + ' '
+ preloadOption([fixtureA, fixtureB]) + ' '
+ fixtureC,
child_process.exec(nodeBinary + ' ' +
preloadOption([fixtureA, fixtureB]) + ' ' +
fixtureC,
function(err, stdout, stderr) {
if (err) throw err;
assert.strictEqual(stdout, 'A\nB\nC\n');
});
// test that preloading a throwing module aborts
child_process.exec(nodeBinary + ' '
+ preloadOption([fixtureA, fixtureThrows]) + ' '
+ fixtureB,
child_process.exec(nodeBinary + ' ' +
preloadOption([fixtureA, fixtureThrows]) + ' ' +
fixtureB,
function(err, stdout, stderr) {
if (err) {
assert.strictEqual(stdout, 'A\n');
@ -54,9 +54,9 @@ child_process.exec(nodeBinary + ' '
});
// test that preload can be used with --eval
child_process.exec(nodeBinary + ' '
+ preloadOption([fixtureA])
+ '-e "console.log(\'hello\');"',
child_process.exec(nodeBinary + ' ' +
preloadOption([fixtureA]) +
'-e "console.log(\'hello\');"',
function(err, stdout, stderr) {
if (err) throw err;
assert.strictEqual(stdout, 'A\nhello\n');
@ -64,18 +64,18 @@ child_process.exec(nodeBinary + ' '
// test that preload placement at other points in the cmdline
// also test that duplicated preload only gets loaded once
child_process.exec(nodeBinary + ' '
+ preloadOption([fixtureA])
+ '-e "console.log(\'hello\');" '
+ preloadOption([fixtureA, fixtureB]),
child_process.exec(nodeBinary + ' ' +
preloadOption([fixtureA]) +
'-e "console.log(\'hello\');" ' +
preloadOption([fixtureA, fixtureB]),
function(err, stdout, stderr) {
if (err) throw err;
assert.strictEqual(stdout, 'A\nB\nhello\n');
});
child_process.exec(nodeBinary + ' '
+ '--require ' + fixture('cluster-preload.js') + ' '
+ fixture('cluster-preload-test.js'),
child_process.exec(nodeBinary + ' ' +
'--require ' + fixture('cluster-preload.js') + ' ' +
fixture('cluster-preload-test.js'),
function(err, stdout, stderr) {
if (err) throw err;
assert.ok(/worker terminated with code 43/.test(stdout));
@ -83,10 +83,10 @@ child_process.exec(nodeBinary + ' '
// https://github.com/nodejs/node/issues/1691
process.chdir(common.fixturesDir);
child_process.exec(nodeBinary + ' '
+ '--expose_debug_as=v8debug '
+ '--require ' + fixture('cluster-preload.js') + ' '
+ 'cluster-preload-test.js',
child_process.exec(nodeBinary + ' ' +
'--expose_debug_as=v8debug ' +
'--require ' + fixture('cluster-preload.js') + ' ' +
'cluster-preload-test.js',
function(err, stdout, stderr) {
if (err) throw err;
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([
'require("domain").create().on("error", function() { console.log("OK") })'
+ '.run(function() { throw new Error("threw") })'
'require("domain").create().on("error", function() { console.log("OK") })' +
'.run(function() { throw new Error("threw") })'
]);

Loading…
Cancel
Save