Function assertLessOrEqual

  • Make an assertion that actual is less than or equal to expected. If not then throw.

    Type Parameters

    • T

      The type of the values to compare.

    Parameters

    • actual: T

      The actual value to compare.

    • expected: T

      The expected value to compare.

    • Optionalmsg: string

      The optional message to display if the assertion fails.

    Returns void

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

    assertLessOrEqual(1, 2); // Doesn't throw
    assertLessOrEqual(1, 1); // Doesn't throw
    assertLessOrEqual(1, 0); // Throws