summaryrefslogtreecommitdiff
path: root/std/io
diff options
context:
space:
mode:
Diffstat (limited to 'std/io')
-rw-r--r--std/io/bufio.ts3
-rw-r--r--std/io/bufio_test.ts12
-rw-r--r--std/io/ioutil_test.ts2
-rw-r--r--std/io/util_test.ts8
4 files changed, 13 insertions, 12 deletions
diff --git a/std/io/bufio.ts b/std/io/bufio.ts
index a944adfed..87613e341 100644
--- a/std/io/bufio.ts
+++ b/std/io/bufio.ts
@@ -212,8 +212,9 @@ export class BufReader implements Reader {
* For simple uses, a Scanner may be more convenient.
*/
async readString(delim: string): Promise<string | Deno.EOF> {
- if (delim.length !== 1)
+ if (delim.length !== 1) {
throw new Error("Delimiter should be a single character");
+ }
const buffer = await this.readSlice(delim.charCodeAt(0));
if (buffer == Deno.EOF) return Deno.EOF;
return new TextDecoder().decode(buffer);
diff --git a/std/io/bufio_test.ts b/std/io/bufio_test.ts
index ae38f6667..c1b1b856b 100644
--- a/std/io/bufio_test.ts
+++ b/std/io/bufio_test.ts
@@ -9,7 +9,7 @@ import {
assert,
assertEquals,
fail,
- assertNotEOF
+ assertNotEOF,
} from "../testing/asserts.ts";
import {
BufReader,
@@ -17,7 +17,7 @@ import {
BufferFullError,
PartialReadError,
readStringDelim,
- readLines
+ readLines,
} from "./bufio.ts";
import * as iotest from "./iotest.ts";
import { charCode, copyBytes, stringsReader } from "./util.ts";
@@ -55,9 +55,9 @@ const readMakers: ReadMaker[] = [
{ name: "full", fn: (r): Reader => r },
{
name: "byte",
- fn: (r): iotest.OneByteReader => new iotest.OneByteReader(r)
+ fn: (r): iotest.OneByteReader => new iotest.OneByteReader(r),
},
- { name: "half", fn: (r): iotest.HalfReader => new iotest.HalfReader(r) }
+ { name: "half", fn: (r): iotest.HalfReader => new iotest.HalfReader(r) },
// TODO { name: "data+err", r => new iotest.DataErrReader(r) },
// { name: "timeout", fn: r => new iotest.TimeoutReader(r) },
];
@@ -89,7 +89,7 @@ const bufreaders: NamedBufReader[] = [
{ name: "4", fn: (b: BufReader): Promise<string> => reads(b, 4) },
{ name: "5", fn: (b: BufReader): Promise<string> => reads(b, 5) },
{ name: "7", fn: (b: BufReader): Promise<string> => reads(b, 7) },
- { name: "bytes", fn: readBytes }
+ { name: "bytes", fn: readBytes },
// { name: "lines", fn: readLines },
];
@@ -104,7 +104,7 @@ const bufsizes: number[] = [
93,
128,
1024,
- 4096
+ 4096,
];
Deno.test(async function bufioBufReader(): Promise<void> {
diff --git a/std/io/ioutil_test.ts b/std/io/ioutil_test.ts
index 3d85a0fa1..d00986da5 100644
--- a/std/io/ioutil_test.ts
+++ b/std/io/ioutil_test.ts
@@ -7,7 +7,7 @@ import {
readInt,
readLong,
readShort,
- sliceLongToBytes
+ sliceLongToBytes,
} from "./ioutil.ts";
import { BufReader } from "./bufio.ts";
import { stringsReader } from "./util.ts";
diff --git a/std/io/util_test.ts b/std/io/util_test.ts
index 2fcad9305..17f11b945 100644
--- a/std/io/util_test.ts
+++ b/std/io/util_test.ts
@@ -4,7 +4,7 @@ import { assert, assertEquals } from "../testing/asserts.ts";
import * as path from "../path/mod.ts";
import { copyBytes, tempFile } from "./util.ts";
-test("[io/tuil] copyBytes", function(): void {
+test("[io/tuil] copyBytes", function (): void {
const dst = new Uint8Array(4);
dst.fill(0);
@@ -40,14 +40,14 @@ test("[io/tuil] copyBytes", function(): void {
test({
name: "[io/util] tempfile",
- fn: async function(): Promise<void> {
+ fn: async function (): Promise<void> {
const f = await tempFile(".", {
prefix: "prefix-",
- postfix: "-postfix"
+ postfix: "-postfix",
});
const base = path.basename(f.filepath);
assert(!!base.match(/^prefix-.+?-postfix$/));
f.file.close();
await remove(f.filepath);
- }
+ },
});