mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
test(bytes): add test for negative start
index for indexOfNeedle()
(#4768)
tests(bytes): add test for negative `start` index for `indexOfNeedle()`
This commit is contained in:
parent
2fd7126cea
commit
2cc21194aa
@ -62,3 +62,22 @@ Deno.test("indexOfNeedle() handles start index less than 0", () => {
|
||||
-1,
|
||||
);
|
||||
});
|
||||
|
||||
Deno.test("indexOfNeedle() handles negative start index", () => {
|
||||
assertEquals(
|
||||
indexOfNeedle(
|
||||
new Uint8Array([0, 1, 2, 0, 1, 2]),
|
||||
new Uint8Array([0, 1]),
|
||||
-3,
|
||||
),
|
||||
3,
|
||||
);
|
||||
assertEquals(
|
||||
indexOfNeedle(
|
||||
new Uint8Array([0, 1, 2, 1, 1, 2]),
|
||||
new Uint8Array([0, 1]),
|
||||
-3,
|
||||
),
|
||||
-1,
|
||||
);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user