diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/code_action/init.lua | 16 | ||||
-rw-r--r-- | test/crossfile/completion.lua | 14 | ||||
-rw-r--r-- | test/crossfile/references.lua | 4 | ||||
-rw-r--r-- | test/plugins/ffi/test.lua | 2 |
4 files changed, 21 insertions, 15 deletions
diff --git a/test/code_action/init.lua b/test/code_action/init.lua index ed145766..264cfacf 100644 --- a/test/code_action/init.lua +++ b/test/code_action/init.lua @@ -17,7 +17,7 @@ local function eq(expected, result) end local tp1, tp2 = type(expected), type(result) if tp1 ~= tp2 then - return false, string.format(": expected type %s, got %s for %s", tp1, tp2) + return false, string.format(": expected type %s, got %s", tp1, tp2) end if tp1 == 'table' then local mark = {} @@ -53,7 +53,7 @@ local function TEST_CROSSFILE(testfiles) local mainscript = table.remove(testfiles, 1) return function(expected) for _, data in ipairs(testfiles) do - local uri = furi.encode(data.path) + local uri = furi.encode(TESTROOT .. data.path) files.setText(uri, data.content) files.compileState(uri) end @@ -64,7 +64,7 @@ local function TEST_CROSSFILE(testfiles) local _ <close> = function () for _, info in ipairs(testfiles) do - files.remove(furi.encode(info.path)) + files.remove(furi.encode(TESTROOT .. info.path)) end files.remove(TESTURI) end @@ -205,7 +205,7 @@ TEST_CROSSFILE { arguments = { { uri = TESTURI, - target = furi.encode 'unrequiredModule.lua', + target = furi.encode(TESTROOT .. 'unrequiredModule.lua'), name = 'unrequiredModule', requireName = 'unrequiredModule' }, @@ -236,7 +236,7 @@ TEST_CROSSFILE { arguments = { { uri = TESTURI, - target = furi.encode 'myModule/init.lua', + target = furi.encode(TESTROOT .. 'myModule/init.lua'), name = 'myModule', requireName = 'myModule.init' }, @@ -252,7 +252,7 @@ TEST_CROSSFILE { arguments = { { uri = TESTURI, - target = furi.encode 'myModule/init.lua', + target = furi.encode(TESTROOT .. 'myModule/init.lua'), name = 'myModule', requireName = 'init' }, @@ -268,11 +268,11 @@ TEST_CROSSFILE { arguments = { { uri = TESTURI, - target = furi.encode 'myModule/init.lua', + target = furi.encode(TESTROOT .. 'myModule/init.lua'), name = 'myModule', requireName = 'myModule' }, }, } }, -}
\ No newline at end of file +} 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 _ <close> = 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 _ <close> = function () for _, info in ipairs(datas) do - files.remove(furi.encode(info.path)) + files.remove(furi.encode(TESTROOT .. info.path)) end end diff --git a/test/plugins/ffi/test.lua b/test/plugins/ffi/test.lua index b46fe962..f07e71c6 100644 --- a/test/plugins/ffi/test.lua +++ b/test/plugins/ffi/test.lua @@ -8,7 +8,7 @@ local template = require 'config.template' template['Lua.runtime.version'].default = 'LuaJIT' -TESTURI = furi.encode('/unittest.ffi.lua') +TESTURI = furi.encode(TESTROOT .. 'unittest.ffi.lua') ---@async local function TestBuilder() |