test(xatu): format inline fixtures

This commit is contained in:
2026-09-19 10:59:29 -04:00
parent 825a1b9773
commit 7b5559595e

View File

@@ -14,7 +14,11 @@ fn source_file(path: &str, source: &str) -> SourceFile {
fn future_sight_reports_clean_sources_as_clean() {
let report = xatu::future_sight(vec![source_file(
"clean.nix",
"{ path = ./. + \"/foo\"; inherit foo; }",
r#"{
path = ./. + "/foo";
inherit foo;
}
"#,
)])
.expect("fixture should parse");
@@ -23,7 +27,7 @@ fn future_sight_reports_clean_sources_as_clean() {
#[test]
fn future_sight_rejects_parse_errors() {
let error = xatu::future_sight(vec![source_file("invalid.nix", "{")])
let error = xatu::future_sight(vec![source_file("invalid.nix", "{\n")])
.expect_err("fixture should fail to parse");
assert_eq!(error.code(), Code::FailedPrecondition);
@@ -31,8 +35,11 @@ fn future_sight_rejects_parse_errors() {
#[test]
fn future_sight_reports_deprecated_to_path_ident_findings() {
let report = xatu::future_sight(vec![source_file("deprecated_to_path_ident.nix", "toPath x")])
.expect("fixture should parse");
let report = xatu::future_sight(vec![source_file(
"deprecated_to_path_ident.nix",
"toPath x\n",
)])
.expect("fixture should parse");
assert_eq!(report.diagnostics.len(), 1);
@@ -48,7 +55,7 @@ fn future_sight_reports_deprecated_to_path_ident_findings() {
fn future_sight_reports_deprecated_to_path_select_findings() {
let report = xatu::future_sight(vec![source_file(
"deprecated_to_path_select.nix",
"builtins.toPath x",
"builtins.toPath x\n",
)])
.expect("fixture should parse");
@@ -64,8 +71,11 @@ fn future_sight_reports_deprecated_to_path_select_findings() {
#[test]
fn future_sight_reports_empty_inherit_findings() {
let report = xatu::future_sight(vec![source_file("empty_inherit.nix", "{ inherit; }")])
.expect("fixture should parse");
let report = xatu::future_sight(vec![source_file(
"empty_inherit.nix",
"{\n inherit;\n}\n",
)])
.expect("fixture should parse");
assert_eq!(report.diagnostics.len(), 1);