2017-01-23 14:39:40 -03:00
|
|
|
'use strict';
|
|
|
|
|
2017-03-24 09:46:44 -07:00
|
|
|
const common = require('../common');
|
2017-01-23 14:39:40 -03:00
|
|
|
const assert = require('assert');
|
|
|
|
const fs = require('fs');
|
|
|
|
|
|
|
|
const encoding = 'foo-8';
|
|
|
|
const filename = 'bar.txt';
|
2017-02-11 23:25:33 -02:00
|
|
|
const expectedError = common.expectsError({
|
|
|
|
code: 'ERR_INVALID_OPT_VALUE_ENCODING',
|
|
|
|
type: TypeError,
|
|
|
|
});
|
2017-01-23 14:39:40 -03:00
|
|
|
|
|
|
|
assert.throws(
|
2017-06-06 09:53:32 -07:00
|
|
|
fs.readFile.bind(fs, filename, { encoding }, common.mustNotCall()),
|
2017-02-11 23:25:33 -02:00
|
|
|
expectedError
|
2017-01-23 14:39:40 -03:00
|
|
|
);
|