Add debug info to the test

This commit is contained in:
XeroOl 2024-01-24 16:41:53 -06:00
parent a29cbe496e
commit b2ec7e5a3a
2 changed files with 13 additions and 9 deletions

View File

@ -2,6 +2,7 @@
(local is (require :test.is))
(local {: view} (require :fennel))
(local {: ROOT-URI
: create-client} (require :test.client))
@ -170,7 +171,6 @@
completion.label))
allowed-missing-docs {:lua true
:set-forcibly! true
;; TODO support other lua versions besides 5.4
:gcinfo true
:getfenv true
@ -182,11 +182,7 @@
:bit32 true
;; luajit
:bit true
:jit true
;; TODO remove these from fennel-ls when they become configurable
:love true
:vim true}]
:jit true}]
(each [_ completion (ipairs completions)]
(when (not (. allowed-missing-docs completion.label))
(is.same (type completion.label) :string "unlabeled completion")
@ -212,9 +208,6 @@
(is.same (type completion.documentation) :table (.. completion.label " needs documentation"))
(is.not.same completion.documentation :nil (.. completion.label " needs documentation"))))))))
;; (it "offers rich information about variable completions")
;; (it "offers rich information about field completions")
;; (it "offers rich information about method completions")

View File

@ -1,3 +1,14 @@
(local fennel (require :fennel))
(set debug.traceback fennel.traceback)
(local old-debug-getinfo debug.getinfo)
(fn debug.getinfo [x]
(let [{: sourcemap} (require :fennel.compiler)
info (old-debug-getinfo (+ 1 x))]
(when info
(set info.currentline (or (?. sourcemap info.source info.currentline 2) info.currentline))
(set info.linedefined (or (?. sourcemap info.source info.linedefined 2) info.linedefined)))
info))
(require :test.capabilities-test)
(require :test.completion-test)
(require :test.diagnostic-test)