check-rust-coverage
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCheck Rust Coverage
检查Rust代码覆盖率
Determine which Rust lines are not covered by Rust tests.
确定哪些Rust代码行未被Rust测试覆盖。
Arguments
参数
- : Path to a Rust crate.
<path> - : Multiple crate paths.
<path 1> <path 2>
If a path doesn't include , assume it to be in the directory. E.g. becomes .
If a path points to a directory, consider all Rust crates in that directory.
src/src/redisearch_rsnumeric_range_treesrc/redisearch_rs/numeric_range_tree- :Rust crate的路径。
<path> - :多个crate路径。
<path 1> <path 2>
如果路径不包含,则默认其位于目录下。例如,会被解析为。
如果路径指向一个目录,则会包含该目录下的所有Rust crate。
src/src/redisearch_rsnumeric_range_treesrc/redisearch_rs/numeric_range_treeInstructions
操作步骤
Run
bash
cargo llvm-cov test --manifest-path <crate_directory>/Cargo.toml --quiet --json 2>/dev/null | jq -r '"Uncovered Lines:",
(.data[0].files[] |
select(.summary.lines.percent < 100) |
.filename as $f |
[.segments[] | select(.[2] == 0 and .[4] == true) | .[0]] |
unique |
if length > 0 then "\($f): \(join(", "))" else empty end
)'to get the list of uncovered lines for each file in the target crate.
运行
bash
cargo llvm-cov test --manifest-path <crate_directory>/Cargo.toml --quiet --json 2>/dev/null | jq -r '"Uncovered Lines:",
(.data[0].files[] |
select(.summary.lines.percent < 100) |
.filename as $f |
[.segments[] | select(.[2] == 0 and .[4] == true) | .[0]] |
unique |
if length > 0 then "\($f): \(join(", "))" else empty end
)'以获取目标crate中每个文件的未覆盖代码行列表。