summaryrefslogtreecommitdiff
path: root/test-beta
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-12-09 19:22:12 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-12-09 19:22:12 +0800
commitb6fefa81bbba986aab59cd5221673e11083213ad (patch)
tree3b5c2c0b54274c74349cff2d866e10b8c627b680 /test-beta
parenta7f06f34a54dc65629869efe9fb3b4681e66d5cb (diff)
downloadlua-language-server-b6fefa81bbba986aab59cd5221673e11083213ad.zip
暂存
Diffstat (limited to 'test-beta')
-rw-r--r--test-beta/completion/init.lua44
-rw-r--r--test-beta/crossfile/hover.lua26
2 files changed, 34 insertions, 36 deletions
diff --git a/test-beta/completion/init.lua b/test-beta/completion/init.lua
index 12600e58..18920704 100644
--- a/test-beta/completion/init.lua
+++ b/test-beta/completion/init.lua
@@ -1,34 +1,6 @@
-local core = require 'core'
-local parser = require 'parser'
-local buildVM = require 'vm'
-
-local CompletionItemKind = {
- Text = 1,
- Method = 2,
- Function = 3,
- Constructor = 4,
- Field = 5,
- Variable = 6,
- Class = 7,
- Interface = 8,
- Module = 9,
- Property = 10,
- Unit = 11,
- Value = 12,
- Enum = 13,
- Keyword = 14,
- Snippet = 15,
- Color = 16,
- File = 17,
- Reference = 18,
- Folder = 19,
- EnumMember = 20,
- Constant = 21,
- Struct = 22,
- Event = 23,
- Operator = 24,
- TypeParameter = 25,
-}
+local core = require 'core.completion'
+local files = require 'files'
+local CompletionItemKind = require 'define.CompletionItemKind'
local EXISTS = {'EXISTS'}
@@ -62,12 +34,12 @@ rawset(_G, 'TEST', true)
function TEST(script)
return function (expect)
- local pos = script:find('$', 1, true) - 1
+ files.removeAll()
+ local pos = script:find('$', 1, true)
local new_script = script:gsub('%$', '')
- local ast = parser:parse(new_script, 'lua', 'Lua 5.4')
- local vm = buildVM(ast)
- assert(vm)
- local result = core.completion(vm, new_script, pos)
+
+ files.setText('', new_script)
+ local result = core('', pos)
if expect then
assert(result)
assert(eq(expect, result))
diff --git a/test-beta/crossfile/hover.lua b/test-beta/crossfile/hover.lua
index ad2133b9..5030edf4 100644
--- a/test-beta/crossfile/hover.lua
+++ b/test-beta/crossfile/hover.lua
@@ -212,6 +212,32 @@ global t: {
},
}
+TEST {
+ {
+ path = 'a.lua',
+ content = [[
+ return {
+ a = 1,
+ b = 2,
+ }
+ ]],
+ },
+ {
+ path = 'b.lua',
+ content = [[
+ local <?t?> = require 'a'
+ ]]
+ },
+ hover = {
+ label = [[
+local t: {
+ a: integer = 1,
+ b: integer = 2,
+}]],
+ name = 't',
+ },
+}
+
-- 先屏蔽掉 emmy
do return end
TEST {