macro_rules! capture {
($eval:stmt) => { ... };
}Expand description
Macro to capture stdout and stderr during the evaluation of a statement
let (out, err) = capture!{{
println!("stdout example");
eprint!("stderr example");
}};
assert_eq!("stdout example\n", out);
assert_eq!("stderr example", err);