commit 06aac281e50c3f5e3a406db235c7c8c7f0a3d238
parent 7c58bedda22d81704007a148aef972087fddc553
Author: triesap <tyson@radroots.org>
Date: Mon, 27 Jul 2026 22:48:13 +0000
coverage: exclude file-level test modules
- recognize explicit crate-level test configuration in normalized reports.
- mark external event-store harness modules as test-only source.
- retain every production event-store path in exact coverage accounting.
- verify focused reporter tests, the event-store suite, formatting, and Clippy.
Diffstat:
3 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/crates/event_store/src/nip09/reconciliation_v1/result_vector_executor.rs b/crates/event_store/src/nip09/reconciliation_v1/result_vector_executor.rs
@@ -1,4 +1,5 @@
#![forbid(unsafe_code)]
+#![cfg(test)]
use super::{
EventAdmission, ReconciliationCapacityLimits, ReconciliationProfile, SourceGenerationProvider,
diff --git a/crates/event_store/src/store/raw_source_rebuild_v1_tests.rs b/crates/event_store/src/store/raw_source_rebuild_v1_tests.rs
@@ -1,3 +1,5 @@
+#![cfg(test)]
+
use super::RadrootsEventStore;
use crate::model::{RadrootsEventIngest, RadrootsProjectionCursor};
use crate::nip09::reconciliation_v1::{
diff --git a/tools/xtask/src/coverage.rs b/tools/xtask/src/coverage.rs
@@ -530,6 +530,12 @@ fn is_ignorable_lcov_source_line(
}
fn is_cfg_test_source_line(source: &str, line_number: u64) -> bool {
+ if source.lines().any(|line| {
+ let trimmed = line.trim();
+ trimmed.starts_with("#![cfg(test)]") || trimmed.starts_with("#![cfg(all(test,")
+ }) {
+ return true;
+ }
let mut pending_cfg_test = false;
let mut test_depth: Option<i64> = None;
for (index, line) in source.lines().enumerate() {
@@ -2354,6 +2360,14 @@ mod tests {
assert!(is_cfg_test_source_line(source, 2));
assert!(is_cfg_test_source_line(source, 4));
+ assert!(is_cfg_test_source_line(
+ "#![cfg(test)]\nfn helper() {}\n",
+ 2
+ ));
+ assert!(is_cfg_test_source_line(
+ "#![cfg(all(test, feature = \"sqlite\"))]\nfn helper() {}\n",
+ 2
+ ));
}
#[test]