2024-01-01 21:11:32 +00:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2024-05-07 00:08:16 +00:00
|
|
|
import { AssertionError, assertNotMatch, assertThrows } from "./mod.ts";
|
2023-07-13 07:04:30 +00:00
|
|
|
|
2024-05-07 00:08:16 +00:00
|
|
|
Deno.test("assertNotMatch()", () => {
|
2023-07-13 07:04:30 +00:00
|
|
|
assertNotMatch("foobar.deno.com", RegExp(/[a-zA-Z]+@[a-zA-Z]+.com/));
|
|
|
|
});
|
|
|
|
|
2024-05-07 00:08:16 +00:00
|
|
|
Deno.test("assertNotMatch() throws", () => {
|
|
|
|
assertThrows(
|
|
|
|
() => assertNotMatch("Denosaurus from Jurassic", RegExp(/from/)),
|
|
|
|
AssertionError,
|
|
|
|
`Expected actual: "Denosaurus from Jurassic" to not match: "/from/".`,
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
Deno.test("assertNotMatch() throws with custom message", () => {
|
|
|
|
assertThrows(
|
|
|
|
() =>
|
|
|
|
assertNotMatch(
|
|
|
|
"Denosaurus from Jurassic",
|
|
|
|
RegExp(/from/),
|
|
|
|
"CUSTOM MESSAGE",
|
|
|
|
),
|
|
|
|
AssertionError,
|
|
|
|
`Expected actual: "Denosaurus from Jurassic" to not match: "/from/": CUSTOM MESSAGE`,
|
|
|
|
);
|
2023-07-13 07:04:30 +00:00
|
|
|
});
|