diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-08-15 17:33:10 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-08-15 17:33:10 +0800 |
commit | cbb42521abe5989a650915bbefa57215d4727ec3 (patch) | |
tree | 7cfbf2160525aa78e56664f3702187d07299830c /test-beta/crossfile | |
parent | b02d03a71f9a41e67cc8b2d0e64d6762de30384b (diff) | |
download | lua-language-server-cbb42521abe5989a650915bbefa57215d4727ec3.zip |
整理测试代码
Diffstat (limited to 'test-beta/crossfile')
-rw-r--r-- | test-beta/crossfile/completion.lua | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/test-beta/crossfile/completion.lua b/test-beta/crossfile/completion.lua index cb9f2f65..ce783cd9 100644 --- a/test-beta/crossfile/completion.lua +++ b/test-beta/crossfile/completion.lua @@ -1,8 +1,6 @@ -local service = require 'service' -local workspace = require 'workspace' -local fs = require 'bee.filesystem' -local core = require 'core' -local uric = require 'uri' +local files = require 'files' +local core = require 'core.completion' +local furi = require 'file-uri' rawset(_G, 'TEST', true) @@ -63,34 +61,22 @@ local function eq(a, b) end function TEST(data) - local lsp = service() - local ws = workspace(lsp, 'test') - lsp.workspace = ws - ws.root = ROOT + files.removeAll() local mainUri - local mainBuf local pos for _, info in ipairs(data) do - local uri = uric.encode(fs.path(info.path)) + local uri = furi.encode(info.path) local script = info.content if info.main then pos = script:find('$', 1, true) - 1 script = script:gsub('%$', '') mainUri = uri - mainBuf = script - end - lsp:saveText(uri, 1, script) - ws:addFile(uric.decode(uri)) - - while lsp._needCompile[1] do - lsp:compileVM(lsp._needCompile[1]) end + files.setText(uri, script) end - local vm = lsp:loadVM(mainUri) - assert(vm) - local result = core.completion(vm, mainBuf, pos) + local result = core.completion(mainUri, pos) local expect = data.completion if expect then assert(result) |