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: https://github.com/nodejs/node/pull/8642 Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
This commit is contained in:
parent
bc1ebd67d8
commit
4316f4df31
@ -71,10 +71,8 @@ assert.throws(makeBlock(a.deepEqual, new Date(), new Date(2000, 3, 14)),
|
|||||||
a.AssertionError,
|
a.AssertionError,
|
||||||
'deepEqual(new Date(), new Date(2000, 3, 14))');
|
'deepEqual(new Date(), new Date(2000, 3, 14))');
|
||||||
|
|
||||||
assert.throws(makeBlock(
|
assert.throws(
|
||||||
a.notDeepEqual,
|
makeBlock(a.notDeepEqual, new Date(2000, 3, 14), new Date(2000, 3, 14)),
|
||||||
new Date(2000, 3, 14),
|
|
||||||
new Date(2000, 3, 14)),
|
|
||||||
a.AssertionError,
|
a.AssertionError,
|
||||||
'notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14))'
|
'notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14))'
|
||||||
);
|
);
|
||||||
|
@ -243,8 +243,9 @@ assert.doesNotThrow(() => Buffer.alloc(1).write('', 1, 0));
|
|||||||
{
|
{
|
||||||
// Length should be 12
|
// Length should be 12
|
||||||
const f = Buffer.from('привет', encoding);
|
const f = Buffer.from('привет', encoding);
|
||||||
assert.deepStrictEqual(f,
|
assert.deepStrictEqual(
|
||||||
Buffer.from([63, 4, 64, 4, 56, 4, 50, 4, 53, 4, 66, 4]));
|
f, Buffer.from([63, 4, 64, 4, 56, 4, 50, 4, 53, 4, 66, 4])
|
||||||
|
);
|
||||||
assert.strictEqual(f.toString(encoding), 'привет');
|
assert.strictEqual(f.toString(encoding), 'привет');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,8 +74,9 @@ assert.strictEqual(Buffer.byteLength('ßœ∑≈', 'unkn0wn enc0ding'), 10);
|
|||||||
assert.strictEqual(Buffer.byteLength('aGVsbG8gd29ybGQ=', 'base64'), 11);
|
assert.strictEqual(Buffer.byteLength('aGVsbG8gd29ybGQ=', 'base64'), 11);
|
||||||
assert.strictEqual(Buffer.byteLength('bm9kZS5qcyByb2NrcyE=', 'base64'), 14);
|
assert.strictEqual(Buffer.byteLength('bm9kZS5qcyByb2NrcyE=', 'base64'), 14);
|
||||||
assert.strictEqual(Buffer.byteLength('aGkk', 'base64'), 3);
|
assert.strictEqual(Buffer.byteLength('aGkk', 'base64'), 3);
|
||||||
assert.strictEqual(Buffer.byteLength('bHNrZGZsa3NqZmtsc2xrZmFqc2RsZmtqcw==',
|
assert.strictEqual(
|
||||||
'base64'), 25);
|
Buffer.byteLength('bHNrZGZsa3NqZmtsc2xrZmFqc2RsZmtqcw==', 'base64'), 25
|
||||||
|
);
|
||||||
// special padding
|
// special padding
|
||||||
assert.strictEqual(Buffer.byteLength('aaa=', 'base64'), 2);
|
assert.strictEqual(Buffer.byteLength('aaa=', 'base64'), 2);
|
||||||
assert.strictEqual(Buffer.byteLength('aaaa==', 'base64'), 3);
|
assert.strictEqual(Buffer.byteLength('aaaa==', 'base64'), 3);
|
||||||
|
@ -56,8 +56,8 @@ function runTestWithoutAbortOnUncaughtException() {
|
|||||||
// message must include only the message of the error thrown from the
|
// message must include only the message of the error thrown from the
|
||||||
// process' uncaughtException handler.
|
// process' uncaughtException handler.
|
||||||
assert(stderr.includes(uncaughtExceptionHandlerErrMsg),
|
assert(stderr.includes(uncaughtExceptionHandlerErrMsg),
|
||||||
'stderr output must include proper uncaughtException handler\'s ' +
|
'stderr output must include proper uncaughtException ' +
|
||||||
'error\'s message');
|
'handler\'s error\'s message');
|
||||||
assert(!stderr.includes(domainErrMsg), 'stderr output must not ' +
|
assert(!stderr.includes(domainErrMsg), 'stderr output must not ' +
|
||||||
'include domain\'s error\'s message');
|
'include domain\'s error\'s message');
|
||||||
|
|
||||||
|
@ -32,13 +32,13 @@ fs.open(fn, 'w', 0o644, common.mustCall(function(err, fd) {
|
|||||||
|
|
||||||
|
|
||||||
fs.open(fn2, constants.O_CREAT | constants.O_WRONLY | constants.O_TRUNC, 0o644,
|
fs.open(fn2, constants.O_CREAT | constants.O_WRONLY | constants.O_TRUNC, 0o644,
|
||||||
common.mustCall(function(err, fd) {
|
common.mustCall((err, fd) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
console.log('open done');
|
console.log('open done');
|
||||||
fs.write(fd, '', 0, 'utf8', function(err, written) {
|
fs.write(fd, '', 0, 'utf8', (err, written) => {
|
||||||
assert.equal(0, written);
|
assert.equal(0, written);
|
||||||
});
|
});
|
||||||
fs.write(fd, expected, 0, 'utf8', common.mustCall(function(err, written) {
|
fs.write(fd, expected, 0, 'utf8', common.mustCall((err, written) => {
|
||||||
console.log('write done');
|
console.log('write done');
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
assert.equal(Buffer.byteLength(expected), written);
|
assert.equal(Buffer.byteLength(expected), written);
|
||||||
|
@ -12,8 +12,10 @@ assert.strictEqual(util.inspect(function() {}), '[Function]');
|
|||||||
assert.strictEqual(util.inspect(undefined), 'undefined');
|
assert.strictEqual(util.inspect(undefined), 'undefined');
|
||||||
assert.strictEqual(util.inspect(null), 'null');
|
assert.strictEqual(util.inspect(null), 'null');
|
||||||
assert.strictEqual(util.inspect(/foo(bar\n)?/gi), '/foo(bar\\n)?/gi');
|
assert.strictEqual(util.inspect(/foo(bar\n)?/gi), '/foo(bar\\n)?/gi');
|
||||||
assert.strictEqual(util.inspect(new Date('Sun, 14 Feb 2010 11:48:40 GMT')),
|
assert.strictEqual(
|
||||||
new Date('2010-02-14T12:48:40+01:00').toISOString());
|
util.inspect(new Date('Sun, 14 Feb 2010 11:48:40 GMT')),
|
||||||
|
new Date('2010-02-14T12:48:40+01:00').toISOString()
|
||||||
|
);
|
||||||
assert.strictEqual(util.inspect(new Date('')), (new Date('')).toString());
|
assert.strictEqual(util.inspect(new Date('')), (new Date('')).toString());
|
||||||
|
|
||||||
assert.strictEqual(util.inspect('\n\u0001'), "'\\n\\u0001'");
|
assert.strictEqual(util.inspect('\n\u0001'), "'\\n\\u0001'");
|
||||||
@ -138,7 +140,8 @@ for (const showHidden of [true, false]) {
|
|||||||
const array = new constructor(new ArrayBuffer(byteLength), 0, length);
|
const array = new constructor(new ArrayBuffer(byteLength), 0, length);
|
||||||
array[0] = 65;
|
array[0] = 65;
|
||||||
array[1] = 97;
|
array[1] = 97;
|
||||||
assert.strictEqual(util.inspect(array, true),
|
assert.strictEqual(
|
||||||
|
util.inspect(array, true),
|
||||||
`${constructor.name} [\n` +
|
`${constructor.name} [\n` +
|
||||||
` 65,\n` +
|
` 65,\n` +
|
||||||
` 97,\n` +
|
` 97,\n` +
|
||||||
@ -173,7 +176,8 @@ for (const showHidden of [true, false]) {
|
|||||||
});
|
});
|
||||||
array[0] = 65;
|
array[0] = 65;
|
||||||
array[1] = 97;
|
array[1] = 97;
|
||||||
assert.strictEqual(util.inspect(array, true),
|
assert.strictEqual(
|
||||||
|
util.inspect(array, true),
|
||||||
`${constructor.name} [\n` +
|
`${constructor.name} [\n` +
|
||||||
` 65,\n` +
|
` 65,\n` +
|
||||||
` 97,\n` +
|
` 97,\n` +
|
||||||
|
@ -66,8 +66,11 @@ fs.createReadStream(pmmFileGz)
|
|||||||
})
|
})
|
||||||
.on('data', (data) => resultBuffers.push(data))
|
.on('data', (data) => resultBuffers.push(data))
|
||||||
.on('finish', common.mustCall(() => {
|
.on('finish', common.mustCall(() => {
|
||||||
assert.strictEqual(Buffer.concat(resultBuffers).toString(), 'abcdef',
|
assert.strictEqual(
|
||||||
`result should match original input (offset = ${offset})`);
|
Buffer.concat(resultBuffers).toString(),
|
||||||
|
'abcdef',
|
||||||
|
`result should match original input (offset = ${offset})`
|
||||||
|
);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// first write: write "abc" + the first bytes of "def"
|
// first write: write "abc" + the first bytes of "def"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user