From ef6c3fe05addbd299e4fc6e45cec94a83886c18f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 24 Dec 2021 17:03:18 +0800 Subject: cleanup --- test/crossfile/completion.lua | 8 ++++++-- test/crossfile/definition.lua | 8 ++++++-- test/crossfile/diagnostic.lua | 9 +++++++-- test/crossfile/hover.lua | 8 ++++++-- test/crossfile/references.lua | 8 ++++++-- 5 files changed, 31 insertions(+), 10 deletions(-) (limited to 'test/crossfile') 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 _ = 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 _ = 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 _ = 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 _ = 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 _ = 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 -- cgit v1.2.3