summaryrefslogtreecommitdiff
path: root/std/io/bufio_test.ts
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2020-06-06 10:37:52 -0400
committerGitHub <noreply@github.com>2020-06-06 10:37:52 -0400
commit1a2f88609b3e1bc27790c77331ac96b423625eb6 (patch)
treed950e2cb4aaafc459b16d4f9333b2c29d7adbcc4 /std/io/bufio_test.ts
parent78333f0ab3614e8dbd3dfdc95e9dbb53f80ffe5d (diff)
fix(std/io): StringReader implementation (#6148)
Diffstat (limited to 'std/io/bufio_test.ts')
-rw-r--r--std/io/bufio_test.ts15
1 files changed, 8 insertions, 7 deletions
diff --git a/std/io/bufio_test.ts b/std/io/bufio_test.ts
index 671ed2115..b03640d52 100644
--- a/std/io/bufio_test.ts
+++ b/std/io/bufio_test.ts
@@ -17,7 +17,8 @@ import {
readLines,
} from "./bufio.ts";
import * as iotest from "./_iotest.ts";
-import { charCode, copyBytes, stringsReader } from "./util.ts";
+import { StringReader } from "./readers.ts";
+import { charCode, copyBytes } from "./util.ts";
const encoder = new TextEncoder();
@@ -38,7 +39,7 @@ async function readBytes(buf: BufReader): Promise<string> {
Deno.test("bufioReaderSimple", async function (): Promise<void> {
const data = "hello world";
- const b = new BufReader(stringsReader(data));
+ const b = new BufReader(new StringReader(data));
const s = await readBytes(b);
assertEquals(s, data);
});
@@ -119,7 +120,7 @@ Deno.test("bufioBufReader", async function (): Promise<void> {
for (const readmaker of readMakers) {
for (const bufreader of bufreaders) {
for (const bufsize of bufsizes) {
- const read = readmaker.fn(stringsReader(text));
+ const read = readmaker.fn(new StringReader(text));
const buf = new BufReader(read, bufsize);
const s = await bufreader.fn(buf);
const debugStr =
@@ -136,7 +137,7 @@ Deno.test("bufioBufferFull", async function (): Promise<void> {
const longString =
"And now, hello, world! It is the time for all good men to come to the" +
" aid of their party";
- const buf = new BufReader(stringsReader(longString), MIN_READ_BUFFER_SIZE);
+ const buf = new BufReader(new StringReader(longString), MIN_READ_BUFFER_SIZE);
const decoder = new TextDecoder();
try {
@@ -156,7 +157,7 @@ Deno.test("bufioBufferFull", async function (): Promise<void> {
Deno.test("bufioReadString", async function (): Promise<void> {
const string = "And now, hello world!";
- const buf = new BufReader(stringsReader(string), MIN_READ_BUFFER_SIZE);
+ const buf = new BufReader(new StringReader(string), MIN_READ_BUFFER_SIZE);
const line = await buf.readString(",");
assert(line !== null);
@@ -248,7 +249,7 @@ Deno.test("bufioPeek", async function (): Promise<void> {
const p = new Uint8Array(10);
// string is 16 (minReadBufferSize) long.
const buf = new BufReader(
- stringsReader("abcdefghijklmnop"),
+ new StringReader("abcdefghijklmnop"),
MIN_READ_BUFFER_SIZE
);
@@ -453,7 +454,7 @@ Deno.test(
const decoder = new TextDecoder();
const data = "abcdefghijklmnopqrstuvwxyz";
const bufSize = 25;
- const b = new BufReader(stringsReader(data), bufSize);
+ const b = new BufReader(new StringReader(data), bufSize);
const r1 = (await b.readLine()) as ReadLineResult;
assert(r1 !== null);