summaryrefslogtreecommitdiff
path: root/test/crossfile
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-12-24 17:03:18 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-12-24 17:03:18 +0800
commitef6c3fe05addbd299e4fc6e45cec94a83886c18f (patch)
tree9e526e2c558fab376874172aa51a00e800d4ce4b /test/crossfile
parentb7344640a0ab9a07551ee5ebc435657b45659553 (diff)
downloadlua-language-server-ef6c3fe05addbd299e4fc6e45cec94a83886c18f.zip
cleanup
Diffstat (limited to 'test/crossfile')
-rw-r--r--test/crossfile/completion.lua8
-rw-r--r--test/crossfile/definition.lua8
-rw-r--r--test/crossfile/diagnostic.lua9
-rw-r--r--test/crossfile/hover.lua8
-rw-r--r--test/crossfile/references.lua8
5 files changed, 31 insertions, 10 deletions
diff --git a/test/crossfile/completion.lua b/test/crossfile/completion.lua
index c608ccab..d286a24d 100644
--- a/test/crossfile/completion.lua
+++ b/test/crossfile/completion.lua
@@ -82,8 +82,6 @@ end
---@diagnostic disable: await-in-sync
function TEST(data)
- files.removeAll()
-
local mainUri
local pos
for _, info in ipairs(data) do
@@ -98,6 +96,12 @@ function TEST(data)
files.setText(uri, script)
end
+ local _ <close> = function ()
+ for _, info in ipairs(data) do
+ files.remove(furi.encode(info.path))
+ end
+ end
+
local expect = data.completion
core.clearCache()
local result = core.completion(mainUri, pos, '')
diff --git a/test/crossfile/definition.lua b/test/crossfile/definition.lua
index c9a95658..8cf6234f 100644
--- a/test/crossfile/definition.lua
+++ b/test/crossfile/definition.lua
@@ -27,8 +27,6 @@ local function founded(targets, results)
end
function TEST(datas)
- files.removeAll()
-
local targetList = {}
local sourceList
local sourceUri
@@ -56,6 +54,12 @@ function TEST(datas)
files.setText(uri, newScript)
end
+ local _ <close> = function ()
+ for _, info in ipairs(datas) do
+ files.remove(furi.encode(info.path))
+ end
+ end
+
local sourcePos = (sourceList[1][1] + sourceList[1][2]) // 2
local positions = core(sourceUri, sourcePos)
if positions then
diff --git a/test/crossfile/diagnostic.lua b/test/crossfile/diagnostic.lua
index 9bdce197..ab2c3e41 100644
--- a/test/crossfile/diagnostic.lua
+++ b/test/crossfile/diagnostic.lua
@@ -31,8 +31,6 @@ end
---@diagnostic disable: await-in-sync
function TEST(datas)
- files.removeAll()
-
local targetList = {}
for _, data in ipairs(datas) do
local uri = furi.encode(data.path)
@@ -48,6 +46,13 @@ function TEST(datas)
files.setText(uri, newScript)
end
+ local _ <close> = function ()
+ for _, info in ipairs(datas) do
+ files.remove(furi.encode(info.path))
+ end
+ end
+
+
local result = {}
for _, data in ipairs(datas) do
local uri = furi.encode(data.path)
diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua
index 492efe43..cb9e83aa 100644
--- a/test/crossfile/hover.lua
+++ b/test/crossfile/hover.lua
@@ -39,8 +39,6 @@ end
---@diagnostic disable: await-in-sync
function TEST(expect)
- files.removeAll()
-
local sourcePos, sourceUri
for _, file in ipairs(expect) do
local script, list = catch(file.content, '?')
@@ -52,6 +50,12 @@ function TEST(expect)
end
end
+ local _ <close> = function ()
+ for _, info in ipairs(expect) do
+ files.remove(furi.encode(info.path))
+ end
+ end
+
local hover = core.byUri(sourceUri, sourcePos)
assert(hover)
hover = tostring(hover):gsub('\r\n', '\n')
diff --git a/test/crossfile/references.lua b/test/crossfile/references.lua
index 145792b5..ec02eef7 100644
--- a/test/crossfile/references.lua
+++ b/test/crossfile/references.lua
@@ -53,8 +53,6 @@ local function founded(targets, results)
end
function TEST(datas)
- files.removeAll()
-
local targetList = {}
local sourceList
local sourceUri
@@ -77,6 +75,12 @@ function TEST(datas)
files.setText(uri, newScript)
end
+ local _ <close> = function ()
+ for _, info in ipairs(datas) do
+ files.remove(furi.encode(info.path))
+ end
+ end
+
local sourcePos = (sourceList[1][1] + sourceList[1][2]) // 2
local positions = core(sourceUri, sourcePos)
if positions then