2020-02-11 11:24:27 -05:00
|
|
|
const { copy, test } = Deno;
|
2019-03-06 19:42:24 -05:00
|
|
|
import { assertEquals } from "../testing/asserts.ts";
|
2019-02-10 18:49:48 -05:00
|
|
|
import { StringWriter } from "./writers.ts";
|
|
|
|
import { StringReader } from "./readers.ts";
|
|
|
|
import { copyN } from "./ioutil.ts";
|
|
|
|
|
2019-04-24 07:41:23 -04:00
|
|
|
test(async function ioStringWriter(): Promise<void> {
|
2019-02-10 18:49:48 -05:00
|
|
|
const w = new StringWriter("base");
|
|
|
|
const r = new StringReader("0123456789");
|
2020-04-26 16:26:02 -04:00
|
|
|
await copyN(r, w, 4);
|
2019-03-06 19:42:24 -05:00
|
|
|
assertEquals(w.toString(), "base0123");
|
2020-04-24 18:09:14 -04:00
|
|
|
await copy(r, w);
|
2019-03-06 19:42:24 -05:00
|
|
|
assertEquals(w.toString(), "base0123456789");
|
2019-02-10 18:49:48 -05:00
|
|
|
});
|