11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_cirequire('../common'); 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures'); 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ciconst fs = require('fs'); 71cb0ef41Sopenharmony_ciconst filepath = fixtures.path('x.txt'); 81cb0ef41Sopenharmony_ciconst fd = fs.openSync(filepath, 'r'); 91cb0ef41Sopenharmony_ciconst fsPromises = fs.promises; 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciconst buffer = new Uint8Array(); 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ciassert.throws( 141cb0ef41Sopenharmony_ci () => fs.readSync(fd, buffer, 0, 10, 0), 151cb0ef41Sopenharmony_ci { 161cb0ef41Sopenharmony_ci code: 'ERR_INVALID_ARG_VALUE', 171cb0ef41Sopenharmony_ci message: 'The argument \'buffer\' is empty and cannot be written. ' + 181cb0ef41Sopenharmony_ci 'Received Uint8Array(0) []' 191cb0ef41Sopenharmony_ci } 201cb0ef41Sopenharmony_ci); 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ciassert.throws( 231cb0ef41Sopenharmony_ci () => fs.read(fd, buffer, 0, 1, 0, common.mustNotCall()), 241cb0ef41Sopenharmony_ci { 251cb0ef41Sopenharmony_ci code: 'ERR_INVALID_ARG_VALUE', 261cb0ef41Sopenharmony_ci message: 'The argument \'buffer\' is empty and cannot be written. ' + 271cb0ef41Sopenharmony_ci 'Received Uint8Array(0) []' 281cb0ef41Sopenharmony_ci } 291cb0ef41Sopenharmony_ci); 301cb0ef41Sopenharmony_ci 311cb0ef41Sopenharmony_ci(async () => { 321cb0ef41Sopenharmony_ci const filehandle = await fsPromises.open(filepath, 'r'); 331cb0ef41Sopenharmony_ci assert.rejects( 341cb0ef41Sopenharmony_ci () => filehandle.read(buffer, 0, 1, 0), 351cb0ef41Sopenharmony_ci { 361cb0ef41Sopenharmony_ci code: 'ERR_INVALID_ARG_VALUE', 371cb0ef41Sopenharmony_ci message: 'The argument \'buffer\' is empty and cannot be written. ' + 381cb0ef41Sopenharmony_ci 'Received Uint8Array(0) []' 391cb0ef41Sopenharmony_ci } 401cb0ef41Sopenharmony_ci ); 411cb0ef41Sopenharmony_ci})().then(common.mustCall()); 42