run-rust-tests
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRust Test Skill
Rust 测试技能
Run Rust tests after making changes to verify correctness.
修改代码后运行Rust测试以验证正确性。
Arguments
参数
- No arguments: Analyze changes and run tests for affected crates only
- : Run all Rust tests
all - : Run tests for specific crate (e.g.,
<crate>)/run-rust-tests hyperloglog - : Run specific test in crate (e.g.,
<crate> <test>)/run-rust-tests hyperloglog test_merge
Arguments provided:
$ARGUMENTS- 无参数:分析变更并仅对受影响的crate运行测试
- :运行所有Rust测试
all - :对指定crate运行测试(例如:
<crate>)/run-rust-tests hyperloglog - :运行crate中的指定测试(例如:
<crate> <test>)/run-rust-tests hyperloglog test_merge
提供的参数:
$ARGUMENTSUsage
使用方法
Run this skill after modifying Rust code to ensure tests pass.
修改Rust代码后运行此技能,确保测试通过。
Instructions
操作步骤
- Check the arguments provided above:
- If arguments are empty, determine affected crates:
- Check which files were modified in using
src/redisearch_rs/andgit statusgit diff --name-only - Map each modified file to its crate (the directory name directly under , e.g.,
src/redisearch_rs/→src/redisearch_rs/hyperloglog/src/lib.rs)hyperloglog - Run tests for each affected crate:
bash
cd src/redisearch_rs && cargo nextest run -p <crate1> -p <crate2> ... - If no Rust files were modified in , or if you cannot determine affected crates, run all tests
src/redisearch_rs/
- Check which files were modified in
- If is provided, run all Rust tests:
allbashcd src/redisearch_rs && cargo nextest run - If a crate name is provided, run tests for that crate:
bash
cd src/redisearch_rs && cargo nextest run -p <crate_name> - If both crate and test name are provided, run the specific test:
bash
cd src/redisearch_rs && cargo nextest run -p <crate_name> <test_name>
- If arguments are empty, determine affected crates:
- If tests fail:
- Read the error output carefully
- Fix the failing tests or the code causing failures
- Re-run tests to verify the fix
- 检查上述提供的参数:
- 如果参数为空,确定受影响的crate:
- 使用和
git status检查git diff --name-only中哪些文件被修改src/redisearch_rs/ - 将每个修改的文件映射到对应的crate(即下的直接目录名,例如
src/redisearch_rs/→src/redisearch_rs/hyperloglog/src/lib.rs)hyperloglog - 对每个受影响的crate运行测试:
bash
cd src/redisearch_rs && cargo nextest run -p <crate1> -p <crate2> ... - 如果中没有Rust文件被修改,或者无法确定受影响的crate,则运行所有测试
src/redisearch_rs/
- 使用
- 如果提供了,运行所有Rust测试:
allbashcd src/redisearch_rs && cargo nextest run - 如果提供了crate名称,对该crate运行测试:
bash
cd src/redisearch_rs && cargo nextest run -p <crate_name> - 如果同时提供了crate和测试名称,运行指定测试:
bash
cd src/redisearch_rs && cargo nextest run -p <crate_name> <test_name>
- 如果参数为空,确定受影响的crate:
- 如果测试失败:
- 仔细阅读错误输出
- 修复失败的测试或导致失败的代码
- 重新运行测试以验证修复结果
Common Test Commands
常用测试命令
bash
undefinedbash
undefinedTest specific crate
测试指定crate
cd src/redisearch_rs && cargo nextest run -p hyperloglog
cd src/redisearch_rs && cargo nextest run -p inverted_index
cd src/redisearch_rs && cargo nextest run -p trie_rs
cd src/redisearch_rs && cargo nextest run -p hyperloglog
cd src/redisearch_rs && cargo nextest run -p inverted_index
cd src/redisearch_rs && cargo nextest run -p trie_rs
Run a specific test
运行指定测试
cd src/redisearch_rs && cargo nextest run -p <crate_name> <test_name>
cd src/redisearch_rs && cargo nextest run -p <crate_name> <test_name>
Run tests under miri (for undefined behavior detection)
在miri下运行测试(用于检测未定义行为)
cd src/redisearch_rs && cargo +nightly miri test
undefinedcd src/redisearch_rs && cargo +nightly miri test
undefined