Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix strictEqual argument order #24153

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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