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