diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2018-02-28 01:33:31 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2018-03-02 21:13:23 +0800 |
commit | 79b195437c007162e0ebf5b24f3f38f8d369e267 (patch) | |
tree | 862752e1d35024dd0d167f22f9bfd0b6daa0a486 /test/parallel/test-fs-error-messages.js | |
parent | c6acfdb3acc41439899398a615e0ea0a821dcd90 (diff) | |
download | android-node-v8-79b195437c007162e0ebf5b24f3f38f8d369e267.tar.gz android-node-v8-79b195437c007162e0ebf5b24f3f38f8d369e267.tar.bz2 android-node-v8-79b195437c007162e0ebf5b24f3f38f8d369e267.zip |
fs: throw fchmodSync errors in JS
PR-URL: https://github.com/nodejs/node/pull/19041
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-error-messages.js')
-rw-r--r-- | test/parallel/test-fs-error-messages.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/parallel/test-fs-error-messages.js b/test/parallel/test-fs-error-messages.js index dc925069ba..d14a5b8eff 100644 --- a/test/parallel/test-fs-error-messages.js +++ b/test/parallel/test-fs-error-messages.js @@ -729,3 +729,23 @@ if (!common.isAIX) { ); }); } + +// fchmod +{ + const validateError = (err) => { + assert.strictEqual(err.message, 'EBADF: bad file descriptor, fchmod'); + assert.strictEqual(err.errno, uv.UV_EBADF); + assert.strictEqual(err.code, 'EBADF'); + assert.strictEqual(err.syscall, 'fchmod'); + return true; + }; + + common.runWithInvalidFD((fd) => { + fs.fchmod(fd, 0o666, common.mustCall(validateError)); + + assert.throws( + () => fs.fchmodSync(fd, 0o666), + validateError + ); + }); +} |