test(xatu): cover nested let ordering
This commit is contained in:
9
src/xatu/testdata/lint_findings.nix
vendored
9
src/xatu/testdata/lint_findings.nix
vendored
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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::<Vec<_>>(),
|
||||
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(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user