MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / format_err_macro_core_error_chain

Function format_err_macro_core_error_chain

crates/core/tests/tests.rs:279–297  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

277
278#[test]
279fn format_err_macro_core_error_chain() {
280 let error = ChainError::new("ouch", None);
281 let error = ChainError::new("yikes", Some(Box::new(error)));
282 let error = ChainError::new("whoops", Some(Box::new(error)));
283 let error = format_err!(error);
284
285 let mut chain = error.chain();
286
287 let e = chain.next().unwrap();
288 assert_eq!(e.to_string(), "whoops");
289
290 let e = chain.next().unwrap();
291 assert_eq!(e.to_string(), "yikes");
292
293 let e = chain.next().unwrap();
294 assert_eq!(e.to_string(), "ouch");
295
296 assert!(chain.next().is_none());
297}
298
299#[test]
300fn format_err_macro_msg() {

Callers

nothing calls this directly

Calls 4

chainMethod · 0.80
newFunction · 0.70
unwrapMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected