2019-02-25 21:35:50 -08:00
|
|
|
const { copy } = Deno;
|
2019-03-06 22:39:50 +01:00
|
|
|
import { test } from "../testing/mod.ts";
|
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";
|
|
|
|
|
2019-04-24 13:41:23 +02:00
|
|
|
test(async function ioStringWriter(): Promise<void> {
|
2019-02-11 08:49:48 +09:00
|
|
|
const w = new StringWriter("base");
|
|
|
|
const r = new StringReader("0123456789");
|
2019-03-05 11:53:35 +11:00
|
|
|
await copyN(w, r, 4);
|
2019-03-06 19:42:24 -05:00
|
|
|
assertEquals(w.toString(), "base0123");
|
2019-02-11 08:49:48 +09:00
|
|
|
await copy(w, r);
|
2019-03-06 19:42:24 -05:00
|
|
|
assertEquals(w.toString(), "base0123456789");
|
2019-02-11 08:49:48 +09:00
|
|
|
});
|