refactor(bytes): format test names (#3986)

* initial commit

* updat test names
This commit is contained in:
Tim Reichen 2023-12-19 02:16:10 +01:00 committed by GitHub
parent 155664c9f8
commit 17eef1e62d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 25 additions and 25 deletions

View File

@ -2,7 +2,7 @@
import { assert, assertEquals } from "../assert/mod.ts";
import { concat } from "./concat.ts";
Deno.test("[bytes] concat", () => {
Deno.test("concat()", () => {
const encoder = new TextEncoder();
const u1 = encoder.encode("Hello ");
const u2 = encoder.encode("World");
@ -12,7 +12,7 @@ Deno.test("[bytes] concat", () => {
assert(u2 !== joined);
});
Deno.test("[bytes] concat empty arrays", () => {
Deno.test("concat() handles empty arrays", () => {
const u1 = new Uint8Array();
const u2 = new Uint8Array();
const joined = concat([u1, u2]);
@ -21,7 +21,7 @@ Deno.test("[bytes] concat empty arrays", () => {
assert(u2 !== joined);
});
Deno.test("[bytes] concat multiple Uint8Array", () => {
Deno.test("concat() handles multiple Uint8Array", () => {
const encoder = new TextEncoder();
const u1 = encoder.encode("Hello ");
const u2 = encoder.encode("W");
@ -35,7 +35,7 @@ Deno.test("[bytes] concat multiple Uint8Array", () => {
assert(u2 !== joined);
});
Deno.test("[bytes] concat an array of Uint8Array", () => {
Deno.test("concat() handles an array of Uint8Array", () => {
const a = [
new Uint8Array([0, 1, 2, 3]),
new Uint8Array([4, 5, 6]),

View File

@ -2,7 +2,7 @@
import { assert, assertEquals } from "../assert/mod.ts";
import { copy } from "./copy.ts";
Deno.test("[bytes] copy", function () {
Deno.test("copy()", function () {
const dst = new Uint8Array(4);
dst.fill(0);

View File

@ -3,7 +3,7 @@
import { assert } from "../assert/mod.ts";
import { endsWith } from "./ends_with.ts";
Deno.test("[bytes] endsWith", () => {
Deno.test("endsWith()", () => {
const v = endsWith(new Uint8Array([0, 1, 2]), new Uint8Array([1, 2]));
const v2 = endsWith(new Uint8Array([0, 1, 2]), new Uint8Array([0, 1]));
const v3 = endsWith(new Uint8Array([0, 1, 2]), new Uint8Array([0, 1, 2, 3]));

View File

@ -2,7 +2,7 @@
import { equals } from "./equals.ts";
import { assert } from "../assert/mod.ts";
Deno.test("[bytes] equals", () => {
Deno.test("equals()", () => {
const v = equals(new Uint8Array([0, 1, 2, 3]), new Uint8Array([0, 1, 2, 3]));
const v2 = equals(new Uint8Array([0, 1, 2, 2]), new Uint8Array([0, 1, 2, 3]));
const v3 = equals(new Uint8Array([0, 1, 2, 3]), new Uint8Array([0, 1, 2]));
@ -11,7 +11,7 @@ Deno.test("[bytes] equals", () => {
assert(!v3);
});
Deno.test("[bytes] equals randomized testing", () => {
Deno.test("equals() handles randomized testing", () => {
// run tests before and after cutoff
for (let len = 995; len <= 1005; len++) {
const arr1 = crypto.getRandomValues(new Uint8Array(len));

View File

@ -2,7 +2,7 @@
import { includesNeedle } from "./includes_needle.ts";
import { assert } from "../assert/mod.ts";
Deno.test("[bytes] includesNeedle", () => {
Deno.test("includesNeedle()", () => {
const encoder = new TextEncoder();
const source = encoder.encode("deno.land");
const pattern = encoder.encode("deno");

View File

@ -2,7 +2,7 @@
import { indexOfNeedle } from "./index_of_needle.ts";
import { assertEquals } from "../assert/mod.ts";
Deno.test("[bytes] indexOfNeedle1", () => {
Deno.test("indexOfNeedle() handles repeating occurence", () => {
const i = indexOfNeedle(
new Uint8Array([1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 3]),
new Uint8Array([0, 1, 2]),
@ -10,23 +10,23 @@ Deno.test("[bytes] indexOfNeedle1", () => {
assertEquals(i, 2);
});
Deno.test("[bytes] indexOfNeedle2", () => {
Deno.test("indexOfNeedle() handles single occurence", () => {
const i = indexOfNeedle(new Uint8Array([0, 0, 1]), new Uint8Array([0, 1]));
assertEquals(i, 1);
});
Deno.test("[bytes] indexOfNeedle3", () => {
Deno.test("indexOfNeedle() handles text encoded occurence", () => {
const encoder = new TextEncoder();
const i = indexOfNeedle(encoder.encode("Deno"), encoder.encode("D"));
assertEquals(i, 0);
});
Deno.test("[bytes] indexOfNeedle4", () => {
Deno.test("indexOfNeedle() handles missing occurence", () => {
const i = indexOfNeedle(new Uint8Array(), new Uint8Array([0, 1]));
assertEquals(i, -1);
});
Deno.test("[bytes] indexOfNeedle with start index", () => {
Deno.test("indexOfNeedle() returns index of occurence after start", () => {
const i = indexOfNeedle(
new Uint8Array([0, 1, 2, 0, 1, 2]),
new Uint8Array([0, 1]),
@ -35,7 +35,7 @@ Deno.test("[bytes] indexOfNeedle with start index", () => {
assertEquals(i, 3);
});
Deno.test("[bytes] indexOfNeedle with start index 2", () => {
Deno.test("indexOfNeedle() returns -1 if occurence is before start", () => {
const i = indexOfNeedle(
new Uint8Array([0, 1, 2, 0, 1, 2]),
new Uint8Array([0, 1]),
@ -44,7 +44,7 @@ Deno.test("[bytes] indexOfNeedle with start index 2", () => {
assertEquals(i, -1);
});
Deno.test("[bytes] indexOfNeedle with start index < 0", () => {
Deno.test("indexOfNeedle() handles start index less than 0", () => {
assertEquals(
indexOfNeedle(
new Uint8Array([0, 1, 2, 0, 1, 2]),

View File

@ -2,7 +2,7 @@
import { assertEquals } from "../assert/mod.ts";
import { lastIndexOfNeedle } from "./last_index_of_needle.ts";
Deno.test("[bytes] lastIndexOfNeedle1", () => {
Deno.test("lastIndexOfNeedle1() handles repeating occurence", () => {
const i = lastIndexOfNeedle(
new Uint8Array([0, 1, 2, 0, 1, 2, 0, 1, 3]),
new Uint8Array([0, 1, 2]),
@ -10,7 +10,7 @@ Deno.test("[bytes] lastIndexOfNeedle1", () => {
assertEquals(i, 3);
});
Deno.test("[bytes] lastIndexOfNeedle2", () => {
Deno.test("lastIndexOfNeedle() handles single occurence", () => {
const i = lastIndexOfNeedle(
new Uint8Array([0, 1, 1]),
new Uint8Array([0, 1]),
@ -18,12 +18,12 @@ Deno.test("[bytes] lastIndexOfNeedle2", () => {
assertEquals(i, 0);
});
Deno.test("[bytes] lastIndexOfNeedle3", () => {
Deno.test("lastIndexOfNeedle() handles missing occurence", () => {
const i = lastIndexOfNeedle(new Uint8Array(), new Uint8Array([0, 1]));
assertEquals(i, -1);
});
Deno.test("[bytes] lastIndexOfNeedle with start index", () => {
Deno.test("lastIndexOfNeedle() returns index of occurence after start", () => {
const i = lastIndexOfNeedle(
new Uint8Array([0, 1, 2, 0, 1, 2]),
new Uint8Array([0, 1]),
@ -32,7 +32,7 @@ Deno.test("[bytes] lastIndexOfNeedle with start index", () => {
assertEquals(i, 0);
});
Deno.test("[bytes] lastIndexOfNeedle with start index 2", () => {
Deno.test("lastIndexOfNeedle() returns -1 with too small start", () => {
const i = lastIndexOfNeedle(
new Uint8Array([0, 1, 2, 0, 1, 2]),
new Uint8Array([0, 1]),
@ -41,7 +41,7 @@ Deno.test("[bytes] lastIndexOfNeedle with start index 2", () => {
assertEquals(i, -1);
});
Deno.test("[bytes] lastIndexOfNeedle with start index greater than source index", () => {
Deno.test("lastIndexOfNeedle() returns index if start is greater than source index", () => {
const i = lastIndexOfNeedle(
new Uint8Array([0, 1, 2, 0, 1, 2]),
new Uint8Array([0, 1]),
@ -50,7 +50,7 @@ Deno.test("[bytes] lastIndexOfNeedle with start index greater than source index"
assertEquals(i, 3);
});
Deno.test("[bytes] lastIndexOfNeedle if needle doesn't exist within source", () => {
Deno.test("lastIndexOfNeedle() returns -1 if needle doesn't exist within source", () => {
const i = lastIndexOfNeedle(
new Uint8Array([0, 1, 2, 0, 1, 2]),
new Uint8Array([2, 3]),

View File

@ -2,7 +2,7 @@
import { assertEquals, assertThrows } from "../assert/mod.ts";
import { repeat } from "./repeat.ts";
Deno.test("[bytes] repeat", () => {
Deno.test("repeat()", () => {
// input / output / count / error message
const repeatTestCase = [
["", "", 0],

View File

@ -2,7 +2,7 @@
import { assert } from "../assert/mod.ts";
import { startsWith } from "./starts_with.ts";
Deno.test("[bytes] startsWith", () => {
Deno.test("startsWith()", () => {
const v = startsWith(new Uint8Array([0, 1, 2]), new Uint8Array([0, 1]));
const v2 = startsWith(new Uint8Array([0, 1, 2]), new Uint8Array([0, 2]));
const v3 = startsWith(