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

Function fmt_debug_with_single_cause

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

Source from the content-addressed store, hash-verified

675}
676#[test]
677fn fmt_debug_with_single_cause() {
678 let error = Error::msg("whoops").context("uh oh");
679 let actual = format!("{error:?}");
680
681 // NB: the causes are only numbered when there are multiple of them.
682 let expected = "\
683uh oh
684
685Caused by:
686 whoops
687";
688
689 #[cfg(feature = "backtrace")]
690 {
691 assert!(actual.starts_with(expected));
692 if let BacktraceStatus::Captured = error.backtrace().status() {
693 assert!(actual.contains("Stack backtrace:"));
694 }
695 }
696
697 #[cfg(not(feature = "backtrace"))]
698 {
699 assert_eq!(actual, expected);
700 }
701}
702
703#[test]
704fn fmt_debug_alternate() {

Callers

nothing calls this directly

Calls 4

msgFunction · 0.85
statusMethod · 0.80
backtraceMethod · 0.80
contextMethod · 0.45

Tested by

no test coverage detected