archunit

Macro assert_passes

Source
macro_rules! assert_passes {
    ($rule:expr $(,)?) => { ... };
    ($rule:expr, $options:expr $(,)?) => { ... };
}
Expand description

Asserts that an architecture rule produces no violations.

The optional second argument is a CheckOptions expression. The rule is evaluated exactly once and borrowed, so completed terminals remain reusable. Both architecture violations and check errors become one assertion failure formatted by the shared testing layer.

ยงExamples

use archunit::{CheckOptions, assert_passes, project_files};

let rule = project_files().in_folder("src/**").should().have_no_cycles();
assert_passes!(rule);

let options = CheckOptions::new().with_test_sources(true);
assert_passes!(rule, options);