test(xatu): use fixture files
This commit is contained in:
@@ -12,8 +12,11 @@ fn source_file(path: &str, source: &str) -> SourceFile {
|
||||
#[test]
|
||||
fn future_sight_reports_empty_inherit_findings() {
|
||||
let report = xatu::future_sight(vec![
|
||||
source_file("clean.nix", "{ inherit foo; }"),
|
||||
source_file("empty.nix", "{ inherit; }"),
|
||||
source_file("clean.nix", include_str!("testdata/clean.nix")),
|
||||
source_file(
|
||||
"empty_inherit.nix",
|
||||
include_str!("testdata/empty_inherit.nix"),
|
||||
),
|
||||
])
|
||||
.expect("sources should parse");
|
||||
|
||||
@@ -21,6 +24,9 @@ fn future_sight_reports_empty_inherit_findings() {
|
||||
assert_eq!(1, report.diagnostics.len());
|
||||
|
||||
let diagnostic = &report.diagnostics[0];
|
||||
assert_eq!(PathBuf::from("empty.nix"), report.files.get(diagnostic.file_id).path);
|
||||
assert_eq!(
|
||||
PathBuf::from("empty_inherit.nix"),
|
||||
report.files.get(diagnostic.file_id).path,
|
||||
);
|
||||
assert_eq!("empty_inherit", diagnostic.finding.rule_id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user