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 a6787a7

Browse filesBrowse files
yitongdingMylesBorins
authored andcommitted
test: swap actual and expected in assertions
'test/parallel/test-fs-write.js' contains assertions where the first argument provided is the expected value and the second value is the actual value. This is backward from the documentation for assertions like 'assert.strictEqual()' where the first value should be the actual value being tested and the second value is the expected value. PR-URL: #23474 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com>
1 parent 148d4e4 commit a6787a7
Copy full SHA for a6787a7

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

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

Copy file name to clipboardExpand all lines: test/parallel/test-fs-write.js
+15-15Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,41 +41,41 @@ common.allowGlobals(externalizeString, isOneByteString, x);
4141
{
4242
const expected = 'ümlaut eins'; // Must be a unique string.
4343
externalizeString(expected);
44-
assert.strictEqual(true, isOneByteString(expected));
44+
assert.strictEqual(isOneByteString(expected), true);
4545
const fd = fs.openSync(fn, 'w');
4646
fs.writeSync(fd, expected, 0, 'latin1');
4747
fs.closeSync(fd);
48-
assert.strictEqual(expected, fs.readFileSync(fn, 'latin1'));
48+
assert.strictEqual(fs.readFileSync(fn, 'latin1'), expected);
4949
}
5050

5151
{
5252
const expected = 'ümlaut zwei'; // Must be a unique string.
5353
externalizeString(expected);
54-
assert.strictEqual(true, isOneByteString(expected));
54+
assert.strictEqual(isOneByteString(expected), true);
5555
const fd = fs.openSync(fn, 'w');
5656
fs.writeSync(fd, expected, 0, 'utf8');
5757
fs.closeSync(fd);
58-
assert.strictEqual(expected, fs.readFileSync(fn, 'utf8'));
58+
assert.strictEqual(fs.readFileSync(fn, 'utf8'), expected);
5959
}
6060

6161
{
6262
const expected = '中文 1'; // Must be a unique string.
6363
externalizeString(expected);
64-
assert.strictEqual(false, isOneByteString(expected));
64+
assert.strictEqual(isOneByteString(expected), false);
6565
const fd = fs.openSync(fn, 'w');
6666
fs.writeSync(fd, expected, 0, 'ucs2');
6767
fs.closeSync(fd);
68-
assert.strictEqual(expected, fs.readFileSync(fn, 'ucs2'));
68+
assert.strictEqual(fs.readFileSync(fn, 'ucs2'), expected);
6969
}
7070

7171
{
7272
const expected = '中文 2'; // Must be a unique string.
7373
externalizeString(expected);
74-
assert.strictEqual(false, isOneByteString(expected));
74+
assert.strictEqual(isOneByteString(expected), false);
7575
const fd = fs.openSync(fn, 'w');
7676
fs.writeSync(fd, expected, 0, 'utf8');
7777
fs.closeSync(fd);
78-
assert.strictEqual(expected, fs.readFileSync(fn, 'utf8'));
78+
assert.strictEqual(fs.readFileSync(fn, 'utf8'), expected);
7979
}
8080
/* eslint-enable no-undef */
8181

@@ -84,16 +84,16 @@ fs.open(fn, 'w', 0o644, common.mustCall(function(err, fd) {
8484

8585
const done = common.mustCall(function(err, written) {
8686
assert.ifError(err);
87-
assert.strictEqual(Buffer.byteLength(expected), written);
87+
assert.strictEqual(written, Buffer.byteLength(expected));
8888
fs.closeSync(fd);
8989
const found = fs.readFileSync(fn, 'utf8');
9090
fs.unlinkSync(fn);
91-
assert.strictEqual(expected, found);
91+
assert.strictEqual(found, expected);
9292
});
9393

9494
const written = common.mustCall(function(err, written) {
9595
assert.ifError(err);
96-
assert.strictEqual(0, written);
96+
assert.strictEqual(written, 0);
9797
fs.write(fd, expected, 0, 'utf8', done);
9898
});
9999

@@ -106,16 +106,16 @@ fs.open(fn2, args, 0o644, common.mustCall((err, fd) => {
106106

107107
const done = common.mustCall((err, written) => {
108108
assert.ifError(err);
109-
assert.strictEqual(Buffer.byteLength(expected), written);
109+
assert.strictEqual(written, Buffer.byteLength(expected));
110110
fs.closeSync(fd);
111111
const found = fs.readFileSync(fn2, 'utf8');
112112
fs.unlinkSync(fn2);
113-
assert.strictEqual(expected, found);
113+
assert.strictEqual(found, expected);
114114
});
115115

116116
const written = common.mustCall(function(err, written) {
117117
assert.ifError(err);
118-
assert.strictEqual(0, written);
118+
assert.strictEqual(written, 0);
119119
fs.write(fd, expected, 0, 'utf8', done);
120120
});
121121

@@ -127,7 +127,7 @@ fs.open(fn3, 'w', 0o644, common.mustCall(function(err, fd) {
127127

128128
const done = common.mustCall(function(err, written) {
129129
assert.ifError(err);
130-
assert.strictEqual(Buffer.byteLength(expected), written);
130+
assert.strictEqual(written, Buffer.byteLength(expected));
131131
fs.closeSync(fd);
132132
});
133133

0 commit comments

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