#cargo-test #testing #cargo-subcommand #unit-testing #test-output #unit-tests #testdox

bin+lib cargo-testdox

A Cargo 子命令,用于将您的测试名称打印为句子

2 个版本

0.1.1 2024 年 8 月 11 日
0.1.0 2024 年 8 月 10 日

#269Cargo 插件

Download history 158/week @ 2024-08-05 73/week @ 2024-08-12

231 每月下载量

MIT/Apache

9KB
137

Crate Docs CI Audit Maintenance

cargo-testdox

A Cargo 子命令,用于将您的 Rust 测试名称打印为句子。

安装

cargo install cargo-testdox

使用方法

在任何带有测试的 Rust 项目中,运行

cargo testdox

cargo-testdox 将首先调用 cargo test 运行您的测试,包括您给出的任何额外参数。然后它将显示每个测试的结果(通过、失败或忽略),测试名称格式化为句子。也就是说,下划线被替换为空格。

例如,以下测试

#[test]
fn it_works() {}

当使用 cargo-testdox 运行时将产生以下输出

 ✔ it works

如果测试失败,则会产生

 x it works

如果测试被忽略,则会产生

 ? it works

原因

因为 测试名称应该是句子

比较 gotestdox,一个用于 Go 测试的类似工具。

依赖项

~130KB