diff options
Diffstat (limited to 'std/io')
-rw-r--r-- | std/io/bufio_test.ts | 19 | ||||
-rw-r--r-- | std/io/ioutil_test.ts | 17 | ||||
-rw-r--r-- | std/io/readers_test.ts | 3 | ||||
-rw-r--r-- | std/io/util_test.ts | 3 | ||||
-rw-r--r-- | std/io/writers_test.ts | 3 |
5 files changed, 19 insertions, 26 deletions
diff --git a/std/io/bufio_test.ts b/std/io/bufio_test.ts index 780dfd3db..665c25361 100644 --- a/std/io/bufio_test.ts +++ b/std/io/bufio_test.ts @@ -5,7 +5,6 @@ const { Buffer } = Deno; type Reader = Deno.Reader; -import { test, runIfMain } from "../testing/mod.ts"; import { assert, assertEquals, @@ -43,7 +42,7 @@ async function readBytes(buf: BufReader): Promise<string> { return decoder.decode(b.subarray(0, nb)); } -test(async function bufioReaderSimple(): Promise<void> { +Deno.test(async function bufioReaderSimple(): Promise<void> { const data = "hello world"; const b = new BufReader(stringsReader(data)); const s = await readBytes(b); @@ -111,7 +110,7 @@ const bufsizes: number[] = [ 4096 ]; -test(async function bufioBufReader(): Promise<void> { +Deno.test(async function bufioBufReader(): Promise<void> { const texts = new Array<string>(31); let str = ""; let all = ""; @@ -139,7 +138,7 @@ test(async function bufioBufReader(): Promise<void> { } }); -test(async function bufioBufferFull(): Promise<void> { +Deno.test(async function bufioBufferFull(): Promise<void> { const longString = "And now, hello, world! It is the time for all good men to come to the" + " aid of their party"; @@ -160,7 +159,7 @@ test(async function bufioBufferFull(): Promise<void> { assertEquals(actual, "world!"); }); -test(async function bufioReadString(): Promise<void> { +Deno.test(async function bufioReadString(): Promise<void> { const string = "And now, hello world!"; const buf = new BufReader(stringsReader(string), MIN_READ_BUFFER_SIZE); @@ -242,12 +241,12 @@ async function testReadLine(input: Uint8Array): Promise<void> { } } -test(async function bufioReadLine(): Promise<void> { +Deno.test(async function bufioReadLine(): Promise<void> { await testReadLine(testInput); await testReadLine(testInputrn); }); -test(async function bufioPeek(): Promise<void> { +Deno.test(async function bufioPeek(): Promise<void> { const decoder = new TextDecoder(); const p = new Uint8Array(10); // string is 16 (minReadBufferSize) long. @@ -323,7 +322,7 @@ test(async function bufioPeek(): Promise<void> { */ }); -test(async function bufioWriter(): Promise<void> { +Deno.test(async function bufioWriter(): Promise<void> { const data = new Uint8Array(8192); for (let i = 0; i < data.byteLength; i++) { @@ -357,7 +356,7 @@ test(async function bufioWriter(): Promise<void> { } }); -test(async function bufReaderReadFull(): Promise<void> { +Deno.test(async function bufReaderReadFull(): Promise<void> { const enc = new TextEncoder(); const dec = new TextDecoder(); const text = "Hello World"; @@ -382,5 +381,3 @@ test(async function bufReaderReadFull(): Promise<void> { } } }); - -runIfMain(import.meta); diff --git a/std/io/ioutil_test.ts b/std/io/ioutil_test.ts index 26f307a6b..261f4def0 100644 --- a/std/io/ioutil_test.ts +++ b/std/io/ioutil_test.ts @@ -1,7 +1,6 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. const { Buffer } = Deno; type Reader = Deno.Reader; -import { test } from "../testing/mod.ts"; import { assertEquals } from "../testing/asserts.ts"; import { copyN, @@ -25,19 +24,19 @@ class BinaryReader implements Reader { } } -test(async function testReadShort(): Promise<void> { +Deno.test(async function testReadShort(): Promise<void> { const r = new BinaryReader(new Uint8Array([0x12, 0x34])); const short = await readShort(new BufReader(r)); assertEquals(short, 0x1234); }); -test(async function testReadInt(): Promise<void> { +Deno.test(async function testReadInt(): Promise<void> { const r = new BinaryReader(new Uint8Array([0x12, 0x34, 0x56, 0x78])); const int = await readInt(new BufReader(r)); assertEquals(int, 0x12345678); }); -test(async function testReadLong(): Promise<void> { +Deno.test(async function testReadLong(): Promise<void> { const r = new BinaryReader( new Uint8Array([0x00, 0x00, 0x00, 0x78, 0x12, 0x34, 0x56, 0x78]) ); @@ -45,7 +44,7 @@ test(async function testReadLong(): Promise<void> { assertEquals(long, 0x7812345678); }); -test(async function testReadLong2(): Promise<void> { +Deno.test(async function testReadLong2(): Promise<void> { const r = new BinaryReader( new Uint8Array([0, 0, 0, 0, 0x12, 0x34, 0x56, 0x78]) ); @@ -53,7 +52,7 @@ test(async function testReadLong2(): Promise<void> { assertEquals(long, 0x12345678); }); -test(async function testSliceLongToBytes(): Promise<void> { +Deno.test(async function testSliceLongToBytes(): Promise<void> { const arr = sliceLongToBytes(0x1234567890abcdef); const actual = readLong(new BufReader(new BinaryReader(new Uint8Array(arr)))); const expected = readLong( @@ -66,12 +65,12 @@ test(async function testSliceLongToBytes(): Promise<void> { assertEquals(actual, expected); }); -test(async function testSliceLongToBytes2(): Promise<void> { +Deno.test(async function testSliceLongToBytes2(): Promise<void> { const arr = sliceLongToBytes(0x12345678); assertEquals(arr, [0, 0, 0, 0, 0x12, 0x34, 0x56, 0x78]); }); -test(async function testCopyN1(): Promise<void> { +Deno.test(async function testCopyN1(): Promise<void> { const w = new Buffer(); const r = stringsReader("abcdefghij"); const n = await copyN(w, r, 3); @@ -79,7 +78,7 @@ test(async function testCopyN1(): Promise<void> { assertEquals(w.toString(), "abc"); }); -test(async function testCopyN2(): Promise<void> { +Deno.test(async function testCopyN2(): Promise<void> { const w = new Buffer(); const r = stringsReader("abcdefghij"); const n = await copyN(w, r, 11); diff --git a/std/io/readers_test.ts b/std/io/readers_test.ts index 474407427..e3aaad0a5 100644 --- a/std/io/readers_test.ts +++ b/std/io/readers_test.ts @@ -1,5 +1,4 @@ -const { copy } = Deno; -import { test } from "../testing/mod.ts"; +const { copy, test } = Deno; import { assertEquals } from "../testing/asserts.ts"; import { MultiReader, StringReader } from "./readers.ts"; import { StringWriter } from "./writers.ts"; diff --git a/std/io/util_test.ts b/std/io/util_test.ts index 472b0dfb9..f7179cd1e 100644 --- a/std/io/util_test.ts +++ b/std/io/util_test.ts @@ -1,6 +1,5 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -const { remove } = Deno; -import { test } from "../testing/mod.ts"; +const { remove, test } = Deno; import { assert, assertEquals } from "../testing/asserts.ts"; import * as path from "../path/mod.ts"; import { copyBytes, tempFile } from "./util.ts"; diff --git a/std/io/writers_test.ts b/std/io/writers_test.ts index decf611f1..916ad043e 100644 --- a/std/io/writers_test.ts +++ b/std/io/writers_test.ts @@ -1,5 +1,4 @@ -const { copy } = Deno; -import { test } from "../testing/mod.ts"; +const { copy, test } = Deno; import { assertEquals } from "../testing/asserts.ts"; import { StringWriter } from "./writers.ts"; import { StringReader } from "./readers.ts"; |