1 unstable release

0.1.0 Oct 31, 2023

#557 in Testing

Download history 40/week @ 2024-01-06 110/week @ 2024-01-13 53/week @ 2024-01-20 69/week @ 2024-01-27 40/week @ 2024-02-03 2/week @ 2024-02-10 78/week @ 2024-02-17 56/week @ 2024-02-24 13/week @ 2024-03-02 5/week @ 2024-03-09 6/week @ 2024-03-16 79/week @ 2024-03-23 42/week @ 2024-03-30 10/week @ 2024-04-06 5/week @ 2024-04-13 8/week @ 2024-04-20

75 downloads per month

Apache-2.0 OR MIT

12KB
118 lines

Flowtest

Tests that depend on other tests

See the docs for details.

Example

#[test]
#[flowtest]
fn init_complex_type() -> i32 {
    // test that initialization works for our complex type
    if false { panic!("oh no!") };
    42
}

#[test]
#[flowtest(init_complex_type: value)]
fn mutate_complex_type() -> Result<i32, ComplexTypeInitFailed> {
    // mutate our type in a way that could fail
    if false {
        Err(ComplexTypeInitFailed)
    } else {
        Ok(value + 5)
    }
}

#[test]
#[flowtest(init_complex_type: value)]
fn mutate_complex_type_differently() -> i32 {
    // mutate our type in a different way
    if false {
        panic!("oh no!")
    } else {
        Ok(value + 5)
    }
}

#[test]
#[flowtest(
    mutate_complex_type,
    mutate_complex_type_differently,
)]
fn ensure_mutations_are_consistent() {
    assert_eq!(mutate_complex_type, mutate_complex_type_differently);
}

lib.rs:

Tests that depend on other tests

Example

#[test]
#[flowtest]
fn init_complex_type() -> i32 {
    // test that initialization works for our complex type
    if false { panic!("oh no!") };
    42
}

#[test]
#[flowtest(init_complex_type: value)]
fn mutate_complex_type() -> Result<i32, ComplexTypeInitFailed> {
    // mutate our type in a way that could fail
    if false {
        Err(ComplexTypeInitFailed)
    } else {
        Ok(value + 5)
    }
}

#[test]
#[flowtest(init_complex_type: value)]
fn mutate_complex_type_differently() -> i32 {
    // mutate our type in a different way
    if false {
        panic!("oh no!")
    } else {
        Ok(value + 5)
    }
}

#[test]
#[flowtest(
    mutate_complex_type,
    mutate_complex_type_differently,
)]
fn ensure_mutations_are_consistent() {
    assert_eq!(mutate_complex_type, mutate_complex_type_differently);
}

For details see #[flowtest].

Dependencies

~310–760KB
~18K SLoC