summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/architecture-budget.json18
-rw-r--r--tests/architecture.rs21
2 files changed, 30 insertions, 9 deletions
diff --git a/tests/architecture-budget.json b/tests/architecture-budget.json
index d806fbf..7a7f7d1 100644
--- a/tests/architecture-budget.json
+++ b/tests/architecture-budget.json
@@ -94,7 +94,7 @@
"glob": 0,
"largest": 364,
"largest_file": "src/db/candidates.rs",
- "lines": 3905,
+ "lines": 3917,
"priv": 10,
"pub": 200,
"test": 10
@@ -246,9 +246,9 @@
"dead": 9,
"deadonly": 2,
"glob": 0,
- "largest": 484,
+ "largest": 490,
"largest_file": "src/sandbox/kata.rs",
- "lines": 1312,
+ "lines": 1329,
"priv": 16,
"pub": 21,
"test": 7
@@ -257,9 +257,9 @@
"dead": 12,
"deadonly": 8,
"glob": 0,
- "largest": 610,
+ "largest": 618,
"largest_file": "src/shims/mod.rs",
- "lines": 610,
+ "lines": 618,
"priv": 0,
"pub": 19,
"test": 4
@@ -310,10 +310,10 @@
}
},
"test_surface": {
- "already-gated": 13,
- "residue": 33,
+ "already-gated": 17,
+ "residue": 29,
"total": 46,
- "ungated": 33
+ "ungated": 29
},
"totals": {
"dead": 84,
@@ -322,7 +322,7 @@
"glob": 0,
"largest": 673,
"largest_file": "src/config.rs",
- "lines": 15149,
+ "lines": 15186,
"priv": 119,
"pub": 484,
"test": 48
diff --git a/tests/architecture.rs b/tests/architecture.rs
index 483a293..882adee 100644
--- a/tests/architecture.rs
+++ b/tests/architecture.rs
@@ -644,6 +644,7 @@ fn the_test_surface_is_disposed_of() {
let rows = report.get("rows").and_then(|r| r.as_array()).expect("rows");
let mut unreasoned = Vec::new();
+ let mut unconfirmed = Vec::new();
for row in rows {
let name = row.get("name").and_then(|v| v.as_str()).unwrap_or("?");
let module = row.get("module").and_then(|v| v.as_str()).unwrap_or("?");
@@ -651,6 +652,17 @@ fn the_test_surface_is_disposed_of() {
if !row.get("hand_written").and_then(|v| v.as_bool()).unwrap_or(false) {
unreasoned.push(format!("{module}.{name} ({disp})"));
}
+ // Every piece of in-module evidence for this item is a call in method
+ // position on some receiver. A name match cannot tell `self.store_dir()`
+ // from `listener.local_addr()` — the latter is std's, on a different
+ // type, and it once made a function with no callers look production-used.
+ // So these rows are named for a human and stay failing until confirmed.
+ if row.get("dotted_only").and_then(|v| v.as_bool()).unwrap_or(false)
+ && disp != "already-gated"
+ && !row.get("confirmed").and_then(|v| v.as_bool()).unwrap_or(false)
+ {
+ unconfirmed.push(format!("{module}.{name} at {}", row.get("where").and_then(|v| v.as_str()).unwrap_or("?")));
+ }
}
assert!(
unreasoned.is_empty(),
@@ -660,6 +672,15 @@ fn the_test_surface_is_disposed_of() {
unreasoned.len(),
unreasoned.join("\n")
);
+ assert!(
+ unconfirmed.is_empty(),
+ "{} items are counted as production-used only because something calls \
+ `.name()` somewhere in their module, and no human has confirmed that the \
+ receiver is the right type. Read each cited line and add it to \
+ tools/test-surface-confirmed.json, or gate the item:\n{}",
+ unconfirmed.len(),
+ unconfirmed.join("\n")
+ );
let budget = budget_section("test_surface");
let surface = &budget;