You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For now it seems we cannot catch panics triggered by a call that triggers another smart call inside tests.
Example test: given_bad_params_when_create_market_then_fail.
// Create a market.let market_token = contract_address_const::<'market_token'>();// We use an invalid address as the index token.let index_token = contract_address_const::<0>();let long_token = contract_address_const::<'long_token'>();let short_token = contract_address_const::<'short_token'>();let market_type = 'market_type';let new_market = Market{ market_token, index_token, long_token, short_token,};// Try to create a market.// This must fail because the index token is invalid.// For now it seems we cannot catch the panic handling the result.// TODO: Find a way to catch the panic.// let result = market_factory.create_market(index_token, long_token, short_token, market_type);// match result {// // If the result is ok, then the test failed.// Result::Ok(_) => assert(false, 'bad_result'),// // If the result is err, then the test passed.// Result::Err(_) => {}// }
Description
For now it seems we cannot catch panics triggered by a call that triggers another smart call inside tests.
Example test:
given_bad_params_when_create_market_then_fail
.We should use Starknet Foundry should_panic when available in the release.
The text was updated successfully, but these errors were encountered: