xref: /third_party/node/test/parallel/test-fs-read-zero-length.js (revision 1cb0ef41)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures');
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ciconst fs = require('fs');
61cb0ef41Sopenharmony_ciconst filepath = fixtures.path('x.txt');
71cb0ef41Sopenharmony_ciconst fd = fs.openSync(filepath, 'r');
81cb0ef41Sopenharmony_ciconst bufferAsync = Buffer.alloc(0);
91cb0ef41Sopenharmony_ciconst bufferSync = Buffer.alloc(0);
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_cifs.read(fd, bufferAsync, 0, 0, 0, common.mustCall((err, bytesRead) => {
121cb0ef41Sopenharmony_ci  assert.strictEqual(bytesRead, 0);
131cb0ef41Sopenharmony_ci  assert.deepStrictEqual(bufferAsync, Buffer.alloc(0));
141cb0ef41Sopenharmony_ci}));
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ciconst r = fs.readSync(fd, bufferSync, 0, 0, 0);
171cb0ef41Sopenharmony_ciassert.deepStrictEqual(bufferSync, Buffer.alloc(0));
181cb0ef41Sopenharmony_ciassert.strictEqual(r, 0);
19

Indexes created Thu Nov 07 10:32:03 CST 2024