diff --git a/src/xatu/testdata/lint_findings.nix b/src/xatu/testdata/lint_findings.nix index d4f174c..a4eb0d8 100644 --- a/src/xatu/testdata/lint_findings.nix +++ b/src/xatu/testdata/lint_findings.nix @@ -1,10 +1,17 @@ let - second = 2; + second = first; first = 1; + nested = let + nestedFirst = first; + nestedSecond = nestedFirst; + in { + result = nestedSecond; + }; in { package = package; from = pkgs.from; url = https://example.com; firstField = first; secondField = second; + nestedField = nested; } diff --git a/src/xatu/xatu_test.rs b/src/xatu/xatu_test.rs index a2c033c..66ebd71 100644 --- a/src/xatu/xatu_test.rs +++ b/src/xatu/xatu_test.rs @@ -42,17 +42,15 @@ fn xatu_rejects_invalid_source() -> googletest::Result<()> { } #[gtest] -fn xatu_reports_out_of_order_let_binding() -> googletest::Result<()> { +fn xatu_reports_out_of_order_let_bindings() -> googletest::Result<()> { let report = xatu::future_sight(vec![fixture_source("testdata/lint_findings.nix")?]).or_fail()?; - expect_that!( - report - .diagnostics - .iter() - .map(|diagnostic| diagnostic.finding.rule_id) - .collect::>(), - contains(eq(&"let_order")) - ); + let let_order_count = report + .diagnostics + .iter() + .filter(|diagnostic| diagnostic.finding.rule_id == "let_order") + .count(); + expect_that!(let_order_count, eq(4)); Ok(()) }