From 7d813cc193f39938d944cd7d51ae44ced46b7628 Mon Sep 17 00:00:00 2001 From: jaywcjlove Date: Tue, 15 Nov 2022 11:54:36 +0000 Subject: [PATCH] doc: add cargo test in cargo.md (#82) 823b3163d4afe58e968f21726834a19982a36eec --- CONTRIBUTORS.svg | 20 +++++++++++--------- docs/cargo.html | 15 +++++++++++---- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/CONTRIBUTORS.svg b/CONTRIBUTORS.svg index cdd8c615..055a8a40 100644 --- a/CONTRIBUTORS.svg +++ b/CONTRIBUTORS.svg @@ -20,23 +20,25 @@ + + - + - + - + - + - + - + - + - + - + \ No newline at end of file diff --git a/docs/cargo.html b/docs/cargo.html index 70b4fe37..77839a91 100644 --- a/docs/cargo.html +++ b/docs/cargo.html @@ -42,7 +42,7 @@

此快速参考备忘清单 Cargo 提供了编译 Rust 常用命令和示例

入门

安装/升级 Rust 和 Cargo

$ curl -sSf https://static.rust-lang.org/rustup.sh | sh
 
@@ -180,14 +180,21 @@ └── tests # 集成测试 └── some-integration-tests.rs -

编译测试

+

编译测试

# 编译输出二进制文件,放入 `target/debug` 目录
 $ cargo build
 # 输出二进制文件,放入 `target/release` 目录
 $ cargo build --release
 $ cargo run      # 编译并运行
-$ cargo test     # 运行您的测试
-$ cargo test foo # 传递过滤器,来运行特定测试
+
+

测试

+
$ cargo test     # 运行你的所有测试
+# 指定函数过滤器
+$ cargo test test_foo # 开头是 test_foo 的函数都会运行,例如(test_foo_bar)
+# 指定特定模块中的测试函数(通常可以简写 cargo test foo::bar::tests::test_foo)
+cargo test --package rustt --lib -- foo::bar::tests::test_foo --exact --nocapture
+# 指定特定测试的模块(通常可以简写 cargo test foo::bar::tests)
+cargo test --package rustt --lib -- foo::bar::tests --nocapture
 

配置目标