Browse Source

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>
v6.x
Rich Trott 9 years ago
committed by Jeremiah Senkpiel
parent
commit
4492cc3e25
  1. 6
      test/parallel/test-assert.js
  2. 5
      test/parallel/test-buffer-alloc.js
  3. 5
      test/parallel/test-buffer-bytelength.js
  4. 4
      test/parallel/test-domain-throw-error-then-throw-from-uncaught-exception-handler.js
  5. 6
      test/parallel/test-fs-write.js
  6. 12
      test/parallel/test-util-inspect.js
  7. 7
      test/parallel/test-zlib-from-concatenated-gzip.js

6
test/parallel/test-assert.js

@ -71,10 +71,8 @@ assert.throws(makeBlock(a.deepEqual, new Date(), new Date(2000, 3, 14)),
a.AssertionError,
'deepEqual(new Date(), new Date(2000, 3, 14))');
assert.throws(makeBlock(
a.notDeepEqual,
new Date(2000, 3, 14),
new Date(2000, 3, 14)),
assert.throws(
makeBlock(a.notDeepEqual, new Date(2000, 3, 14), new Date(2000, 3, 14)),
a.AssertionError,
'notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14))'
);

5
test/parallel/test-buffer-alloc.js

@ -243,8 +243,9 @@ assert.doesNotThrow(() => Buffer.alloc(1).write('', 1, 0));
{
// Length should be 12
const f = Buffer.from('привет', encoding);
assert.deepStrictEqual(f,
Buffer.from([63, 4, 64, 4, 56, 4, 50, 4, 53, 4, 66, 4]));
assert.deepStrictEqual(
f, Buffer.from([63, 4, 64, 4, 56, 4, 50, 4, 53, 4, 66, 4])
);
assert.strictEqual(f.toString(encoding), 'привет');
}

5
test/parallel/test-buffer-bytelength.js

@ -74,8 +74,9 @@ assert.strictEqual(Buffer.byteLength('ßœ∑≈', 'unkn0wn enc0ding'), 10);
assert.strictEqual(Buffer.byteLength('aGVsbG8gd29ybGQ=', 'base64'), 11);
assert.strictEqual(Buffer.byteLength('bm9kZS5qcyByb2NrcyE=', 'base64'), 14);
assert.strictEqual(Buffer.byteLength('aGkk', 'base64'), 3);
assert.strictEqual(Buffer.byteLength('bHNrZGZsa3NqZmtsc2xrZmFqc2RsZmtqcw==',
'base64'), 25);
assert.strictEqual(
Buffer.byteLength('bHNrZGZsa3NqZmtsc2xrZmFqc2RsZmtqcw==', 'base64'), 25
);
// special padding
assert.strictEqual(Buffer.byteLength('aaa=', 'base64'), 2);
assert.strictEqual(Buffer.byteLength('aaaa==', 'base64'), 3);

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

@ -56,8 +56,8 @@ function runTestWithoutAbortOnUncaughtException() {
// message must include only the message of the error thrown from the
// process' uncaughtException handler.
assert(stderr.includes(uncaughtExceptionHandlerErrMsg),
'stderr output must include proper uncaughtException handler\'s ' +
'error\'s message');
'stderr output must include proper uncaughtException ' +
'handler\'s error\'s message');
assert(!stderr.includes(domainErrMsg), 'stderr output must not ' +
'include domain\'s error\'s message');

6
test/parallel/test-fs-write.js

@ -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,
common.mustCall(function(err, fd) {
common.mustCall((err, fd) => {
if (err) throw err;
console.log('open done');
fs.write(fd, '', 0, 'utf8', function(err, written) {
fs.write(fd, '', 0, 'utf8', (err, 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');
if (err) throw err;
assert.equal(Buffer.byteLength(expected), written);

12
test/parallel/test-util-inspect.js

@ -12,8 +12,10 @@ assert.strictEqual(util.inspect(function() {}), '[Function]');
assert.strictEqual(util.inspect(undefined), 'undefined');
assert.strictEqual(util.inspect(null), 'null');
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')),
new Date('2010-02-14T12:48:40+01:00').toISOString());
assert.strictEqual(
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('\n\u0001'), "'\\n\\u0001'");
@ -138,7 +140,8 @@ for (const showHidden of [true, false]) {
const array = new constructor(new ArrayBuffer(byteLength), 0, length);
array[0] = 65;
array[1] = 97;
assert.strictEqual(util.inspect(array, true),
assert.strictEqual(
util.inspect(array, true),
`${constructor.name} [\n` +
` 65,\n` +
` 97,\n` +
@ -173,7 +176,8 @@ for (const showHidden of [true, false]) {
});
array[0] = 65;
array[1] = 97;
assert.strictEqual(util.inspect(array, true),
assert.strictEqual(
util.inspect(array, true),
`${constructor.name} [\n` +
` 65,\n` +
` 97,\n` +

7
test/parallel/test-zlib-from-concatenated-gzip.js

@ -66,8 +66,11 @@ fs.createReadStream(pmmFileGz)
})
.on('data', (data) => resultBuffers.push(data))
.on('finish', common.mustCall(() => {
assert.strictEqual(Buffer.concat(resultBuffers).toString(), 'abcdef',
`result should match original input (offset = ${offset})`);
assert.strictEqual(
Buffer.concat(resultBuffers).toString(),
'abcdef',
`result should match original input (offset = ${offset})`
);
}));
// first write: write "abc" + the first bytes of "def"

Loading…
Cancel
Save