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';
|
|
|
|
|
|
|
|
assert.throws(
|
2017-06-06 09:53:32 -07:00
|
|
|
fs.readFile.bind(fs, filename, { encoding }, common.mustNotCall()),
|
|
|
|
new RegExp(`^Error: Unknown encoding: ${encoding}$`)
|
2017-01-23 14:39:40 -03:00
|
|
|
);
|