summaryrefslogtreecommitdiff
path: root/server/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-04-05 21:01:20 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-04-05 21:01:20 +0800
commit0408b1a9e2b0281b8afbe931e8bc934ee6e0c775 (patch)
tree908e0cc7b090bd18521128539a85ab779e6ba052 /server/test
parent243ffa67e5b3b094365c40b04a1a505a9e73da57 (diff)
downloadlua-language-server-0408b1a9e2b0281b8afbe931e8bc934ee6e0c775.zip
自动完成支持 *toclose
Diffstat (limited to 'server/test')
-rw-r--r--server/test/completion/init.lua25
-rw-r--r--server/test/crossfile/completion.lua2
-rw-r--r--server/test/diagnostics/init.lua1
3 files changed, 25 insertions, 3 deletions
diff --git a/server/test/completion/init.lua b/server/test/completion/init.lua
index d17b4a83..ed68dec5 100644
--- a/server/test/completion/init.lua
+++ b/server/test/completion/init.lua
@@ -103,12 +103,12 @@ function TEST(script)
return function (expect)
local pos = script:find('@', 1, true) - 1
local new_script = script:gsub('@', ' ')
- local ast = parser:ast(new_script, 'lua', 'Lua 5.3')
+ local ast = parser:ast(new_script, 'lua', 'Lua 5.4')
local vm = buildVM(ast)
assert(vm)
local word = findWord(pos, new_script)
local startPos = findStartPos(pos, new_script)
- local result = core.completion(vm, startPos, word)
+ local result = core.completion(vm, new_script, startPos, word)
if expect then
assert(result)
assert(eq(expect, result))
@@ -734,3 +734,24 @@ do
end
]]
(nil)
+
+require 'config' .config.runtime.version = 'Lua 5.4'
+TEST [[
+local *@
+]]
+{
+ {
+ label = 'toclose',
+ kind = CompletionItemKind.Keyword,
+ }
+}
+
+TEST [[
+local *tocl@
+]]
+{
+ {
+ label = 'toclose',
+ kind = CompletionItemKind.Keyword,
+ }
+}
diff --git a/server/test/crossfile/completion.lua b/server/test/crossfile/completion.lua
index 5cce68ef..e89d013f 100644
--- a/server/test/crossfile/completion.lua
+++ b/server/test/crossfile/completion.lua
@@ -116,7 +116,7 @@ function TEST(data)
assert(vm)
local word = findWord(pos, mainBuf)
local startPos = findStartPos(pos, mainBuf) or pos
- local result = core.completion(vm, startPos, word)
+ local result = core.completion(vm, mainBuf, startPos, word)
local expect = data.completion
if expect then
assert(result)
diff --git a/server/test/diagnostics/init.lua b/server/test/diagnostics/init.lua
index 00ec11bf..01795658 100644
--- a/server/test/diagnostics/init.lua
+++ b/server/test/diagnostics/init.lua
@@ -247,6 +247,7 @@ local f = load('')
f(1, 2, 3)
]]
+require 'config' .config.runtime.version = 'Lua 5.3'
TEST [[
<!warn!>(1)
]]