diff --git a/crates/anstream/tests/macros.rs b/crates/anstream/tests/macros.rs new file mode 100644 index 00000000..f9df09c7 --- /dev/null +++ b/crates/anstream/tests/macros.rs @@ -0,0 +1,50 @@ +#[test] +#[cfg(feature = "auto")] +fn print() { + anstream::print!( + "{}This should be captured{}", + anstyle::AnsiColor::Red.on_default().render(), + anstyle::Reset.render() + ); +} + +#[test] +#[cfg(feature = "auto")] +fn println() { + anstream::println!( + "{}This should be captured{}", + anstyle::AnsiColor::Red.on_default().render(), + anstyle::Reset.render() + ); +} + +#[test] +#[cfg(feature = "auto")] +fn eprint() { + anstream::eprint!( + "{}This should be captured{}", + anstyle::AnsiColor::Red.on_default().render(), + anstyle::Reset.render() + ); +} + +#[test] +#[cfg(feature = "auto")] +fn eprintln() { + anstream::eprintln!( + "{}This should be captured{}", + anstyle::AnsiColor::Red.on_default().render(), + anstyle::Reset.render() + ); +} + +#[test] +#[cfg(feature = "auto")] +#[should_panic] +fn panic() { + anstream::panic!( + "{}This should be captured{}", + anstyle::AnsiColor::Red.on_default().render(), + anstyle::Reset.render() + ); +}