Add test for config validation.

This commit is contained in:
Phil Hagelberg 2025-02-28 00:49:11 -08:00
parent 670f7d108b
commit 024083c7d2
3 changed files with 17 additions and 3 deletions

View File

@ -102,13 +102,15 @@ done, but these are the sort of enhancements I am thinking about.
- [ ] fields
- [ ] go to references of fields when tables are aliased
- [ ] global search across other files
- [ ] Options / Configuration
- [X] Options / Configuration
- [X] Configure over LSP
- [X] Configure with some sort of per-project config file
- [X] fennel/lua path
- [X] lua version
- [X] allowed global list
- [X] enable/disable various linters
- [X] config validation
- [X] tests for config validation
- [X] rename
- [X] local symbols
- [ ] module fields (may affect code behavior, may modify other files)

View File

@ -87,8 +87,6 @@
(or (. specials builtin-name)
(. macros* builtin-name)))
;; TODO get-module-metadata
(λ validate-config [configuration invalid]
(when (not (. lua-versions configuration.lua-version))
(invalid (.. "fennel-ls doesn't know about lua version "

View File

@ -63,7 +63,21 @@
(local _ nil))
nil)
(fn test-config-validation []
(let [client (create-client {:main.fnl ""
:flsproject.fnl "{:lua-version \"lua5.0\"}"})
[_init show] client.initialize-response]
(faith.= "window/showMessage" show.method)
(faith.match "doesn't know about lua version lua5.0" show.params.message))
(let [client (create-client {:main.fnl ""
:flsproject.fnl "{:libraries {:nasilemak true}}"})
[_init show] client.initialize-response]
(faith.= "window/showMessage" show.method)
(faith.match "Could not find docset for library nasilemak"
show.params.message)))
{: test-path
: test-extra-globals
: test-lints
: test-config-validation
: test-editing-settings}