Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use log::debug;
use owo_colors::OwoColorize;

const STATUS_OK: &str = "✓";
const STATUS_ERR: &str = "✗";

pub fn assert_with_status(label: &str, f: impl FnOnce() -> Result<(), anyhow::Error>) {
    match f() {
        Ok(_) => {
            println!("{} {}", STATUS_OK.bold().green(), label);
        }
        Err(e) => {
            println!("{} {} - {}", STATUS_ERR.bold().red(), label, e.to_string());
            debug!("Assertion failed: {}", e);
        }
    }
}