mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
16 lines
557 B
TypeScript
16 lines
557 B
TypeScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
import { includesNeedle } from "./includes_needle.ts";
|
|
import { assert } from "@std/assert";
|
|
|
|
Deno.test("includesNeedle()", () => {
|
|
const encoder = new TextEncoder();
|
|
const source = encoder.encode("deno.land");
|
|
const pattern = encoder.encode("deno");
|
|
|
|
assert(includesNeedle(source, pattern));
|
|
assert(includesNeedle(new Uint8Array([0, 1, 2, 3]), new Uint8Array([2, 3])));
|
|
|
|
assert(includesNeedle(source, pattern, -10));
|
|
assert(!includesNeedle(source, pattern, -1));
|
|
});
|