MCPcopy Create free account
hub / github.com/denoland/std / assertMatch

Function assertMatch

assert/match.ts:21–30  ·  view source on GitHub ↗
(
  actual: string,
  expected: RegExp,
  msg?: string,
)

Source from the content-addressed store, hash-verified

19 * @param msg The optional message to display if the assertion fails.
20 */
21export function assertMatch(
22 actual: string,
23 expected: RegExp,
24 msg?: string,
25) {
26 if (expected.test(actual)) return;
27 const msgSuffix = msg ? `: ${msg}` : ".";
28 msg = `Expected actual: "${actual}" to match: "${expected}"${msgSuffix}`;
29 throw new AssertionError(msg);
30}

Callers 10

escape_test.tsFile · 0.90
toMatchFunction · 0.90
match_test.tsFile · 0.90
time_test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected