Function assertMatch

  • Make an assertion that actual match RegExp expected. If not then throw.

    Parameters

    • actual: string

      The actual value to be matched.

    • expected: RegExp

      The expected pattern to match.

    • Optionalmsg: string

      The optional message to display if the assertion fails.

    Returns void

    import { assertMatch } from "@std/assert";

    assertMatch("Raptor", /Raptor/); // Doesn't throw
    assertMatch("Denosaurus", /Raptor/); // Throws