Attribute Macro sewup_derive::ewasm_test[][src]

#[ewasm_test]
Expand description

helps you setup the test mododule, and test cases in contract.

#[ewasm_test]
mod tests {
    use super::*;

    #[ewasm_test]
    fn test_execute_basic_operations() {
        ewasm_assert_ok!(contract_fn());
    }
}

The test runtime will be create in the module, and all the test case will use the same test runtime, if you can create more runtimes for testing by setup more test modules. You can setup a log file when running the test as following, then use sewup::ewasm_dbg! to debug the ewasm contract in the executing in the runtime.

#[ewasm_test(log=/path/to/logfile)]
mod tests {
    use super::*;

    #[ewasm_test]
    fn test_execute_basic_operations() {
        ewasm_assert_ok!(contract_fn());
    }
}