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 736b95a

Browse filesBrowse files
addaleaxItalo A. Casas
authored andcommitted
test: check error and cleanups in test-fs-read-buffer
Use arrow functions and prefer `strictEqual` over `deepStrictEqual` where it works. PR-URL: #10611 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
1 parent de8eee6 commit 736b95a
Copy full SHA for 736b95a

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

+13
-12
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-fs-read-buffer.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-read-buffer.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ function test(bufferAsync, bufferSync, expected) {
1616
expected.length,
1717
0,
1818
common.mustCall((err, bytesRead) => {
19+
assert.ifError(err);
1920
assert.strictEqual(bytesRead, expected.length);
2021
assert.deepStrictEqual(bufferAsync, Buffer.from(expected));
2122
}));
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-fs-write-buffer.js
+12-12Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ common.refreshTmpDir();
1010
// fs.write with all parameters provided:
1111
{
1212
const filename = path.join(common.tmpDir, 'write1.txt');
13-
fs.open(filename, 'w', 0o644, common.mustCall(function(err, fd) {
13+
fs.open(filename, 'w', 0o644, common.mustCall((err, fd) => {
1414
assert.ifError(err);
1515

16-
const cb = common.mustCall(function(err, written) {
16+
const cb = common.mustCall((err, written) => {
1717
assert.ifError(err);
1818

1919
assert.strictEqual(expected.length, written);
2020
fs.closeSync(fd);
2121

2222
var found = fs.readFileSync(filename, 'utf8');
23-
assert.deepStrictEqual(expected.toString(), found);
23+
assert.strictEqual(expected.toString(), found);
2424
});
2525

2626
fs.write(fd, expected, 0, expected.length, null, cb);
@@ -30,17 +30,17 @@ common.refreshTmpDir();
3030
// fs.write with a buffer, without the length parameter:
3131
{
3232
const filename = path.join(common.tmpDir, 'write2.txt');
33-
fs.open(filename, 'w', 0o644, common.mustCall(function(err, fd) {
33+
fs.open(filename, 'w', 0o644, common.mustCall((err, fd) => {
3434
assert.ifError(err);
3535

36-
const cb = common.mustCall(function(err, written) {
36+
const cb = common.mustCall((err, written) => {
3737
assert.ifError(err);
3838

3939
assert.strictEqual(2, written);
4040
fs.closeSync(fd);
4141

4242
const found = fs.readFileSync(filename, 'utf8');
43-
assert.deepStrictEqual('lo', found);
43+
assert.strictEqual('lo', found);
4444
});
4545

4646
fs.write(fd, Buffer.from('hello'), 3, cb);
@@ -90,17 +90,17 @@ common.refreshTmpDir();
9090
// fs.write with offset and length passed as undefined followed by the callback:
9191
{
9292
const filename = path.join(common.tmpDir, 'write5.txt');
93-
fs.open(filename, 'w', 0o644, common.mustCall(function(err, fd) {
93+
fs.open(filename, 'w', 0o644, common.mustCall((err, fd) => {
9494
assert.ifError(err);
9595

96-
const cb = common.mustCall(function(err, written) {
96+
const cb = common.mustCall((err, written) => {
9797
assert.ifError(err);
9898

9999
assert.strictEqual(expected.length, written);
100100
fs.closeSync(fd);
101101

102102
const found = fs.readFileSync(filename, 'utf8');
103-
assert.deepStrictEqual(expected.toString(), found);
103+
assert.strictEqual(expected.toString(), found);
104104
});
105105

106106
fs.write(fd, expected, undefined, undefined, cb);
@@ -110,17 +110,17 @@ common.refreshTmpDir();
110110
// fs.write with a Uint8Array, without the offset and length parameters:
111111
{
112112
const filename = path.join(common.tmpDir, 'write6.txt');
113-
fs.open(filename, 'w', 0o644, common.mustCall(function(err, fd) {
113+
fs.open(filename, 'w', 0o644, common.mustCall((err, fd) => {
114114
assert.ifError(err);
115115

116-
const cb = common.mustCall(function(err, written) {
116+
const cb = common.mustCall((err, written) => {
117117
assert.ifError(err);
118118

119119
assert.strictEqual(expected.length, written);
120120
fs.closeSync(fd);
121121

122122
const found = fs.readFileSync(filename, 'utf8');
123-
assert.deepStrictEqual(expected.toString(), found);
123+
assert.strictEqual(expected.toString(), found);
124124
});
125125

126126
fs.write(fd, Uint8Array.from(expected), cb);

0 commit comments

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