diff options
author | 2022-03-19 07:47:30 -0700 | |
---|---|---|
committer | 2022-03-19 07:47:30 -0700 | |
commit | 8313f19eb8ea6d4ec0f8168660efa6e12a0541c5 (patch) | |
tree | 0af72acc77458cfe71e35b87dc2e20dd23b2d00c /integration/bunjs-only-snippets/unsafe.test.js | |
parent | be99967d677ae1c0793ffe8a6c63b4f97a8468f1 (diff) | |
download | bun-8313f19eb8ea6d4ec0f8168660efa6e12a0541c5.tar.gz bun-8313f19eb8ea6d4ec0f8168660efa6e12a0541c5.tar.zst bun-8313f19eb8ea6d4ec0f8168660efa6e12a0541c5.zip |
Bun.allocUnsafe
Diffstat (limited to 'integration/bunjs-only-snippets/unsafe.test.js')
-rw-r--r-- | integration/bunjs-only-snippets/unsafe.test.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/integration/bunjs-only-snippets/unsafe.test.js b/integration/bunjs-only-snippets/unsafe.test.js index 1ce0935d6..d47821f42 100644 --- a/integration/bunjs-only-snippets/unsafe.test.js +++ b/integration/bunjs-only-snippets/unsafe.test.js @@ -40,3 +40,11 @@ it("arrayBufferToString u16", () => { expect(charCodes.length).toBe("hello world".length); Bun.gc(true); }); + +it("Bun.allocUnsafe", () => { + var buffer = Bun.allocUnsafe(1024); + expect(buffer instanceof Uint8Array).toBe(true); + expect(buffer.length).toBe(1024); + buffer[0] = 0; + expect(buffer[0]).toBe(0); +}); |