1 unstable release

0.1.0 Oct 31, 2023

#525 in Testing

Download history 9/week @ 2023-12-22 34/week @ 2023-12-29 30/week @ 2024-01-05 116/week @ 2024-01-12 53/week @ 2024-01-19 73/week @ 2024-01-26 38/week @ 2024-02-02 5/week @ 2024-02-09 62/week @ 2024-02-16 61/week @ 2024-02-23 22/week @ 2024-03-01 6/week @ 2024-03-08 6/week @ 2024-03-15 70/week @ 2024-03-22 36/week @ 2024-03-29

119 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

~335–790KB
~19K SLoC