summaryrefslogtreecommitdiff
path: root/server/test
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-05-05 21:27:34 +0800
committersumneko <sumneko@hotmail.com>2019-05-05 21:27:34 +0800
commitde0adfc8ee4561d7eb9c31e19fa5774ff7d999dd (patch)
tree1ce2b253a781a01d519a2ff6abb24d4d378c75b9 /server/test
parentc1902bfe0f61006bd9afae43c10ee6a25863e5f6 (diff)
downloadlua-language-server-de0adfc8ee4561d7eb9c31e19fa5774ff7d999dd.zip
emmyFunction
Diffstat (limited to 'server/test')
-rw-r--r--server/test/hover/init.lua18
-rw-r--r--server/test/signature/init.lua37
2 files changed, 43 insertions, 12 deletions
diff --git a/server/test/hover/init.lua b/server/test/hover/init.lua
index baed3912..f31dfa03 100644
--- a/server/test/hover/init.lua
+++ b/server/test/hover/init.lua
@@ -730,3 +730,21 @@ local <?f?>
function f(x: number, y: number)
-> boolean
]]
+
+TEST [[
+---@type fun(x: number, y: number):boolean
+local f
+f(<?a?>)
+]]
+[[
+global a: number
+]]
+
+TEST [[
+---@type fun(x: number, y: number):boolean
+local f
+local <?r?> = f()
+]]
+[[
+local r: boolean
+]]
diff --git a/server/test/signature/init.lua b/server/test/signature/init.lua
index 91ef75c8..eb6e609a 100644
--- a/server/test/signature/init.lua
+++ b/server/test/signature/init.lua
@@ -6,8 +6,8 @@ rawset(_G, 'TEST', true)
function TEST(script)
return function (expect)
- local pos = script:find('@', 1, true)
- local new_script = script:gsub('@', '')
+ local pos = script:find('$', 1, true)
+ local new_script = script:gsub('%$', '')
local ast = parser:ast(new_script, 'lua', 'Lua 5.3')
local vm = buildVM(ast)
assert(vm)
@@ -33,7 +33,7 @@ TEST [[
local function x(a, b)
end
-x(@
+x($
]]
{
label = "function x(a: any, b: any)",
@@ -44,7 +44,7 @@ TEST [[
local function x(a, b)
end
-x(@)
+x($)
]]
{
label = "function x(a: any, b: any)",
@@ -55,7 +55,7 @@ TEST [[
local function x(a, b)
end
-x(xxx@)
+x(xxx$)
]]
{
label = "function x(a: any, b: any)",
@@ -66,7 +66,7 @@ TEST [[
local function x(a, b)
end
-x(xxx, @)
+x(xxx, $)
]]
{
label = "function x(a: any, b: any)",
@@ -77,7 +77,7 @@ TEST [[
function mt:f(a)
end
-mt:f(@
+mt:f($
]]
{
label = 'function mt:f(a: any)',
@@ -85,7 +85,7 @@ mt:f(@
}
TEST [[
-(''):sub(@
+(''):sub($
]]
{
label = [[
@@ -96,7 +96,7 @@ function *string:sub(i: integer [, j: integer(-1)])
}
TEST [[
-(''):sub(1)@
+(''):sub(1)$
]]
(nil)
@@ -104,16 +104,29 @@ TEST [[
local function f(a, b, c)
end
-f(1, 'string@')
+f(1, 'string$')
]]
(nil)
TEST [[
-pcall(function () @ end)
+pcall(function () $ end)
]]
(nil)
TEST [[
-table.unpack {@}
+table.unpack {$}
]]
(nil)
+
+TEST [[
+---@type fun(x: number, y: number):boolean
+local zzzz
+zzzz($)
+]]
+{
+ label = [[
+function zzzz(x: number, y: number)
+ -> boolean
+]],
+ arg = {15, 23},
+}