mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
23 lines
704 B
TypeScript
23 lines
704 B
TypeScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
|
|
import { assert, assertEquals } from "@std/assert";
|
|
import { readAll, readAllSync } from "./read_all.ts";
|
|
import { Buffer } from "./buffer.ts";
|
|
import { init } from "./_test_common.ts";
|
|
|
|
Deno.test("readAll()", async () => {
|
|
const testBytes = init();
|
|
assert(testBytes);
|
|
const reader = new Buffer(testBytes.buffer);
|
|
const actualBytes = await readAll(reader);
|
|
assertEquals(testBytes, actualBytes);
|
|
});
|
|
|
|
Deno.test("readAllSync()", () => {
|
|
const testBytes = init();
|
|
assert(testBytes);
|
|
const reader = new Buffer(testBytes.buffer);
|
|
const actualBytes = readAllSync(reader);
|
|
assertEquals(testBytes, actualBytes);
|
|
});
|