-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check the error of `assertEncoding`. Confirmed in every place being used.(a place where `getoptions` is used) assetEncoding: https://github.com/nodejs/node/blob/521767c88605cb6481ea98f396924e55f9dd22f4/lib/internal/fs.js#L18 PR-URL: #10913 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
- Loading branch information
1 parent
c5210b2
commit 8ac6a70
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
'use strict'; | ||
require('../common'); | ||
const assert = require('assert'); | ||
const fs = require('fs'); | ||
|
||
const options = 'test'; | ||
const noop = () => {}; | ||
const unknownEncodingMessage = /^Error: Unknown encoding: test$/; | ||
|
||
assert.throws(() => { | ||
fs.readFile('path', options, noop); | ||
}, unknownEncodingMessage); | ||
|
||
assert.throws(() => { | ||
fs.readFileSync('path', options); | ||
}, unknownEncodingMessage); | ||
|
||
assert.throws(() => { | ||
fs.readdir('path', options, noop); | ||
}, unknownEncodingMessage); | ||
|
||
assert.throws(() => { | ||
fs.readdirSync('path', options); | ||
}, unknownEncodingMessage); | ||
|
||
assert.throws(() => { | ||
fs.readlink('path', options, noop); | ||
}, unknownEncodingMessage); | ||
|
||
assert.throws(() => { | ||
fs.readlinkSync('path', options); | ||
}, unknownEncodingMessage); | ||
|
||
assert.throws(() => { | ||
fs.writeFile('path', 'data', options, noop); | ||
}, unknownEncodingMessage); | ||
|
||
assert.throws(() => { | ||
fs.writeFileSync('path', 'data', options); | ||
}, unknownEncodingMessage); | ||
|
||
assert.throws(() => { | ||
fs.appendFile('path', 'data', options, noop); | ||
}, unknownEncodingMessage); | ||
|
||
assert.throws(() => { | ||
fs.appendFileSync('path', 'data', options); | ||
}, unknownEncodingMessage); | ||
|
||
assert.throws(() => { | ||
fs.watch('path', options, noop); | ||
}, unknownEncodingMessage); | ||
|
||
assert.throws(() => { | ||
fs.realpath('path', options, noop); | ||
}, unknownEncodingMessage); | ||
|
||
assert.throws(() => { | ||
fs.realpathSync('path', options); | ||
}, unknownEncodingMessage); | ||
|
||
assert.throws(() => { | ||
fs.mkdtemp('path', options, noop); | ||
}, unknownEncodingMessage); | ||
|
||
assert.throws(() => { | ||
fs.mkdtempSync('path', options); | ||
}, unknownEncodingMessage); | ||
|
||
assert.throws(() => { | ||
fs.ReadStream('path', options); | ||
}, unknownEncodingMessage); | ||
|
||
assert.throws(() => { | ||
fs.WriteStream('path', options); | ||
}, unknownEncodingMessage); |