diff options
Diffstat (limited to 'io')
| -rw-r--r-- | io/bufio.ts | 2 | ||||
| -rw-r--r-- | io/bufio_test.ts | 26 | ||||
| -rw-r--r-- | io/ioutil_test.ts | 2 | ||||
| -rw-r--r-- | io/writers_test.ts | 2 |
4 files changed, 14 insertions, 18 deletions
diff --git a/io/bufio.ts b/io/bufio.ts index 05e6b0a0c..33cddea2b 100644 --- a/io/bufio.ts +++ b/io/bufio.ts @@ -211,7 +211,7 @@ export class BufReader implements Reader { * delim. * For simple uses, a Scanner may be more convenient. */ - async readString(delim: string): Promise<string> { + async readString(_delim: string): Promise<string> { throw new Error("Not implemented"); } diff --git a/io/bufio_test.ts b/io/bufio_test.ts index 0a261daea..41151b681 100644 --- a/io/bufio_test.ts +++ b/io/bufio_test.ts @@ -6,7 +6,7 @@ const { Buffer } = Deno; import { Reader, ReadResult } from "deno"; import { test, assert, assertEqual } from "../testing/mod.ts"; -import { BufReader, BufState, BufWriter } from "./bufio.ts"; +import { BufReader, BufWriter } from "./bufio.ts"; import * as iotest from "./iotest.ts"; import { charCode, copyBytes, stringsReader } from "./util.ts"; @@ -34,7 +34,10 @@ test(async function bufioReaderSimple() { assert.equal(s, data); }); -type ReadMaker = { name: string; fn: (r: Reader) => Reader }; +interface ReadMaker { + name: string; + fn: (r: Reader) => Reader; +} const readMakers: ReadMaker[] = [ { name: "full", fn: r => r }, @@ -44,18 +47,6 @@ const readMakers: ReadMaker[] = [ // { name: "timeout", fn: r => new iotest.TimeoutReader(r) }, ]; -function readLines(b: BufReader): string { - let s = ""; - while (true) { - let s1 = b.readString("\n"); - if (s1 == null) { - break; // EOF - } - s += s1; - } - return s; -} - // Call read to accumulate the text of a file async function reads(buf: BufReader, m: number): Promise<string> { const b = new Uint8Array(1000); @@ -71,7 +62,10 @@ async function reads(buf: BufReader, m: number): Promise<string> { return decoder.decode(b.subarray(0, nb)); } -type NamedBufReader = { name: string; fn: (r: BufReader) => Promise<string> }; +interface NamedBufReader { + name: string; + fn: (r: BufReader) => Promise<string>; +} const bufreaders: NamedBufReader[] = [ { name: "1", fn: (b: BufReader) => reads(b, 1) }, @@ -187,6 +181,7 @@ async function testReadLine(input: Uint8Array): Promise<void> { if (err == "EOF") { break; } + // eslint-disable-next-line @typescript-eslint/restrict-plus-operands let want = testOutput.subarray(done, done + line.byteLength); assertEqual( line, @@ -290,6 +285,7 @@ test(async function bufioWriter() { const data = new Uint8Array(8192); for (let i = 0; i < data.byteLength; i++) { + // eslint-disable-next-line @typescript-eslint/restrict-plus-operands data[i] = charCode(" ") + (i % (charCode("~") - charCode(" "))); } diff --git a/io/ioutil_test.ts b/io/ioutil_test.ts index 168aad52a..08d0d677e 100644 --- a/io/ioutil_test.ts +++ b/io/ioutil_test.ts @@ -1,7 +1,7 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. const { Buffer } = Deno; import { Reader, ReadResult } from "deno"; -import { assert, assertEqual, runTests, test } from "../testing/mod.ts"; +import { assert, assertEqual, test } from "../testing/mod.ts"; import { copyN, readInt, diff --git a/io/writers_test.ts b/io/writers_test.ts index 94c58417d..ba4d7ed89 100644 --- a/io/writers_test.ts +++ b/io/writers_test.ts @@ -7,7 +7,7 @@ import { copyN } from "./ioutil.ts"; test(async function ioStringWriter() { const w = new StringWriter("base"); const r = new StringReader("0123456789"); - const n = await copyN(w, r, 4); + await copyN(w, r, 4); assert.equal(w.toString(), "base0123"); await copy(w, r); assert.equal(w.toString(), "base0123456789"); |
