2015-11-03 09:52:46 +08:00
|
|
|
'use strict';
|
2017-12-24 22:38:11 -08:00
|
|
|
require('../common');
|
2015-11-03 09:52:46 +08:00
|
|
|
|
|
|
|
const assert = require('assert');
|
|
|
|
const fs = require('fs');
|
|
|
|
|
2017-12-24 22:38:11 -08:00
|
|
|
const tmpdir = require('../common/tmpdir');
|
|
|
|
tmpdir.refresh();
|
2015-11-03 09:52:46 +08:00
|
|
|
|
|
|
|
// O_WRONLY without O_CREAT shall fail with ENOENT
|
2023-08-15 22:45:24 +09:00
|
|
|
const pathNE = tmpdir.resolve('file-should-not-exist');
|
2015-11-03 09:52:46 +08:00
|
|
|
assert.throws(
|
2016-05-02 10:27:12 -07:00
|
|
|
() => fs.openSync(pathNE, fs.constants.O_WRONLY),
|
2015-11-03 09:52:46 +08:00
|
|
|
(e) => e.code === 'ENOENT'
|
|
|
|
);
|