Skip to content

Commit

Permalink
test(stream): Verify capture behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Sep 28, 2023
1 parent 393b582 commit 9ac7b94
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions crates/anstream/tests/macros.rs
Original file line number Diff line number Diff line change
@@ -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()
);
}

0 comments on commit 9ac7b94

Please sign in to comment.