summaryrefslogtreecommitdiff
path: root/test/crossfile
diff options
context:
space:
mode:
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