fennel-ls/test/cli.fnl
XeroOl 87439744b8 rename "check" test to "cli"
technically the corresponding item in the real code was renamed to
--lint, but that's the file we should use to write future tests.
2025-06-02 22:36:11 -05:00

19 lines
610 B
Fennel

(local faith (require :faith))
;; TODO refactor fennel-ls.check to avoid running end-to-end
;; (but keep/write at least some end-to-end tests)
(fn test-lint []
(let [input-file-name (os.tmpname)]
(doto (io.open input-file-name :w)
(: :write "(local x 1)")
(: :close))
(let [output-file (io.popen (.. "./fennel-ls --lint "
input-file-name)
:r)]
(faith.= (.. input-file-name ":1:7: warning: unused definition: x\n")
(output-file:read :*a))
(os.remove input-file-name))
nil))
{: test-lint}