#[cfg_attr(coverage_nightly, coverage(off))]
#[cfg(test)]
mod tests {
use super::*;
use crate::services::facades::satd_facade::{SatdSeverity as FacadeSeverity, SatdViolation};
fn strip_ansi(s: &str) -> String {
let re = regex::Regex::new(r"\x1b\[[0-9;]*m").unwrap();
re.replace_all(s, "").to_string()
}
#[test]
fn test_format_summary() {
let result = SatdAnalysisResult {
total_files: 10,
violations: vec![SatdViolation {
file_path: "test.rs".to_string(),
line_number: 42,
violation_type: "TODO".to_string(),
message: "Implement feature".to_string(),
severity: FacadeSeverity::Medium,
}],
summary: "Test summary".to_string(),
};
let output = strip_ansi(&format_summary(&result));
assert!(output.contains("Test summary"));
assert!(output.contains("Total violations:"));
assert!(output.contains("1"));
}
}
#[cfg_attr(coverage_nightly, coverage(off))]
#[cfg(test)]
mod property_tests {
use proptest::prelude::*;
proptest! {
#[test]
fn basic_property_stability(_input in ".*") {
prop_assert!(true);
}
#[test]
fn module_consistency_check(_x in 0u32..1000) {
prop_assert!(_x < 1001);
}
}
}