|
60 | 60 | #[macro_export] |
61 | 61 | macro_rules! print { |
62 | 62 | ($($arg:tt)*) => {{ |
63 | | - if cfg!(any(feature = "test", test)) { |
| 63 | + if cfg!(test) || $crate::_macros::FEATURE_TEST_ACTIVATED { |
64 | 64 | let target_stream = std::io::stdout(); |
65 | 65 | let buffer = $crate::_macros::to_adapted_string(&format_args!($($arg)*), &target_stream); |
66 | 66 | ::std::print!("{}", buffer) |
@@ -132,7 +132,7 @@ macro_rules! println { |
132 | 132 | $crate::print!("\n") |
133 | 133 | }; |
134 | 134 | ($($arg:tt)*) => {{ |
135 | | - if cfg!(any(feature = "test", test)) { |
| 135 | + if cfg!(test) || $crate::_macros::FEATURE_TEST_ACTIVATED { |
136 | 136 | let target_stream = std::io::stdout(); |
137 | 137 | let buffer = $crate::_macros::to_adapted_string(&format_args!($($arg)*), &target_stream); |
138 | 138 | ::std::println!("{}", buffer) |
@@ -183,7 +183,7 @@ macro_rules! println { |
183 | 183 | #[macro_export] |
184 | 184 | macro_rules! eprint { |
185 | 185 | ($($arg:tt)*) => {{ |
186 | | - if cfg!(any(feature = "test", test)) { |
| 186 | + if cfg!(test) || $crate::_macros::FEATURE_TEST_ACTIVATED { |
187 | 187 | let target_stream = std::io::stderr(); |
188 | 188 | let buffer = $crate::_macros::to_adapted_string(&format_args!($($arg)*), &target_stream); |
189 | 189 | ::std::eprint!("{}", buffer) |
@@ -237,7 +237,7 @@ macro_rules! eprintln { |
237 | 237 | $crate::eprint!("\n") |
238 | 238 | }; |
239 | 239 | ($($arg:tt)*) => {{ |
240 | | - if cfg!(any(feature = "test", test)) { |
| 240 | + if cfg!(test) || $crate::_macros::FEATURE_TEST_ACTIVATED { |
241 | 241 | let target_stream = std::io::stderr(); |
242 | 242 | let buffer = $crate::_macros::to_adapted_string(&format_args!($($arg)*), &target_stream); |
243 | 243 | ::std::eprintln!("{}", buffer) |
@@ -343,6 +343,9 @@ macro_rules! panic { |
343 | 343 | }}; |
344 | 344 | } |
345 | 345 |
|
| 346 | +#[cfg(feature = "auto")] |
| 347 | +pub const FEATURE_TEST_ACTIVATED: bool = cfg!(feature = "test"); |
| 348 | + |
346 | 349 | #[cfg(feature = "auto")] |
347 | 350 | pub fn to_adapted_string( |
348 | 351 | display: &dyn std::fmt::Display, |
|
0 commit comments