snapbox_macros/
lib.rs

1#![cfg_attr(docsrs, feature(doc_cfg))]
2#![warn(clippy::print_stderr)]
3#![warn(clippy::print_stdout)]
4
5#[cfg(feature = "color")]
6pub use anstream::eprint;
7#[cfg(feature = "color")]
8pub use anstream::eprintln;
9#[cfg(not(feature = "color"))]
10pub use std::eprint;
11#[cfg(not(feature = "color"))]
12pub use std::eprintln;
13
14/// Feature-flag controlled additional test debug information
15#[cfg(feature = "debug")]
16#[macro_export]
17macro_rules! debug {
18    ($($arg:tt)*) => ({
19        #![allow(unexpected_cfgs)]  // HACK: until we upgrade the minimum anstream
20        $crate::eprint!("[{:>w$}] \t", module_path!(), w = 28);
21        $crate::eprintln!($($arg)*);
22    })
23}
24
25/// Feature-flag controlled additional test debug information
26#[cfg(not(feature = "debug"))]
27#[macro_export]
28macro_rules! debug {
29    ($($arg:tt)*) => {};
30}
31
32#[doc = include_str!("../README.md")]
33#[cfg(doctest)]
34pub struct ReadmeDoctests;