Skip to main content

test

Attribute Macro test 

Source
#[test]
Expand description

#[guinea::test]: one test, run once per seed on a fresh app::Harness - which the test-utils feature brings. A test run once per seed, each time on a fresh Harness, with the order of everything it sets off decided by the seed.

A failing seed is named in the panic; SEED=<n> cargo test runs that order alone, and again.

exclusive = "key" runs it one at a time with every other test in the process that names the same key - for what a process has one of, a global store say, which tests on their own threads would otherwise fight over.

ⓘ
#[guinea::test(iterations = 200)]
fn the_latest_query_wins(h: &mut Harness) {
    h.install::<Search>(&()).unwrap();
    h.dispatch::<Results>().emit(Query("gu".into()));
    h.dispatch::<Results>().emit(Query("guinea".into()));
    h.settled();
    assert_eq!(h.state::<Results>().query, "guinea");
}