diff options
author | 2023-03-01 18:07:21 -0300 | |
---|---|---|
committer | 2023-03-01 13:07:21 -0800 | |
commit | 56ca48ece88c0de854ec20c5e71a639fee6ccb0f (patch) | |
tree | 6161cccbd4bc5ce3f72e2ccfea9e25a8513a26cf /test/bun.js | |
parent | 530cf4caf8abe4960d833efc6cce71188dea40b2 (diff) | |
download | bun-56ca48ece88c0de854ec20c5e71a639fee6ccb0f.tar.gz bun-56ca48ece88c0de854ec20c5e71a639fee6ccb0f.tar.zst bun-56ca48ece88c0de854ec20c5e71a639fee6ccb0f.zip |
fix Bun.file.arrayBuffer() segmentation fault on empty file #2248 (#2249)
* fix Bun.file.arrayBuffer() segmentation fault on empty file #2248
* cleanner this.iotask check
Diffstat (limited to 'test/bun.js')
-rw-r--r-- | test/bun.js/bun-write.test.js | 8 | ||||
-rw-r--r-- | test/bun.js/emptyFile | 0 |
2 files changed, 8 insertions, 0 deletions
diff --git a/test/bun.js/bun-write.test.js b/test/bun.js/bun-write.test.js index 7e1d43059..68e221d51 100644 --- a/test/bun.js/bun-write.test.js +++ b/test/bun.js/bun-write.test.js @@ -139,6 +139,14 @@ it("Bun.file", async () => { await gcTick(); }); +it("Bun.file empty file", async () => { + const file = path.join(import.meta.dir, "emptyFile"); + await gcTick(); + const buffer = await Bun.file(file).arrayBuffer() + expect(buffer.byteLength).toBe(0); + await gcTick(); +}); + it("Bun.file as a Blob", async () => { const filePath = path.join(import.meta.path, "../fetch.js.txt"); const fixture = fs.readFileSync(filePath, "utf8"); diff --git a/test/bun.js/emptyFile b/test/bun.js/emptyFile new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/test/bun.js/emptyFile |