1'use strict'; 2 3// Checks for crash regression: https://github.com/nodejs/node/issues/37430 4 5const common = require('../common'); 6const assert = require('assert'); 7const { 8 open, 9 openSync, 10 promises: { 11 open: openPromise, 12 }, 13} = require('fs'); 14 15// These should throw, not crash. 16const invalid = 4_294_967_296; 17 18assert.throws(() => open(__filename, invalid, common.mustNotCall()), { 19 code: 'ERR_OUT_OF_RANGE' 20}); 21 22assert.throws(() => open(__filename, 0, invalid, common.mustNotCall()), { 23 code: 'ERR_OUT_OF_RANGE' 24}); 25 26assert.throws(() => openSync(__filename, invalid), { 27 code: 'ERR_OUT_OF_RANGE' 28}); 29 30assert.throws(() => openSync(__filename, 0, invalid), { 31 code: 'ERR_OUT_OF_RANGE' 32}); 33 34assert.rejects(openPromise(__filename, invalid), { 35 code: 'ERR_OUT_OF_RANGE' 36}); 37 38assert.rejects(openPromise(__filename, 0, invalid), { 39 code: 'ERR_OUT_OF_RANGE' 40}); 41