summaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-read.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2018-08-06 01:17:25 +0200
committerRuben Bridgewater <ruben@bridgewater.de>2018-08-09 14:11:24 +0200
commit8e1b6e771867fc4e89715cf22501dfe2f01cf8d0 (patch)
tree5b6b276f8c49ae737b923f2e5f8e725bb46e25cf /test/parallel/test-fs-read.js
parent85bfd71312ef7e3ac3aa1306ab2d2ff1c9dab9e3 (diff)
downloadandroid-node-v8-8e1b6e771867fc4e89715cf22501dfe2f01cf8d0.tar.gz
android-node-v8-8e1b6e771867fc4e89715cf22501dfe2f01cf8d0.tar.bz2
android-node-v8-8e1b6e771867fc4e89715cf22501dfe2f01cf8d0.zip
fs: require callback in read
Currently the read operation did not require the callback and that was an oversight when callbacks became mandatory. PR-URL: https://github.com/nodejs/node/pull/22146 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'test/parallel/test-fs-read.js')
-rw-r--r--test/parallel/test-fs-read.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/parallel/test-fs-read.js b/test/parallel/test-fs-read.js
index 864876537c..5843cdc836 100644
--- a/test/parallel/test-fs-read.js
+++ b/test/parallel/test-fs-read.js
@@ -58,7 +58,6 @@ test(new Uint8Array(expected.length),
// Reading beyond file length (3 in this case) should return no data.
// This is a test for a bug where reads > uint32 would return data
// from the current position in the file.
- const fd = fs.openSync(filepath, 'r');
const pos = 0xffffffff + 1; // max-uint32 + 1
const nRead = fs.readSync(fd, Buffer.alloc(1), 0, 1, pos);
assert.strictEqual(nRead, 0);
@@ -68,3 +67,11 @@ test(new Uint8Array(expected.length),
assert.strictEqual(nRead, 0);
}));
}
+
+assert.throws(
+ () => fs.read(fd, Buffer.alloc(1), 0, 1, 0),
+ {
+ message: 'Callback must be a function',
+ code: 'ERR_INVALID_CALLBACK',
+ }
+);