File: extra_assertions.rs

package info (click to toggle)
rust-bindgen 0.71.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,384 kB
  • sloc: makefile: 8
file content (17 lines) | stat: -rw-r--r-- 572 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Macros for defining extra assertions that should only be checked in testing
//! and/or CI when the `__testing_only_extra_assertions` feature is enabled.

/// Simple macro that forwards to assert! when using
/// `__testing_only_extra_assertions`.
macro_rules! extra_assert {
    ( $cond:expr ) => {
        if cfg!(feature = "__testing_only_extra_assertions") {
            assert!($cond);
        }
    };
    ( $cond:expr , $( $arg:tt )+ ) => {
        if cfg!(feature = "__testing_only_extra_assertions") {
            assert!($cond, $( $arg )* )
        }
    };
}