From 0108cc7c485a2885976d33e2da9419b97223e66e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 19 Jul 2023 15:55:30 +0800 Subject: cleanup test codes --- test/crossfile/completion.lua | 14 ++++++++++---- test/crossfile/references.lua | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'test/crossfile') diff --git a/test/crossfile/completion.lua b/test/crossfile/completion.lua index 113b0327..227350cb 100644 --- a/test/crossfile/completion.lua +++ b/test/crossfile/completion.lua @@ -61,7 +61,7 @@ function TEST(data) local mainUri local pos for _, info in ipairs(data) do - local uri = furi.encode(info.path) + local uri = furi.encode(TESTROOT .. info.path) local script = info.content or '' if info.main then local newScript, catched = catch(script, '?') @@ -75,7 +75,7 @@ function TEST(data) local _ = function () for _, info in ipairs(data) do - files.remove(furi.encode(info.path)) + files.remove(furi.encode(TESTROOT .. info.path)) end end @@ -108,6 +108,12 @@ function TEST(data) : gsub('\r\n', '\n') end end + for _, eitem in ipairs(expect) do + if eitem['description'] then + eitem['description'] = eitem['description'] + : gsub('%$(.-)%$', _G) + end + end assert(result) assert(eq(expect, result)) end @@ -936,7 +942,7 @@ TEST { kind = CompletionItemKind.Variable, detail = 'function', description = [[ -从 [myfunc.lua](file:///myfunc.lua) 中导入 +从 [myfunc.lua]($TESTROOTURI$myfunc.lua) 中导入 ```lua function (a: any, b: any) @@ -967,7 +973,7 @@ TEST { kind = CompletionItemKind.Variable, detail = 'function', description = [[ -从 [dir\myfunc.lua](file:///dir/myfunc.lua) 中导入 +从 [dir\myfunc.lua]($TESTROOTURI$dir/myfunc.lua) 中导入 ```lua function (a: any, b: any) diff --git a/test/crossfile/references.lua b/test/crossfile/references.lua index faa9dba9..36c08170 100644 --- a/test/crossfile/references.lua +++ b/test/crossfile/references.lua @@ -58,7 +58,7 @@ function TEST(datas) local sourceList local sourceUri for i, data in ipairs(datas) do - local uri = furi.encode(data.path) + local uri = furi.encode(TESTROOT .. data.path) local newScript, catched = catch(data.content, '!?~') if catched['!'] or catched['~'] then for _, position in ipairs(catched['!'] + catched['~']) do @@ -79,7 +79,7 @@ function TEST(datas) local _ = function () for _, info in ipairs(datas) do - files.remove(furi.encode(info.path)) + files.remove(furi.encode(TESTROOT .. info.path)) end end -- cgit v1.2.3