Skip to content

Commit 4492cc3

Browse files
TrottFishrock123
authored andcommitted
test,lib: align arguments in multiline calls
An upcoming custom lint rule will provide slightly more strict enforcement of argument alignment for multiline function calls. Adjust existing code to conform. PR-URL: #8642 Reviewed-By: Teddy Katz <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ilkka Myller <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
1 parent 38be155 commit 4492cc3

15 files changed

+139
-132
lines changed

lib/repl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ REPLServer.prototype.createContext = function() {
696696
return GLOBAL_OBJECT_PROPERTY_MAP[name] === undefined;
697697
}).forEach((name) => {
698698
Object.defineProperty(context, name,
699-
Object.getOwnPropertyDescriptor(global, name));
699+
Object.getOwnPropertyDescriptor(global, name));
700700
});
701701
}
702702

test/parallel/test-assert.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ assert.doesNotThrow(makeBlock(a.ok, true),
2828
assert.doesNotThrow(makeBlock(a.ok, 'test'), 'ok(\'test\')');
2929

3030
assert.throws(makeBlock(a.equal, true, false),
31-
a.AssertionError, 'equal(true, false)');
31+
a.AssertionError, 'equal(true, false)');
3232

3333
assert.doesNotThrow(makeBlock(a.equal, null, null),
3434
'equal(null, null)');
@@ -71,10 +71,8 @@ assert.throws(makeBlock(a.deepEqual, new Date(), new Date(2000, 3, 14)),
7171
a.AssertionError,
7272
'deepEqual(new Date(), new Date(2000, 3, 14))');
7373

74-
assert.throws(makeBlock(
75-
a.notDeepEqual,
76-
new Date(2000, 3, 14),
77-
new Date(2000, 3, 14)),
74+
assert.throws(
75+
makeBlock(a.notDeepEqual, new Date(2000, 3, 14), new Date(2000, 3, 14)),
7876
a.AssertionError,
7977
'notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14))'
8078
);
@@ -465,7 +463,7 @@ function testAssertionMessage(actual, expected) {
465463
assert.equal(actual, '');
466464
} catch (e) {
467465
assert.equal(e.toString(),
468-
['AssertionError:', expected, '==', '\'\''].join(' '));
466+
['AssertionError:', expected, '==', '\'\''].join(' '));
469467
assert.ok(e.generatedMessage, 'Message not marked as generated');
470468
}
471469
}

test/parallel/test-buffer-alloc.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,9 @@ assert.doesNotThrow(() => Buffer.alloc(1).write('', 1, 0));
243243
{
244244
// Length should be 12
245245
const f = Buffer.from('привет', encoding);
246-
assert.deepStrictEqual(f,
247-
Buffer.from([63, 4, 64, 4, 56, 4, 50, 4, 53, 4, 66, 4]));
246+
assert.deepStrictEqual(
247+
f, Buffer.from([63, 4, 64, 4, 56, 4, 50, 4, 53, 4, 66, 4])
248+
);
248249
assert.strictEqual(f.toString(encoding), 'привет');
249250
}
250251

test/parallel/test-buffer-bytelength.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ assert.strictEqual(Buffer.byteLength('ßœ∑≈', 'unkn0wn enc0ding'), 10);
7474
assert.strictEqual(Buffer.byteLength('aGVsbG8gd29ybGQ=', 'base64'), 11);
7575
assert.strictEqual(Buffer.byteLength('bm9kZS5qcyByb2NrcyE=', 'base64'), 14);
7676
assert.strictEqual(Buffer.byteLength('aGkk', 'base64'), 3);
77-
assert.strictEqual(Buffer.byteLength('bHNrZGZsa3NqZmtsc2xrZmFqc2RsZmtqcw==',
78-
'base64'), 25);
77+
assert.strictEqual(
78+
Buffer.byteLength('bHNrZGZsa3NqZmtsc2xrZmFqc2RsZmtqcw==', 'base64'), 25
79+
);
7980
// special padding
8081
assert.strictEqual(Buffer.byteLength('aaa=', 'base64'), 2);
8182
assert.strictEqual(Buffer.byteLength('aaaa==', 'base64'), 3);

test/parallel/test-buffer-inheritance.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ vals.forEach(function(t) {
2626
assert.strictEqual(t.constructor, T);
2727
assert.strictEqual(Object.getPrototypeOf(t), T.prototype);
2828
assert.strictEqual(Object.getPrototypeOf(Object.getPrototypeOf(t)),
29-
Buffer.prototype);
29+
Buffer.prototype);
3030

3131
t.fill(5);
3232
let cntr = 0;

test/parallel/test-debugger-util-regression.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ proc.stdin.on('error', (err) => {
6262
process.on('exit', (code) => {
6363
assert.equal(code, 0, 'the program should exit cleanly');
6464
assert.equal(stdout.includes('{ a: \'b\' }'), true,
65-
'the debugger should print the result of util.inspect');
65+
'the debugger should print the result of util.inspect');
6666
assert.equal(stderr, '', 'stderr should be empty');
6767
});

test/parallel/test-domain-throw-error-then-throw-from-uncaught-exception-handler.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ function runTestWithoutAbortOnUncaughtException() {
5656
// message must include only the message of the error thrown from the
5757
// process' uncaughtException handler.
5858
assert(stderr.includes(uncaughtExceptionHandlerErrMsg),
59-
'stderr output must include proper uncaughtException handler\'s ' +
60-
'error\'s message');
59+
'stderr output must include proper uncaughtException ' +
60+
'handler\'s error\'s message');
6161
assert(!stderr.includes(domainErrMsg), 'stderr output must not ' +
6262
'include domain\'s error\'s message');
6363

@@ -75,7 +75,7 @@ function runTestWithAbortOnUncaughtException() {
7575
'child process should not have run its uncaughtException ' +
7676
'event handler');
7777
assert(common.nodeProcessAborted(err.code, err.signal),
78-
'process should have aborted, but did not');
78+
'process should have aborted, but did not');
7979
});
8080
}
8181

test/parallel/test-domain-with-abort-on-uncaught-exception.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ if (process.argv[2] === 'child') {
121121
if (!options.useTryCatch && options.throwInDomainErrHandler) {
122122
if (cmdLineOption === '--abort_on_uncaught_exception') {
123123
assert(common.nodeProcessAborted(exitCode, signal),
124-
'process should have aborted, but did not');
124+
'process should have aborted, but did not');
125125
} else {
126126
// By default, uncaught exceptions make node exit with an exit
127127
// code of 7.

test/parallel/test-fs-write.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,21 @@ fs.open(fn, 'w', 0o644, common.mustCall(function(err, fd) {
3232

3333

3434
fs.open(fn2, constants.O_CREAT | constants.O_WRONLY | constants.O_TRUNC, 0o644,
35-
common.mustCall(function(err, fd) {
36-
if (err) throw err;
37-
console.log('open done');
38-
fs.write(fd, '', 0, 'utf8', function(err, written) {
39-
assert.equal(0, written);
40-
});
41-
fs.write(fd, expected, 0, 'utf8', common.mustCall(function(err, written) {
42-
console.log('write done');
43-
if (err) throw err;
44-
assert.equal(Buffer.byteLength(expected), written);
45-
fs.closeSync(fd);
46-
const found = fs.readFileSync(fn2, 'utf8');
47-
console.log('expected: "%s"', expected);
48-
console.log('found: "%s"', found);
49-
fs.unlinkSync(fn2);
50-
assert.strictEqual(expected, found);
51-
}));
52-
}));
35+
common.mustCall((err, fd) => {
36+
if (err) throw err;
37+
console.log('open done');
38+
fs.write(fd, '', 0, 'utf8', (err, written) => {
39+
assert.equal(0, written);
40+
});
41+
fs.write(fd, expected, 0, 'utf8', common.mustCall((err, written) => {
42+
console.log('write done');
43+
if (err) throw err;
44+
assert.equal(Buffer.byteLength(expected), written);
45+
fs.closeSync(fd);
46+
const found = fs.readFileSync(fn2, 'utf8');
47+
console.log('expected: "%s"', expected);
48+
console.log('found: "%s"', found);
49+
fs.unlinkSync(fn2);
50+
assert.strictEqual(expected, found);
51+
}));
52+
}));

test/parallel/test-http-invalidheaderfield2.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ const checkInvalidHeaderChar = require('_http_common')._checkInvalidHeaderChar;
9090
'Ding!\x07'
9191
].forEach(function(str) {
9292
assert.strictEqual(checkInvalidHeaderChar(str),
93-
true,
94-
'checkInvalidHeaderChar(' +
95-
inspect(str) +
96-
') unexpectedly succeeded');
93+
true,
94+
'checkInvalidHeaderChar(' +
95+
inspect(str) +
96+
') unexpectedly succeeded');
9797
});

0 commit comments

Comments
 (0)