diff options
| author | axetroy <troy450409405@gmail.com> | 2019-05-24 20:24:04 +0800 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2019-05-24 15:40:32 +0300 |
| commit | c6505c5de6cb39b8134003658dfff43098f2993f (patch) | |
| tree | 8eaf20e23ad0b7dde8b41e9fa3ded1188f90b1a8 /bytes/bytes_test.ts | |
| parent | 4ab0e0e9187c77244ddff11c389e0b39bda8fe4d (diff) | |
remove function prefix of bytes module
Original: https://github.com/denoland/deno_std/commit/a4579426783f36cd5e46c4ebfb75ef702b2a15ba
Diffstat (limited to 'bytes/bytes_test.ts')
| -rw-r--r-- | bytes/bytes_test.ts | 47 |
1 files changed, 16 insertions, 31 deletions
diff --git a/bytes/bytes_test.ts b/bytes/bytes_test.ts index 8ca4cb386..e53f81fcd 100644 --- a/bytes/bytes_test.ts +++ b/bytes/bytes_test.ts @@ -1,58 +1,46 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { - bytesFindIndex, - bytesFindLastIndex, - bytesEqual, - bytesHasPrefix, - bytesRepeat -} from "./bytes.ts"; +import { findIndex, findLastIndex, equal, hasPrefix, repeat } from "./bytes.ts"; import { test } from "../testing/mod.ts"; import { assertEquals, assertThrows } from "../testing/asserts.ts"; -test(function bytesBytesFindIndex1(): void { - const i = bytesFindIndex( +test(function bytesfindIndex1(): void { + const i = findIndex( new Uint8Array([1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 3]), new Uint8Array([0, 1, 2]) ); assertEquals(i, 2); }); -test(function bytesBytesFindIndex2(): void { - const i = bytesFindIndex(new Uint8Array([0, 0, 1]), new Uint8Array([0, 1])); +test(function bytesfindIndex2(): void { + const i = findIndex(new Uint8Array([0, 0, 1]), new Uint8Array([0, 1])); assertEquals(i, 1); }); -test(function bytesBytesFindLastIndex1(): void { - const i = bytesFindLastIndex( +test(function bytesfindLastIndex1(): void { + const i = findLastIndex( new Uint8Array([0, 1, 2, 0, 1, 2, 0, 1, 3]), new Uint8Array([0, 1, 2]) ); assertEquals(i, 3); }); -test(function bytesBytesFindLastIndex2(): void { - const i = bytesFindLastIndex( - new Uint8Array([0, 1, 1]), - new Uint8Array([0, 1]) - ); +test(function bytesfindLastIndex2(): void { + const i = findLastIndex(new Uint8Array([0, 1, 1]), new Uint8Array([0, 1])); assertEquals(i, 0); }); -test(function bytesBytesBytesEqual(): void { - const v = bytesEqual( - new Uint8Array([0, 1, 2, 3]), - new Uint8Array([0, 1, 2, 3]) - ); +test(function bytesBytesequal(): void { + const v = equal(new Uint8Array([0, 1, 2, 3]), new Uint8Array([0, 1, 2, 3])); assertEquals(v, true); }); -test(function bytesBytesHasPrefix(): void { - const v = bytesHasPrefix(new Uint8Array([0, 1, 2]), new Uint8Array([0, 1])); +test(function byteshasPrefix(): void { + const v = hasPrefix(new Uint8Array([0, 1, 2]), new Uint8Array([0, 1])); assertEquals(v, true); }); -test(function bytesBytesRepeat(): void { +test(function bytesrepeat(): void { // input / output / count / error message const repeatTestCase = [ ["", "", 0], @@ -69,16 +57,13 @@ test(function bytesBytesRepeat(): void { if (errMsg) { assertThrows( (): void => { - bytesRepeat( - new TextEncoder().encode(input as string), - count as number - ); + repeat(new TextEncoder().encode(input as string), count as number); }, Error, errMsg as string ); } else { - const newBytes = bytesRepeat( + const newBytes = repeat( new TextEncoder().encode(input as string), count as number ); |
