From ff4e682ff95af37b52c404d694ffcfcfa57bb127 Mon Sep 17 00:00:00 2001 From: Satya Rohith Date: Tue, 8 Oct 2024 16:11:32 +0530 Subject: fix(ext/node): internal buffer length in readSync (#26064) Closes https://github.com/denoland/deno/issues/26054 --- tests/unit_node/fs_test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests') diff --git a/tests/unit_node/fs_test.ts b/tests/unit_node/fs_test.ts index b1f7c53e8..2d1465aec 100644 --- a/tests/unit_node/fs_test.ts +++ b/tests/unit_node/fs_test.ts @@ -4,13 +4,16 @@ import { assert, assertEquals, assertThrows } from "@std/assert"; import { join } from "node:path"; import { tmpdir } from "node:os"; import { + closeSync, constants, createWriteStream, existsSync, lstatSync, mkdtempSync, + openSync, promises, readFileSync, + readSync, Stats, statSync, writeFileSync, @@ -201,3 +204,11 @@ Deno.test( assertEquals(res, [0, 1, 2, 3, 4, 5]); }, ); + +Deno.test("[node/fs] readSync works", () => { + const fd = openSync("tests/testdata/assets/hello.txt", "r"); + const buf = new Uint8Array(256); + const bytesRead = readSync(fd!, buf); + assertEquals(bytesRead, 12); + closeSync(fd!); +}); -- cgit v1.2.3