summaryrefslogtreecommitdiff
path: root/test/parallel
diff options
context:
space:
mode:
authorPatrick Heneise <patrick@heneise.consulting>2017-11-15 16:23:32 +0100
committerAnna Henningsen <anna@addaleax.net>2017-11-18 22:09:08 +0100
commit8f8999c1c0de92b3720bead0c09b06d6cdc44ac7 (patch)
tree15c8071027b2bab17cb06ac26809c1f7a0f79130 /test/parallel
parent9531fcbb2e447c6a5ef0366c5446e10f90073cb5 (diff)
downloadandroid-node-v8-8f8999c1c0de92b3720bead0c09b06d6cdc44ac7.tar.gz
android-node-v8-8f8999c1c0de92b3720bead0c09b06d6cdc44ac7.tar.bz2
android-node-v8-8f8999c1c0de92b3720bead0c09b06d6cdc44ac7.zip
test: fs.write() if 3rd argument is a callback, not offset
Easier way to resolve conflicts from #16822 and #16827. PR-URL: https://github.com/nodejs/node/pull/17045 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test/parallel')
-rw-r--r--test/parallel/test-fs-write.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/parallel/test-fs-write.js b/test/parallel/test-fs-write.js
index e861b183d9..ccf2d9b40f 100644
--- a/test/parallel/test-fs-write.js
+++ b/test/parallel/test-fs-write.js
@@ -26,6 +26,7 @@ const path = require('path');
const fs = require('fs');
const fn = path.join(common.tmpDir, 'write.txt');
const fn2 = path.join(common.tmpDir, 'write2.txt');
+const fn3 = path.join(common.tmpDir, 'write3.txt');
const expected = 'ümlaut.';
const constants = fs.constants;
@@ -73,3 +74,15 @@ fs.open(fn2, args, 0o644, common.mustCall((err, fd) => {
fs.write(fd, '', 0, 'utf8', written);
fs.write(fd, expected, 0, 'utf8', done);
}));
+
+fs.open(fn3, 'w', 0o644, common.mustCall(function(err, fd) {
+ assert.ifError(err);
+
+ const done = common.mustCall(function(err, written) {
+ assert.ifError(err);
+ assert.strictEqual(Buffer.byteLength(expected), written);
+ fs.closeSync(fd);
+ });
+
+ fs.write(fd, expected, done);
+}));