feat(xatu): report deprecated toPath calls

This commit is contained in:
2026-09-18 23:57:08 -04:00
parent a6fe84190e
commit f8966fe2a8
9 changed files with 173 additions and 8 deletions

View File

@@ -37,10 +37,40 @@ fn future_sight_rejects_parse_errors() {
assert_eq!(error.code(), Code::FailedPrecondition);
}
#[test]
fn future_sight_reports_deprecated_to_path_ident_findings() {
let report = xatu::future_sight(vec![source_file("testdata/deprecated_to_path_ident.nix")])
.expect("fixture should parse");
assert_eq!(report.diagnostics.len(), 1);
let diagnostic = &report.diagnostics[0];
assert_eq!(
report.files.get(diagnostic.file_id).path,
PathBuf::from("testdata/deprecated_to_path_ident.nix"),
);
assert_eq!(diagnostic.finding.rule_id, "deprecated_to_path");
}
#[test]
fn future_sight_reports_deprecated_to_path_select_findings() {
let report = xatu::future_sight(vec![source_file("testdata/deprecated_to_path_select.nix")])
.expect("fixture should parse");
assert_eq!(report.diagnostics.len(), 1);
let diagnostic = &report.diagnostics[0];
assert_eq!(
report.files.get(diagnostic.file_id).path,
PathBuf::from("testdata/deprecated_to_path_select.nix"),
);
assert_eq!(diagnostic.finding.rule_id, "deprecated_to_path");
}
#[test]
fn future_sight_reports_empty_inherit_findings() {
let report = xatu::future_sight(vec![source_file("testdata/empty_inherit.nix")])
.expect("fixture should parse");
.expect("fixture should parse");
assert_eq!(report.diagnostics.len(), 1);