A comprehensive declarative macro, for concisely defining parameterized tests.
This crate provides the declarative macro of its namesake, test_gen
,
which enables the concise definition of batches of named tests,
implementing a parameterized argument format to minimise the boilerplate
otherwise required for specifying batches of similar tests.
Documentation can be found at [Docs.rs].
Minimum Supported Rust Version: 1.61.0
test_gen
can be included, by adding this to your Cargo.toml
:
toml
[dev-dependancies]
test_gen = "0.1.0"
Fruits: ```rust use test_gen::*;
enum Fruit
enum BrambleFruit { BlackBerry, }
trait NameOf { fn name_of(&self) -> &str; }
impl
match self {
Apple => "apple",
Pear => "pear",
Other(fruit) => fruit.name_of(),
}
}
}
impl NameOf for BrambleFruit { fn name_of(&self) -> &str { use BrambleFruit::*;
match self {
BlackBerry => "blackberry",
}
}
}
// Helper function
fn assertfruit
// Test specification
testgen! {
// Normal turbofish syntax can be used,
// when concrete type specification is required
assertfruit::
test_gen
is licensed under the BSD 3-Clause license.
See LICENSE for details.