From 3da1e6304b87689f99d2ad118b1994adfb2891bd Mon Sep 17 00:00:00 2001 From: XeroOl Date: Thu, 8 Feb 2024 12:26:22 -0600 Subject: [PATCH] test: add check for unused diagnostic --- test/diagnostic-test.fnl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/diagnostic-test.fnl b/test/diagnostic-test.fnl index 4f0931d..30fe5a9 100644 --- a/test/diagnostic-test.fnl +++ b/test/diagnostic-test.fnl @@ -81,6 +81,20 @@ "not found") _ (error "did not match")))) + (it "warns about unused variables from multival destructuring" + (let [self (create-client) + responses (self:open-file! filename "(let [(x y) (values 1 2)] x)")] + (match responses + [{:params {: diagnostics}}] + (is (find [_ v (ipairs diagnostics)] + (match v + {:code 301 + :range {:start {:character 9 :line 0} + :end {:character 10 :line 0}}} + v)) + "not found") + _ (error "did not match")))) + (it "warns about vars that are never set" (let [self (create-client) responses (self:open-file! filename "(var x nil) (print x)")]