Error handling
module jyunth_addr::Sample4{
use std::debug::print;
use std::string::{String, utf8};
fun sample_abort_error(value: String){
if(value == utf8(b"jyunth"))
print(&utf8(b"Okay, all good."))
else
abort 123
}
fun sample_assert_error(value: String){
assert!(value == utf8(b"jyunth"), 123);
print(&utf8(b"Okay, all good."));
}
#[test]
#[expected_failure]
fun test_abort_error(){
sample_abort_error(utf8(b"jyunh"));
}
#[test]
#[expected_failure]
fun test_assert_error(){
sample_assert_error(utf8(b"jyunh"));
}
#[test]
fun test_assert2_error(){
sample_assert_error(utf8(b"jyunth"));
}
}