FUNCTION

op.run_must_fail

function run_must_fail(): failure

Assert that this test operation call fails.

More precisely:

  1. Build a test block containing a single test transaction, which contains only this test operation call.
  2. Assert that the building fails (i.e. that invoking this test transaction call results in a thrown exception).

Since

0.10.4


function run_must_fail(expected_message: text): failure

Assert that this test operation call fails.

More precisely:

  1. Build a test block containing a single test transaction, which contains only this test operation call.
  2. Assert that the building fails (i.e. that invoking this test transaction call results in a thrown exception).

Checks that the given message is a substring of the thrown message. For example my_tx.run_must_fail('out of bounds') succeeds if an exception with message Run-time error: List index out of bounds: 0 (size 0) is thrown.

Parameters

  • expected_message — the expected substring of the error message

Since

0.11.0

© 2026 Chromia