diff --git a/.build.yml b/.build.yml index 3110f49..7c2de31 100644 --- a/.build.yml +++ b/.build.yml @@ -6,7 +6,6 @@ packages: - lua5.3 - lua5.4 - luajit - - luarocks sources: - https://git.sr.ht/~xerool/fennel-ls tasks: diff --git a/Makefile b/Makefile index 6de3860..b76a9be 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ install: $(EXE) mkdir -p $(DESTDIR)$(BINDIR) && cp $< $(DESTDIR)$(BINDIR)/ test: $(EXE) - $(FENNEL) $(FENNELFLAGS) test/init.fnl + TESTING=1 $(FENNEL) $(FENNELFLAGS) test/init.fnl ci: $(MAKE) test LUA=lua5.1 @@ -63,9 +63,12 @@ ci: $(MAKE) FENNEL=./old-fennel deps diff -r deps old-deps diff -r fennel old-fennel + rm -rf old-deps + rm -f old-fennel - # luarocks - luarocks install rockspecs/fennel-ls-scm-4.rockspec --dev --tree my-test-tree + # test that luarocks builds properly + sudo apt install luarocks + luarocks install rockspecs/fennel-ls-scm-4.rockspec --dev --local clean: rm -f $(EXE) diff --git a/src/fennel-ls/utils.fnl b/src/fennel-ls/utils.fnl index 896e740..babd6e8 100644 --- a/src/fennel-ls/utils.fnl +++ b/src/fennel-ls/utils.fnl @@ -159,13 +159,14 @@ WARNING: this is only used in the test code, not in the real language server" word)))) (fn multi-sym-base [symbol] + (local symbol (tostring symbol)) (if (or (= symbol ".") (= symbol "..") (= symbol "...") (= symbol ":") (= symbol "?.")) - (tostring symbol) - (pick-values 1 (: (tostring symbol) :match "[^.:]*")))) + symbol + (pick-values 1 (symbol:match "[^.:]*")))) (λ type= [val typ] (= (type val) typ)) diff --git a/test/diagnostic.fnl b/test/diagnostic.fnl index b7d6c64..1c26233 100644 --- a/test/diagnostic.fnl +++ b/test/diagnostic.fnl @@ -3,22 +3,22 @@ (local {: create-client-with-files} (require :test.utils)) (fn find [diagnostics e] - "returns the index of the diagnostic " - (accumulate [result nil - i d (ipairs diagnostics) - &until result] - (if (and (or (= e.message nil) - (if (= (type e.message) "function") - (e.message d.message) - (= e.message d.message))) - (or (= e.code nil) - (= e.code d.code)) - (or (= e.range nil) - (and (= e.range.start.line d.range.start.line) - (= e.range.start.character d.range.start.character) - (= e.range.end.line d.range.end.line) - (= e.range.end.character d.range.end.character)))) - i))) + "returns the index of the diagnostic that matches `e`" + (accumulate [result nil + i d (ipairs diagnostics) + &until result] + (if (and (or (= e.message nil) + (if (= (type e.message) "function") + (e.message d.message) + (= e.message d.message))) + (or (= e.code nil) + (= e.code d.code)) + (or (= e.range nil) + (and (= e.range.start.line d.range.start.line) + (= e.range.start.character d.range.start.character) + (= e.range.end.line d.range.end.line) + (= e.range.end.character d.range.end.character)))) + i))) (fn check [file-contents expected unexpected] (let [{: diagnostics} (create-client-with-files file-contents)]