| 1 | //! Macros for defining extra assertions that should only be checked in testing |
| 2 | //! and/or CI when the `__testing_only_extra_assertions` feature is enabled. |
| 3 | |
| 4 | /// Simple macro that forwards to assert! when using |
| 5 | /// __testing_only_extra_assertions. |
| 6 | macro_rules! extra_assert { |
| 7 | ( $cond:expr ) => { |
| 8 | if cfg!(feature = "__testing_only_extra_assertions" ) { |
| 9 | assert!($cond); |
| 10 | } |
| 11 | }; |
| 12 | ( $cond:expr , $( $arg:tt )+ ) => { |
| 13 | if cfg!(feature = "__testing_only_extra_assertions" ) { |
| 14 | assert!($cond, $( $arg )* ) |
| 15 | } |
| 16 | }; |
| 17 | } |
| 18 | |