diff options
Diffstat (limited to 'std/node/buffer_test.ts')
-rw-r--r-- | std/node/buffer_test.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/std/node/buffer_test.ts b/std/node/buffer_test.ts index 8f6d19058..105bc284e 100644 --- a/std/node/buffer_test.ts +++ b/std/node/buffer_test.ts @@ -97,6 +97,22 @@ Deno.test({ }); Deno.test({ + name: "allocUnsafe allocates a buffer with the expected size", + fn() { + const buffer: Buffer = Buffer.allocUnsafe(1); + assertEquals(buffer.length, 1, "Buffer size should be 1"); + }, +}); + +Deno.test({ + name: "allocUnsafe(0) creates an empty buffer", + fn() { + const buffer: Buffer = Buffer.allocUnsafe(0); + assertEquals(buffer.length, 0, "Buffer size should be 0"); + }, +}); + +Deno.test({ name: "alloc filled correctly with integer", fn() { const buffer: Buffer = Buffer.alloc(3, 5); |