summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-23 02:24:23 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-23 02:24:23 +0800
commite0e3c9ab6b69b16b8949f93f309461f298038fa4 (patch)
treeb15be4999b0f212d502a45210bd7c3b2f426fb63 /test
parentab171866489b903a74ab1da735ff5c35f78e9919 (diff)
downloadlua-language-server-e0e3c9ab6b69b16b8949f93f309461f298038fa4.zip
update
Diffstat (limited to 'test')
-rw-r--r--test/full/self.lua12
-rw-r--r--test/type_inference/init.lua7
2 files changed, 15 insertions, 4 deletions
diff --git a/test/full/self.lua b/test/full/self.lua
index cfa6b710..09d2d154 100644
--- a/test/full/self.lua
+++ b/test/full/self.lua
@@ -39,13 +39,17 @@ local clock = os.clock()
---@diagnostic disable: await-in-sync
for uri in files.eachFile() do
- local status = files.getState(uri)
- guide.eachSource(status.ast, function (src)
+ local state = files.getState(uri)
+ if not state then
+ goto CONTINUE
+ end
+ guide.eachSource(state.ast, function (src)
assert(src.parent ~= nil or src.type == 'main')
end)
local fileClock = os.clock()
diag.doDiagnostic(uri, true)
print('诊断文件耗时:', os.clock() - fileClock, uri)
+ ::CONTINUE::
end
local passed = os.clock() - clock
@@ -58,6 +62,9 @@ local compileDatas = {}
for uri in files.eachFile() do
local state = files.getState(uri)
+ if not state then
+ goto CONTINUE
+ end
local clock = os.clock()
guide.eachSource(state.ast, function (src)
vm.compileNode(src)
@@ -66,6 +73,7 @@ for uri in files.eachFile() do
passed = os.clock() - clock,
uri = uri,
}
+ ::CONTINUE::
end
local printTexts = {}
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 33184569..254320e4 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -7,9 +7,12 @@ local vm = require 'vm'
rawset(_G, 'TEST', true)
local function getSource(pos)
- local ast = files.getState('')
+ local state = files.getState('')
+ if not state then
+ return
+ end
local result
- guide.eachSourceContain(ast.ast, pos, function (source)
+ guide.eachSourceContain(state.ast, pos, function (source)
if source.type == 'local'
or source.type == 'getlocal'
or source.type == 'setlocal'