summaryrefslogtreecommitdiff
path: root/cli/tests/unit/files_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit/files_test.ts')
-rw-r--r--cli/tests/unit/files_test.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/cli/tests/unit/files_test.ts b/cli/tests/unit/files_test.ts
index c30ef2a71..2ea202536 100644
--- a/cli/tests/unit/files_test.ts
+++ b/cli/tests/unit/files_test.ts
@@ -574,6 +574,23 @@ Deno.test({ permissions: { read: true } }, async function seekStart() {
file.close();
});
+Deno.test({ permissions: { read: true } }, async function seekStartBigInt() {
+ const filename = "cli/tests/testdata/assets/hello.txt";
+ const file = await Deno.open(filename);
+ const seekPosition = 6n;
+ // Deliberately move 1 step forward
+ await file.read(new Uint8Array(1)); // "H"
+ // Skipping "Hello "
+ // seeking from beginning of a file plus seekPosition
+ const cursorPosition = await file.seek(seekPosition, Deno.SeekMode.Start);
+ assertEquals(seekPosition, BigInt(cursorPosition));
+ const buf = new Uint8Array(6);
+ await file.read(buf);
+ const decoded = new TextDecoder().decode(buf);
+ assertEquals(decoded, "world!");
+ file.close();
+});
+
Deno.test({ permissions: { read: true } }, function seekSyncStart() {
const filename = "cli/tests/testdata/assets/hello.txt";
const file = Deno.openSync(filename);