summaryrefslogtreecommitdiff
path: root/std/node/buffer_test.ts
diff options
context:
space:
mode:
authorMarcos Casagrande <marcoscvp90@gmail.com>2020-06-28 16:16:54 +0200
committerGitHub <noreply@github.com>2020-06-28 10:16:54 -0400
commitd779053dc6ea6aafef06f8a5e7f28cbbc8166864 (patch)
tree696572bfe0f1943819e6cd6632a86ad0f6f622c0 /std/node/buffer_test.ts
parent2da084058397efd6f517ba98c9882760ec0a7bd6 (diff)
feat(std/node): Add Buffer.allocUnsafe (#6533)
Diffstat (limited to 'std/node/buffer_test.ts')
-rw-r--r--std/node/buffer_test.ts16
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);