From b2ec7e5a3a65a20f6ec47eb671e048584e304072 Mon Sep 17 00:00:00 2001 From: XeroOl Date: Wed, 24 Jan 2024 16:41:53 -0600 Subject: [PATCH] Add debug info to the test --- test/completion-test.fnl | 11 ++--------- test/init.fnl | 11 +++++++++++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/test/completion-test.fnl b/test/completion-test.fnl index a042ead..22c39c4 100644 --- a/test/completion-test.fnl +++ b/test/completion-test.fnl @@ -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") diff --git a/test/init.fnl b/test/init.fnl index 254770d..686e42a 100644 --- a/test/init.fnl +++ b/test/init.fnl @@ -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)