diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2019-03-10 04:30:38 +1100 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-03-09 12:30:38 -0500 |
commit | 034e2cc02829c9244b32232074c7a48af827a2fb (patch) | |
tree | bade01606a1ee076c1f753ce99c97ddb1e4edf30 /js/buffer_test.ts | |
parent | 8c7a12d1b258f0ef5ab27f49c424331d43e8d97f (diff) |
Migrate from tslint to eslint for linting (#1905)
Diffstat (limited to 'js/buffer_test.ts')
-rw-r--r-- | js/buffer_test.ts | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/js/buffer_test.ts b/js/buffer_test.ts index 691d97e20..90e171330 100644 --- a/js/buffer_test.ts +++ b/js/buffer_test.ts @@ -13,7 +13,7 @@ const N = 100; let testBytes: Uint8Array | null; let testString: string | null; -function init() { +function init(): void { if (testBytes == null) { testBytes = new Uint8Array(N); for (let i = 0; i < N; i++) { @@ -24,7 +24,7 @@ function init() { } } -function check(buf: Deno.Buffer, s: string) { +function check(buf: Deno.Buffer, s: string): void { const bytes = buf.bytes(); assertEquals(buf.length, bytes.byteLength); const decoder = new TextDecoder(); @@ -69,6 +69,13 @@ async function empty(buf: Buffer, s: string, fub: Uint8Array): Promise<void> { check(buf, ""); } +function repeat(c: string, bytes: number): Uint8Array { + assertEquals(c.length, 1); + const ui8 = new Uint8Array(bytes); + ui8.fill(c.charCodeAt(0)); + return ui8; +} + test(function bufferNewBuffer() { init(); const buf = new Buffer(testBytes.buffer as ArrayBuffer); @@ -140,7 +147,7 @@ test(async function bufferTooLargeByteWrites() { const growLen = Number.MAX_VALUE; const xBytes = repeat("x", 0); const buf = new Buffer(xBytes.buffer as ArrayBuffer); - const { nread, eof } = await buf.read(tmp); + await buf.read(tmp); let err; try { @@ -186,13 +193,6 @@ test(async function bufferReadFrom() { } }); -function repeat(c: string, bytes: number): Uint8Array { - assertEquals(c.length, 1); - const ui8 = new Uint8Array(bytes); - ui8.fill(c.charCodeAt(0)); - return ui8; -} - test(async function bufferTestGrow() { const tmp = new Uint8Array(72); for (let startLen of [0, 100, 1000, 10000, 100000]) { @@ -200,7 +200,7 @@ test(async function bufferTestGrow() { for (let growLen of [0, 100, 1000, 10000, 100000]) { const buf = new Buffer(xBytes.buffer as ArrayBuffer); // If we read, this affects buf.off, which is good to test. - const { nread, eof } = await buf.read(tmp); + const { nread } = await buf.read(tmp); buf.grow(growLen); const yBytes = repeat("y", growLen); await buf.write(yBytes); |