Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 09bb491

Browse filesBrowse files
Martin KaskMylesBorins
authored andcommitted
test: fix strictEqual argument order
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>
1 parent b4c1d82 commit 09bb491
Copy full SHA for 09bb491

File tree

Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-buffer-slice.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-buffer-slice.js
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
require('../common');
2525
const assert = require('assert');
2626

27-
assert.strictEqual(0, Buffer.from('hello', 'utf8').slice(0, 0).length);
28-
assert.strictEqual(0, Buffer('hello', 'utf8').slice(0, 0).length);
27+
assert.strictEqual(Buffer.from('hello', 'utf8').slice(0, 0).length, 0);
28+
assert.strictEqual(Buffer('hello', 'utf8').slice(0, 0).length, 0);
2929

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

7474
expectedSameBufs.forEach(([buf1, buf2]) => {
75-
assert.strictEqual(0, Buffer.compare(buf1, buf2));
75+
assert.strictEqual(Buffer.compare(buf1, buf2), 0);
7676
});
7777

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

8484
{
8585
// Single argument slice
86-
assert.strictEqual('bcde',
87-
Buffer.from('abcde', 'utf8').slice(1).toString('utf8'));
86+
assert.strictEqual(Buffer.from('abcde', 'utf8').slice(1).toString('utf8'),
87+
'bcde');
8888
}
8989

9090
// slice(0,0).length === 0
91-
assert.strictEqual(0, Buffer.from('hello', 'utf8').slice(0, 0).length);
91+
assert.strictEqual(Buffer.from('hello', 'utf8').slice(0, 0).length, 0);
9292

9393
{
9494
// Regression tests for https://github.com/nodejs/node/issues/9096

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.