3 个版本 (重大更改)
0.3.0 | 2023年10月18日 |
---|---|
0.2.0 | 2023年9月14日 |
0.1.0 | 2023年4月18日 |
#459 in 测试
每月 68 次下载
用于 2 个工具包 (通过 wick-test)
12KB
285 行
tap-harness
这个库是一个包装器,用于编写以 Test Anything Protocol (TAP) 格式生成输出的测试。
用法
use tap_harness::{TestBlock, TestRunner};
fn main() -> anyhow::Result<()> {
let mut runner = TestRunner::new(Some("My test"));
let mut block = TestBlock::new(Some("My block"));
block.add_test(
|| 3 > 2,
"three is greater than two",
Some(vec!["three was not greater".to_owned()]),
);
block.add_test(
|| 3 < 2,
"three is less than two",
Some(vec!["three was not less than two".to_owned()]),
);
runner.add_block(block);
runner.run();
let lines = runner.get_tap_lines();
// or
runner.print();
Ok(())
}
这会打印
# My test
1..2
# My block
ok 1 three is greater than two
not ok 2 three is less than two
# three was not less than two
其他链接
依赖项
~22KB