Skip to content
Topaz6.0 · Before release
Download

Search documentation

Specification 6.0 · Not released · Tested product 5.21.3

Use arrow keys to choose a result. Press Enter to open.

Type an API name, diagnostic number, rule, or project topic.

    Diagnostics

    TPZ4007: Assertion failed

    A std.test assertion evaluated to failure.

    Diagnostic and cause

    Link

    Assertion failed

    Family
    topaz
    Phase
    run
    Code
    TPZ4007

    Cause and conditions

    std.test.assertEq compares its two values. Equal integer arguments complete successfully; unequal integer arguments fail at runtime with TPZ4007 at the assertion call.

    Response

    Inspect both the program result and the assertion. Correct the program when its result is wrong; change the assertion when its intended expectation is wrong.

    Source evidence

    Compiler phase: runtime.

    Compiler explanation: A std.test assertion evaluated to failure.

    Message templates are Pending. The explanation above is not an observed CLI message.

    Observed for the candidate in Topaz 5.21.3. Execution

    • error[TPZ4007]: assertEq failed: actual 1 != expected 2

    std.test.assertEq compares its two values. Equal integer arguments complete successfully; unequal integer arguments fail at runtime with TPZ4007 at the assertion call.

    Rulediagnostics.tpz4007.p5.rule

    Equality assertions require equal values

    std.test.assertEq compares its two values. Equal integer arguments complete successfully; unequal integer arguments fail at runtime with TPZ4007 at the assertion call.

    Source evidence

    Response

    Link

    Inspect both the program result and the assertion. Correct the program when its result is wrong; change the assertion when its intended expectation is wrong.

    Reproduction and verification

    Link

    Rejected program

    Link
    example.tpzRejected program
    1. import std.test as Test
    2. Test.assertEq(1, 2)
    Expected outputNonzero exit
    No stdout.
    $ topaz run example.tpz · target product 5.21.3
    Expected result

    Expected result

    Rejection during run. Nonzero exit.

    • TPZ4007 diagnostics-tpz4007 at example.tpz:2:1

    Run the paired runtime product assertions with TOPAZ_BIN set using node docs/topaz-reference/templates/diagnostics-p5-runtime.product.mjs. The shared example observer currently evaluates check diagnostics.

    Source evidence

    Repaired program

    Link
    example.tpzRepaired program
    1. import std.test as Test
    2. Test.assertEq(1, 1)
    Expected outputexit 0
    No stdout.
    $ topaz run example.tpz · target product 5.21.3
    Expected result

    Expected result

    Execution completes. Exit code 0.

    Run the paired runtime product assertions with TOPAZ_BIN set using node docs/topaz-reference/templates/diagnostics-p5-runtime.product.mjs. The shared example observer currently evaluates check diagnostics.

    Source evidence

    Menu

    Download