diff options
author | Nikolai Vavilov <vvnicholas@gmail.com> | 2017-01-10 14:26:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-10 14:26:23 +0200 |
commit | 3c2a9361ffd797acd6c9f5a09ae01648aa0e9792 (patch) | |
tree | 7b755d0c03e0e62713d9629b14f123e323378547 /test/parallel/test-fs-read-type.js | |
parent | 2685464e34731d9ea14e97616309f4e7b7292551 (diff) | |
download | node-new-3c2a9361ffd797acd6c9f5a09ae01648aa0e9792.tar.gz |
fs: remove fs.read's string interface
It is a maintenance burden that was removed from the docs in 2010
(c93e0aaf062081db3ec40ac45b3e2c979d5759d6) and runtime-deprecated in v6.0
(1124de2d76ad7118267d91a08485aa928a5f0865).
PR-URL: https://github.com/nodejs/node/pull/9683
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-read-type.js')
-rw-r--r-- | test/parallel/test-fs-read-type.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/parallel/test-fs-read-type.js b/test/parallel/test-fs-read-type.js new file mode 100644 index 0000000000..2b600b0487 --- /dev/null +++ b/test/parallel/test-fs-read-type.js @@ -0,0 +1,21 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const path = require('path'); +const fs = require('fs'); +const filepath = path.join(common.fixturesDir, 'x.txt'); +const fd = fs.openSync(filepath, 'r'); +const expected = 'xyz\n'; + +// Error must be thrown with string +assert.throws(() => { + fs.read(fd, + expected.length, + 0, + 'utf-8', + () => {}); +}, /Second argument needs to be a buffer/); + +assert.throws(() => { + fs.readSync(fd, expected.length, 0, 'utf-8'); +}, /Second argument needs to be a buffer/); |