diff options
author | Satya Rohith <me@satyarohith.com> | 2024-10-08 16:11:32 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-08 10:41:32 +0000 |
commit | ff4e682ff95af37b52c404d694ffcfcfa57bb127 (patch) | |
tree | a14e6b7af1b494393796a7eac56fbc3ca3ac8927 /tests/unit_node/fs_test.ts | |
parent | 2d488e4bfb9ffdfd2d043cc4bba9e6037b4cc24e (diff) |
fix(ext/node): internal buffer length in readSync (#26064)
Closes https://github.com/denoland/deno/issues/26054
Diffstat (limited to 'tests/unit_node/fs_test.ts')
-rw-r--r-- | tests/unit_node/fs_test.ts | 11 |
1 files changed, 11 insertions, 0 deletions
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!); +}); |