summaryrefslogtreecommitdiff
path: root/js/buffer_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'js/buffer_test.ts')
-rw-r--r--js/buffer_test.ts14
1 files changed, 12 insertions, 2 deletions
diff --git a/js/buffer_test.ts b/js/buffer_test.ts
index 843a85f97..58668de26 100644
--- a/js/buffer_test.ts
+++ b/js/buffer_test.ts
@@ -1,8 +1,8 @@
+import { Buffer, readAll } from "deno";
// This code has been ported almost directly from Go's src/bytes/buffer_test.go
// Copyright 2009 The Go Authors. All rights reserved. BSD license.
// https://github.com/golang/go/blob/master/LICENSE
-import { test, assert, assertEqual } from "./test_util.ts";
-import { Buffer } from "deno";
+import { assert, assertEqual, test } from "./test_util.ts";
// N controls how many iterations of certain checks are performed.
const N = 100;
@@ -193,3 +193,13 @@ test(async function bufferTestGrow() {
}
}
});
+
+test(async function testReadAll() {
+ init();
+ const reader = new Buffer(testBytes.buffer as ArrayBuffer);
+ const actualBytes = await readAll(reader);
+ assertEqual(testBytes.byteLength, actualBytes.byteLength);
+ for (let i = 0; i < testBytes.length; ++i) {
+ assertEqual(testBytes[i], actualBytes[i]);
+ }
+});