mirror of
https://github.com/eyre-rs/eyre.git
synced 2025-10-02 07:21:36 +00:00

git-subtree-dir: color-eyre git-subtree-mainline: 0b24ae558f4779afccb1dfc4640c57d9922ff70e git-subtree-split: 4a7b4d6988c6b0da5e04e29c9d6e10595b5dc302
24 lines
783 B
Rust
24 lines
783 B
Rust
#[cfg(target_arch = "wasm32")]
|
|
#[wasm_bindgen_test::wasm_bindgen_test]
|
|
pub fn color_eyre_simple() {
|
|
use color_eyre::eyre::WrapErr;
|
|
use color_eyre::*;
|
|
|
|
install().expect("Failed to install color_eyre");
|
|
let err_str = format!(
|
|
"{:?}",
|
|
Err::<(), Report>(eyre::eyre!("Base Error"))
|
|
.note("A note")
|
|
.suggestion("A suggestion")
|
|
.wrap_err("A wrapped error")
|
|
.unwrap_err()
|
|
);
|
|
// Print it out so if people run with `-- --nocapture`, they
|
|
// can see the full message.
|
|
println!("Error String is:\n\n{}", err_str);
|
|
assert!(err_str.contains("A wrapped error"));
|
|
assert!(err_str.contains("A suggestion"));
|
|
assert!(err_str.contains("A note"));
|
|
assert!(err_str.contains("Base Error"));
|
|
}
|