2020-02-11 17:24:27 +01:00
|
|
|
const { copy, test } = Deno;
|
2019-03-06 19:42:24 -05:00
|
|
|
import { assertEquals } from "../testing/asserts.ts";
|
2019-02-11 08:49:48 +09:00
|
|
|
import { StringWriter } from "./writers.ts";
|
|
|
|
import { StringReader } from "./readers.ts";
|
|
|
|
import { copyN } from "./ioutil.ts";
|
|
|
|
|
2020-04-28 12:33:09 +02:00
|
|
|
test("ioStringWriter", async function (): Promise<void> {
|
2019-02-11 08:49:48 +09:00
|
|
|
const w = new StringWriter("base");
|
|
|
|
const r = new StringReader("0123456789");
|
2020-04-27 01:56:02 +05:30
|
|
|
await copyN(r, w, 4);
|
2019-03-06 19:42:24 -05:00
|
|
|
assertEquals(w.toString(), "base0123");
|
2020-04-25 00:09:14 +02:00
|
|
|
await copy(r, w);
|
2019-03-06 19:42:24 -05:00
|
|
|
assertEquals(w.toString(), "base0123456789");
|
2019-02-11 08:49:48 +09:00
|
|
|
});
|