summaryrefslogtreecommitdiff
path: root/crates/tor-config/src/testing.rs
blob: eea34cd25392e34f2479f7fad546dec1372a41a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Helpers for testing configuration.

/// Assert that the specified error is the specified `kind` of
/// [`ConfigBuildError`](crate::ConfigBuildError).
#[macro_export]
macro_rules! assert_config_error {
    ($err:expr, $kind:tt, $expect_problem:expr) => {
        match $err {
            $crate::ConfigBuildError::$kind { problem, .. } => {
                assert_eq!(problem, $expect_problem);
            }
            _ => {
                panic!("unexpected error {:?}", $err);
            }
        }
    };
}