deno.land / std@0.167.0 / bytes / includes_needle_test.ts

includes_needle_test.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.import { includesNeedle } from "./includes_needle.ts";import { assert } from "../testing/asserts.ts";
Deno.test("[bytes] 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));});
std

Version Info

Tagged at
a year ago