Closed 7flash closed 2 years ago
If you're using act
, then either assert or check inside a contract currently cause it to fail the test. If you're using expect
, then you can fail the test if the contract doesn't assert, or if it asserts with the wrong error message.
I assume you're talking about eosio_assert
or eosio::assert
. C++'s assert isn't fully supported.
Correct, when I do check inside of the contract and expect in unit test, then it shows failed cases properly.
But if I do "check(false)" inside of unit test, it seems to be ignored, and still showing test as passed.
Temporary workaround I do when I want to check some tables and assert unit test, is creating additional actions in smart contract and invoking them inside of expect handler. But would be better if I can check tables in assert in unit test file directly.
check(false) within a test aborts execution of the tester. That prevents it from printing any messages which say the test pass. It also causes the cltester executable to return a non-0 exit code.
i.e. check(false) aborts the currently-executing wasm, whether that wasm is a contract (which a test case can detect) or a test wasm (which the test wasm itself can't detect since it aborted).
You are right, that happens as expected, thanks for support!
Actually the reason I was this issue was because didn't recompile unit test after adding "check(false)", can be closed now
currently when check is failing in unit test, its still passing