frondeus / test-case

Rust procedural macro attribute for adding test cases easily
MIT License
614 stars 39 forks source link

Add `is (not) empty` #82

Closed luke-biel closed 2 years ago

luke-biel commented 2 years ago

As an user of test case I want to be able to test whether actual value is empty within complex assertions, eg.:

#[test_case("1" => is empty)] // fails
#[test_case("" => is empty)] // succeeds
fn test_this(s: &str) -> &str {
    s
}

We can rely on #expr.is_empty() and that user supplies a type that has such function.