2017-01-20 07:33:09 +01:00
|
|
|
'use strict';
|
2017-03-24 17:46:44 +01:00
|
|
|
const common = require('../common');
|
2017-01-20 07:33:09 +01:00
|
|
|
const assert = require('assert');
|
|
|
|
const fs = require('fs');
|
|
|
|
|
|
|
|
const options = 'test';
|
2017-02-12 02:25:33 +01:00
|
|
|
const expectedError = common.expectsError({
|
|
|
|
code: 'ERR_INVALID_OPT_VALUE_ENCODING',
|
|
|
|
type: TypeError,
|
|
|
|
}, 17);
|
2017-01-20 07:33:09 +01:00
|
|
|
|
|
|
|
assert.throws(() => {
|
2017-05-25 23:47:52 +02:00
|
|
|
fs.readFile('path', options, common.mustNotCall());
|
2017-02-12 02:25:33 +01:00
|
|
|
}, expectedError);
|
2017-01-20 07:33:09 +01:00
|
|
|
|
|
|
|
assert.throws(() => {
|
|
|
|
fs.readFileSync('path', options);
|
2017-02-12 02:25:33 +01:00
|
|
|
}, expectedError);
|
2017-01-20 07:33:09 +01:00
|
|
|
|
|
|
|
assert.throws(() => {
|
2017-05-25 23:47:52 +02:00
|
|
|
fs.readdir('path', options, common.mustNotCall());
|
2017-02-12 02:25:33 +01:00
|
|
|
}, expectedError);
|
2017-01-20 07:33:09 +01:00
|
|
|
|
|
|
|
assert.throws(() => {
|
|
|
|
fs.readdirSync('path', options);
|
2017-02-12 02:25:33 +01:00
|
|
|
}, expectedError);
|
2017-01-20 07:33:09 +01:00
|
|
|
|
|
|
|
assert.throws(() => {
|
2017-05-25 23:47:52 +02:00
|
|
|
fs.readlink('path', options, common.mustNotCall());
|
2017-02-12 02:25:33 +01:00
|
|
|
}, expectedError);
|
2017-01-20 07:33:09 +01:00
|
|
|
|
|
|
|
assert.throws(() => {
|
|
|
|
fs.readlinkSync('path', options);
|
2017-02-12 02:25:33 +01:00
|
|
|
}, expectedError);
|
2017-01-20 07:33:09 +01:00
|
|
|
|
|
|
|
assert.throws(() => {
|
2017-05-25 23:47:52 +02:00
|
|
|
fs.writeFile('path', 'data', options, common.mustNotCall());
|
2017-02-12 02:25:33 +01:00
|
|
|
}, expectedError);
|
2017-01-20 07:33:09 +01:00
|
|
|
|
|
|
|
assert.throws(() => {
|
|
|
|
fs.writeFileSync('path', 'data', options);
|
2017-02-12 02:25:33 +01:00
|
|
|
}, expectedError);
|
2017-01-20 07:33:09 +01:00
|
|
|
|
|
|
|
assert.throws(() => {
|
2017-05-25 23:47:52 +02:00
|
|
|
fs.appendFile('path', 'data', options, common.mustNotCall());
|
2017-02-12 02:25:33 +01:00
|
|
|
}, expectedError);
|
2017-01-20 07:33:09 +01:00
|
|
|
|
|
|
|
assert.throws(() => {
|
|
|
|
fs.appendFileSync('path', 'data', options);
|
2017-02-12 02:25:33 +01:00
|
|
|
}, expectedError);
|
2017-01-20 07:33:09 +01:00
|
|
|
|
|
|
|
assert.throws(() => {
|
2017-05-25 23:47:52 +02:00
|
|
|
fs.watch('path', options, common.mustNotCall());
|
2017-02-12 02:25:33 +01:00
|
|
|
}, expectedError);
|
2017-01-20 07:33:09 +01:00
|
|
|
|
|
|
|
assert.throws(() => {
|
2017-05-25 23:47:52 +02:00
|
|
|
fs.realpath('path', options, common.mustNotCall());
|
2017-02-12 02:25:33 +01:00
|
|
|
}, expectedError);
|
2017-01-20 07:33:09 +01:00
|
|
|
|
|
|
|
assert.throws(() => {
|
|
|
|
fs.realpathSync('path', options);
|
2017-02-12 02:25:33 +01:00
|
|
|
}, expectedError);
|
2017-01-20 07:33:09 +01:00
|
|
|
|
|
|
|
assert.throws(() => {
|
2017-05-25 23:47:52 +02:00
|
|
|
fs.mkdtemp('path', options, common.mustNotCall());
|
2017-02-12 02:25:33 +01:00
|
|
|
}, expectedError);
|
2017-01-20 07:33:09 +01:00
|
|
|
|
|
|
|
assert.throws(() => {
|
|
|
|
fs.mkdtempSync('path', options);
|
2017-02-12 02:25:33 +01:00
|
|
|
}, expectedError);
|
2017-01-20 07:33:09 +01:00
|
|
|
|
|
|
|
assert.throws(() => {
|
|
|
|
fs.ReadStream('path', options);
|
2017-02-12 02:25:33 +01:00
|
|
|
}, expectedError);
|
2017-01-20 07:33:09 +01:00
|
|
|
|
|
|
|
assert.throws(() => {
|
|
|
|
fs.WriteStream('path', options);
|
2017-02-12 02:25:33 +01:00
|
|
|
}, expectedError);
|