From 7cec9355615c28de650daf9abf72a7db758ae592 Mon Sep 17 00:00:00 2001 From: alexion Date: Sat, 26 Sep 2026 19:49:25 -0400 Subject: [PATCH] test(xatu): add let ordering fixture --- src/xatu/BUILD | 1 + src/xatu/testdata/let_order.nix | 7 +++++++ src/xatu/xatu_test.rs | 7 +------ 3 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 src/xatu/testdata/let_order.nix diff --git a/src/xatu/BUILD b/src/xatu/BUILD index 0ca6ac7..c226148 100644 --- a/src/xatu/BUILD +++ b/src/xatu/BUILD @@ -34,6 +34,7 @@ rust_test( data = [ "testdata/clean.nix", "testdata/invalid.nix", + "testdata/let_order.nix", "testdata/lint_findings.nix", ], deps = [ diff --git a/src/xatu/testdata/let_order.nix b/src/xatu/testdata/let_order.nix new file mode 100644 index 0000000..debaa96 --- /dev/null +++ b/src/xatu/testdata/let_order.nix @@ -0,0 +1,7 @@ +let + second = 2; + first = 1; +in { + firstField = first; + secondField = second; +} diff --git a/src/xatu/xatu_test.rs b/src/xatu/xatu_test.rs index f41212f..c6dd45f 100644 --- a/src/xatu/xatu_test.rs +++ b/src/xatu/xatu_test.rs @@ -43,12 +43,7 @@ fn xatu_rejects_invalid_source() -> googletest::Result<()> { #[gtest] fn xatu_reports_out_of_order_let_binding() -> googletest::Result<()> { - let report = xatu::future_sight(vec![SourceFile { - path: PathBuf::from("test.nix"), - source: "let\n second = 2;\n first = 1;\nin {\n firstField = first;\n secondField = second;\n}\n" - .to_owned(), - }]) - .or_fail()?; + let report = xatu::future_sight(vec![fixture_source("testdata/let_order.nix")?]).or_fail()?; expect_that!( report