From b95f79d74cbcf3492abd95d4c90839e32f51399f Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Thu, 23 May 2019 19:04:06 -0700 Subject: io: refactor BufReader/Writer interfaces to be more idiomatic (denoland/deno_std#444) Thanks Vincent Le Goff (@zekth) for porting over the CSV reader implementation. Fixes: denoland/deno_std#436 Original: https://github.com/denoland/deno_std/commit/0ee6334b698072b50c6f5ac8d42d34dc4c94b948 --- http/racing_server_test.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'http/racing_server_test.ts') diff --git a/http/racing_server_test.ts b/http/racing_server_test.ts index cdcdca1a7..f98072c16 100644 --- a/http/racing_server_test.ts +++ b/http/racing_server_test.ts @@ -1,8 +1,8 @@ const { dial, run } = Deno; -import { test } from "../testing/mod.ts"; +import { test, runIfMain } from "../testing/mod.ts"; import { assert, assertEquals } from "../testing/asserts.ts"; -import { BufReader } from "../io/bufio.ts"; +import { BufReader, EOF } from "../io/bufio.ts"; import { TextProtoReader } from "../textproto/mod.ts"; let server; @@ -13,9 +13,8 @@ async function startServer(): Promise { }); // Once fileServer is ready it will write to its stdout. const r = new TextProtoReader(new BufReader(server.stdout)); - const [s, err] = await r.readLine(); - assert(err == null); - assert(s.includes("Racing server listening...")); + const s = await r.readLine(); + assert(s !== EOF && s.includes("Racing server listening...")); } function killServer(): void { server.close(); @@ -57,9 +56,10 @@ test(async function serverPipelineRace(): Promise { const outLines = output.split("\n"); // length - 1 to disregard last empty line for (let i = 0; i < outLines.length - 1; i++) { - const [s, err] = await r.readLine(); - assert(!err); + const s = await r.readLine(); assertEquals(s, outLines[i]); } killServer(); }); + +runIfMain(import.meta); -- cgit v1.2.3