Files
dev/src/xatu/xatu_test.rs
2026-09-18 23:13:09 -04:00

33 lines
843 B
Rust

use std::path::PathBuf;
use xatu::SourceFile;
fn source_file(path: &str, source: &str) -> SourceFile {
SourceFile {
path: PathBuf::from(path),
source: source.to_owned(),
}
}
#[test]
fn future_sight_reports_empty_inherit_findings() {
let report = xatu::future_sight(vec![
source_file("clean.nix", include_str!("testdata/clean.nix")),
source_file(
"empty_inherit.nix",
include_str!("testdata/empty_inherit.nix"),
),
])
.expect("sources should parse");
assert!(!report.is_clean());
assert_eq!(1, report.diagnostics.len());
let diagnostic = &report.diagnostics[0];
assert_eq!(
PathBuf::from("empty_inherit.nix"),
report.files.get(diagnostic.file_id).path,
);
assert_eq!("empty_inherit", diagnostic.finding.rule_id);
}