Skip to content

Rewrite your app in Rust, piece by piece, checked against the original at every step. Works with TypeScript, JavaScript, Python, Go, Ruby, Java, C, PHP, C#, Kotlin, PowerShell and Swift.

fix(gate): say "has" for one export with no recorded case (#1441)

Parman Mohammadalizadeh4a8bd0c5a191
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 15c0378b..b1ddcd63 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+- `gate`'s `coverage` check says `1 of the unit's exports has no recorded case` when a single
+ export has none, instead of `have`; two or more keep `have` (#1302, #1441 by @MannXo).
- `bridge` on a C function named like a Rust keyword (`mod`, `match`, `where`) writes `r#mod` in
`port.rs`, in the `port::` calls and for the exported function in `lib.rs`, so the crate builds
and still exports the symbol `mod`; it used to write `fn mod` and fail to compile.
diff --git a/src/gate.rs b/src/gate.rs
index 4d7293f3..bee04ff1 100644
--- a/src/gate.rs
+++ b/src/gate.rs
@@ -2994,8 +2994,9 @@ fn coverage_check(crate_dir: &Path, manifest: &Manifest) -> Check {
name: "coverage",
passed: false,
detail: with_line(format!(
- "{} of the unit's exports have no recorded case: {}",
+ "{} of the unit's exports {} no recorded case: {}",
missing.len(),
+ if missing.len() == 1 { "has" } else { "have" },
named.join(", ")
)),
}
@@ -3417,7 +3418,7 @@ mod tests {
assert!(fix_for(&check("fmt", ""), dir).is_some_and(|f| f.starts_with("cargo fmt")));
assert!(
fix_for(
- &check("coverage", "1 of the unit's exports have no recorded case"),
+ &check("coverage", "1 of the unit's exports has no recorded case"),
dir
)
.is_some_and(|f| f.starts_with("rust-anything record port")
@@ -4845,7 +4846,7 @@ mod guard_tests {
assert!(
check
.detail
- .contains("1 of the unit's exports have no recorded case")
+ .contains("1 of the unit's exports has no recorded case")
);
assert!(
check.detail.contains("export:src/a.ts#g"),