Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/monetize

crates/monetize-server/tests/one_plan_dressing.rs

//! ★ **A33-7: ONE dressing of a plan before the one lay** (`Cloud::lay`): the
//! release media and the templates are given to a plan in one function,
//! `estate_order::dress_plan`, which the first lay, the guardian's relay / a plan change and a
//! recharge all call — no copy of the dressing beside it.

#[test]
fn the_plan_is_dressed_in_one_place() {
    let src = |p: &str| std::fs::read_to_string(std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join(p)).unwrap();
    let calls = |text: &str, call: &str| text.matches(call).count();
    let media = ["give_release_media_as", "(&mut plan"].concat();
    let templates = ["give_templates_as", "(&mut plan"].concat();
    for f in ["src/estate_order.rs", "src/estate_order/relay.rs", "src/estate_order/sold.rs"] {
        let t = src(f);
        let dressed_here = calls(&t, &media) + calls(&t, &templates);
        let allowed = 0;
        assert_eq!(dressed_here, allowed, "{f} dresses a plan itself ({dressed_here}): it calls dress_plan");
    }
    assert!(src("src/estate_order.rs").contains("pub(crate) fn dress_plan("), "the one dressing");
}