diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2011-06-25 14:53:28 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2011-07-05 02:05:09 +0200 |
commit | 1e6b72e8cbee0837dba3741f3358edf4e22fefb2 (patch) | |
tree | b34b35c5b112dd7c639b0706d0f66475baa7fe38 | |
parent | 1e29fe65c31165889b836ac0ffd1861af5ddf54e (diff) | |
download | node-1e6b72e8cbee0837dba3741f3358edf4e22fefb2.tar.gz |
Test case for issue #1228: errno masked in fs.openSync().
-rw-r--r-- | test/simple/test-fs-open.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/simple/test-fs-open.js b/test/simple/test-fs-open.js index 02ae5d73f..d2c4f54f2 100644 --- a/test/simple/test-fs-open.js +++ b/test/simple/test-fs-open.js @@ -19,10 +19,22 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. +var constants = require('constants'); var common = require('../common'); var assert = require('assert'); var fs = require('fs'); +var caughtException = false; +try { + // should throw ENOENT, not EBADF - see https://github.com/joyent/node/pull/1228 + fs.openSync('/path/to/file/that/does/not/exist', 'r'); +} +catch (e) { + assert.equal(e.errno, constants.ENOENT); + caughtException = true; +} +assert.ok(caughtException); + var openFd; fs.open(__filename, 'r', function(err, fd) { if (err) { |