Skip to content

Commit

Permalink
test: fix strictEqual argument order
Browse files Browse the repository at this point in the history
Fix the order of assert.strictEqual() arguments.
It should have first argument as the calculated/tested value.

PR-URL: #24153
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
KaskMartin authored and MylesBorins committed Dec 26, 2018
1 parent b4c1d82 commit 09bb491
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/parallel/test-buffer-slice.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
require('../common');
const assert = require('assert');

assert.strictEqual(0, Buffer.from('hello', 'utf8').slice(0, 0).length);
assert.strictEqual(0, Buffer('hello', 'utf8').slice(0, 0).length);
assert.strictEqual(Buffer.from('hello', 'utf8').slice(0, 0).length, 0);
assert.strictEqual(Buffer('hello', 'utf8').slice(0, 0).length, 0);

const buf = Buffer.from('0123456789', 'utf8');
const expectedSameBufs = [
Expand Down Expand Up @@ -72,7 +72,7 @@ for (let i = 0, s = buf.toString(); i < buf.length; ++i) {
}

expectedSameBufs.forEach(([buf1, buf2]) => {
assert.strictEqual(0, Buffer.compare(buf1, buf2));
assert.strictEqual(Buffer.compare(buf1, buf2), 0);
});

const utf16Buf = Buffer.from('0123456789', 'utf16le');
Expand All @@ -83,12 +83,12 @@ assert.strictEqual(Buffer.alloc(0).slice(0, 1).length, 0);

{
// Single argument slice
assert.strictEqual('bcde',
Buffer.from('abcde', 'utf8').slice(1).toString('utf8'));
assert.strictEqual(Buffer.from('abcde', 'utf8').slice(1).toString('utf8'),
'bcde');
}

// slice(0,0).length === 0
assert.strictEqual(0, Buffer.from('hello', 'utf8').slice(0, 0).length);
assert.strictEqual(Buffer.from('hello', 'utf8').slice(0, 0).length, 0);

{
// Regression tests for https://github.com/nodejs/node/issues/9096
Expand Down

0 comments on commit 09bb491

Please sign in to comment.