Expand description
testgen
This library is still very early in development!
Generate simple tests with testgen
!
Examples
extern crate testgen;
use testgen::{fail, multi_fail, multi_pass, pass};
#[pass(name="optional", 1 => 2)]
#[multi_fail(1 => 1, 2 => 2, 3 => 3)]
fn add_one(n: i32) -> i32 {
n + 1
}
// Multiple arguments are passed in like a tuple.
// Though to use an actual tuple use `((a, b))`.
// Single-argument functions can have the parenthesis elided in most cases.
#[multi_pass((1, 2) => 3, (3, 4) => 7)]
#[fail((1, 2) => 10)]
fn add(n: i32, m: i32) -> i32 {
n + m
}
fn main() {}
Attribute Macros
Test for a single input => is not expected. Good for quick sanity
checks. Optionally named.
Generates a test function that
assert_eq!
s the before and after
expressions given.Declares multiple
assert_eq!
s that should cause the function to panic.
Optionally named.Generates multiple
assert_eq!
s that should all pass. Optionally named.Test for a single input => expected. Good for quick sanity checks.
Optionally named.