diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-12-24 17:03:18 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-12-24 17:03:18 +0800 |
commit | ef6c3fe05addbd299e4fc6e45cec94a83886c18f (patch) | |
tree | 9e526e2c558fab376874172aa51a00e800d4ce4b /test/full | |
parent | b7344640a0ab9a07551ee5ebc435657b45659553 (diff) | |
download | lua-language-server-ef6c3fe05addbd299e4fc6e45cec94a83886c18f.zip |
cleanup
Diffstat (limited to 'test/full')
-rw-r--r-- | test/full/example.lua | 2 | ||||
-rw-r--r-- | test/full/projects.lua | 11 | ||||
-rw-r--r-- | test/full/self.lua | 10 |
3 files changed, 19 insertions, 4 deletions
diff --git a/test/full/example.lua b/test/full/example.lua index c0ce23ee..cae2df07 100644 --- a/test/full/example.lua +++ b/test/full/example.lua @@ -51,7 +51,6 @@ local function testIfExit(path) local max = 100 local need for i = 1, max do - files.removeAll() files.open('') files.setText('', buf) diag('', function () end) @@ -60,6 +59,7 @@ local function testIfExit(path) need = passed / i break end + files.remove('') end print(('基准诊断测试[%s]单次耗时:%.10f'):format(path:filename():string(), need)) end diff --git a/test/full/projects.lua b/test/full/projects.lua index 7beaa026..4a8ef62a 100644 --- a/test/full/projects.lua +++ b/test/full/projects.lua @@ -14,13 +14,13 @@ config.set(nil, 'Lua.diagnostics.neededFileStatus', { ---@diagnostic disable: await-in-sync local function doProjects(pathname) - files.removeAll() - local path = fs.path(pathname) if not fs.exists(path) then return end + local uris = {} + print('基准诊断目录:', path) fsu.scanDirectory(path, function (path) if path:extension():string() ~= '.lua' then @@ -30,8 +30,15 @@ local function doProjects(pathname) local text = fsu.loadFile(path) files.setText(uri, text) files.open(uri) + uris[#uris+1] = uri end) + local _ <close> = function () + for _, uri in ipairs(uris) do + files.remove(uri) + end + end + print('开始诊断...') ws.ready = true diff --git a/test/full/self.lua b/test/full/self.lua index b2c74271..0c148a91 100644 --- a/test/full/self.lua +++ b/test/full/self.lua @@ -4,10 +4,11 @@ local furi = require 'file-uri' local diag = require 'provider.diagnostic' local config = require 'config' local ws = require 'workspace' -files.removeAll() local path = ROOT / 'script' +local uris = {} + fsu.scanDirectory(path, function (path) if path:extension():string() ~= '.lua' then return @@ -16,8 +17,15 @@ fsu.scanDirectory(path, function (path) local text = fsu.loadFile(path) files.setText(uri, text) files.open(uri) + uris[#uris+1] = uri end) +local _ <close> = function () + for _, uri in ipairs(uris) do + files.remove(uri) + end +end + print('基准诊断目录:', path) ws.ready = true |