Skip to content

Commit 79ba863

Browse files
Patrick HeneiseMylesBorins
authored andcommitted
test: fs.write() if 3rd argument is a callback, not offset
Easier way to resolve conflicts from #16822 and #16827. PR-URL: #17045 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 4b35dfb commit 79ba863

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const path = require('path');
2626
constfs=require('fs');
2727
constfn=path.join(common.tmpDir,'write.txt');
2828
constfn2=path.join(common.tmpDir,'write2.txt');
29+
constfn3=path.join(common.tmpDir,'write3.txt');
2930
constexpected='ümlaut.';
3031
constconstants=fs.constants;
3132

@@ -73,3 +74,15 @@ fs.open(fn2, args, 0o644, common.mustCall((err, fd) =>{
7374
fs.write(fd,'',0,'utf8',written);
7475
fs.write(fd,expected,0,'utf8',done);
7576
}));
77+
78+
fs.open(fn3,'w',0o644,common.mustCall(function(err,fd){
79+
assert.ifError(err);
80+
81+
constdone=common.mustCall(function(err,written){
82+
assert.ifError(err);
83+
assert.strictEqual(Buffer.byteLength(expected),written);
84+
fs.closeSync(fd);
85+
});
86+
87+
fs.write(fd,expected,done);
88+
}));

0 commit comments

Comments
(0)