diff options
Diffstat (limited to 'tests/architecture.rs')
| -rw-r--r-- | tests/architecture.rs | 21 |
1 files changed, 21 insertions, 0 deletions
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; |
