MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_support

Function test_support

atomic-audit/src/risk.rs:262–293  ·  view source on GitHub ↗

Conventional test/support classification, not evidence that tests ran or that these files cover production behavior.

(path: &str, symbol: &str)

Source from the content-addressed store, hash-verified

260/// Conventional test/support classification, not evidence that tests ran or
261/// that these files cover production behavior.
262pub fn test_support(path: &str, symbol: &str) -> bool {
263 let parts: Vec<_> = path.split('/').collect();
264 let file = parts.last().copied().unwrap_or("");
265 let stem = file.rsplit_once('.').map(|(stem, _)| stem).unwrap_or(file);
266 let scope = symbol
267 .rsplit_once('#')
268 .map(|(_, name)| name)
269 .unwrap_or(symbol)
270 .split("::")
271 .collect::<Vec<_>>();
272 parts.iter().any(|part| {
273 matches!(
274 *part,
275 "tests"
276 | "test"
277 | "__tests__"
278 | "fixtures"
279 | "testdata"
280 | "examples"
281 | "benches"
282 | "benchmarks"
283 )
284 }) || matches!(stem, "test" | "tests")
285 || file.starts_with("test_")
286 || file.contains(".test.")
287 || file.contains(".spec.")
288 || file.contains("_test.")
289 || scope
290 .iter()
291 .take(scope.len().saturating_sub(1))
292 .any(|part| matches!(*part, "tests" | "test"))
293}
294
295/// Stable conventional component grouping; explicit package roots are not
296/// inferred from compiler/build configuration.

Callers 2

vacuous_assertionFunction · 0.85
collectFunction · 0.85

Calls 5

lastMethod · 0.80
collectMethod · 0.45
iterMethod · 0.45
containsMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected