summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-08-18 16:48:10 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-08-18 16:48:10 +0800
commit8f2ce1024c5ea43e11137a398171c01642b2ea1a (patch)
treeefa2d98b2a354c6b34a2271676d23bb8c3411a6c
parent332ba28abb7dfe6f45242c978376b3b88c720284 (diff)
downloadlua-language-server-8f2ce1024c5ea43e11137a398171c01642b2ea1a.zip
更新测试
-rw-r--r--test-beta/definition/bug.lua14
-rw-r--r--test-beta/hover/init.lua45
-rw-r--r--test-beta/type_inference/init.lua48
3 files changed, 59 insertions, 48 deletions
diff --git a/test-beta/definition/bug.lua b/test-beta/definition/bug.lua
index c9f3f70d..9bd4b12f 100644
--- a/test-beta/definition/bug.lua
+++ b/test-beta/definition/bug.lua
@@ -100,3 +100,17 @@ TEST [[
local a = os.clock()
local <?<!b!>?> = os.clock()
]]
+
+TEST [[
+local mt = {}
+
+function mt:<!add!>(a, b)
+end
+
+local function init()
+ return mt
+end
+
+local t = init()
+t:<?add?>()
+]]
diff --git a/test-beta/hover/init.lua b/test-beta/hover/init.lua
index d57f4d51..e560e023 100644
--- a/test-beta/hover/init.lua
+++ b/test-beta/hover/init.lua
@@ -125,13 +125,10 @@ obj.<?xxx?>()
]]
"function obj.xxx()"
--- 不不同调用方式推断定义
---TEST [[
---obj.<?xxx?>()
---]]
---[[function obj.xxx()
--- -> any
---]]
+TEST [[
+obj.<?xxx?>()
+]]
+[[global obj.xxx: any]]
TEST [[
local <?x?> = 1
@@ -217,6 +214,7 @@ local obj: class {
}
]]
+-- TODO 支持自定义的函数库
--TEST[[
--local fs = require 'bee.filesystem'
--local <?root?> = fs.current_path()
@@ -296,23 +294,22 @@ function x()
-> any
]]
--- TODO 暂不支持跨越函数调用的函数field
---TEST [[
---local mt = {}
---
---function mt:add(a, b)
---end
---
---local function init()
--- return mt
---end
---
---local t = init()
---t:<?add?>()
---]]
---[[
---function mt:add(a: any, b: any)
---]]
+TEST [[
+local mt = {}
+
+function mt:add(a, b)
+end
+
+local function init()
+ return mt
+end
+
+local t = init()
+t:<?add?>()
+]]
+[[
+function mt:add(a: any, b: any)
+]]
--
--TEST [[
--local mt = {}
diff --git a/test-beta/type_inference/init.lua b/test-beta/type_inference/init.lua
index 5a532b27..151faa89 100644
--- a/test-beta/type_inference/init.lua
+++ b/test-beta/type_inference/init.lua
@@ -225,35 +225,35 @@ TEST 'function' [[
]]
-- 不根据对方函数内的使用情况来推测
---TEST 'number' [[
---local function x(a)
--- _ = a + 1
---end
---local b
---x(<?b?>)
---]]
+TEST 'any' [[
+local function x(a)
+ _ = a + 1
+end
+local b
+x(<?b?>)
+]]
---TEST 'number' [[
---local function x(a, ...)
--- local _, <?b?>, _ = ...
---end
---x(nil, 'xx', 1, true)
---]]
+TEST 'any' [[
+local function x(a, ...)
+ local _, <?b?>, _ = ...
+end
+x(nil, 'xx', 1, true)
+]]
-- 引用不跨越参数
---TEST 'number' [[
---local function x(a, ...)
--- return true, 'ss', ...
---end
---local _, _, _, <?b?>, _ = x(nil, true, 1, 'yy')
---]]
+TEST 'any' [[
+local function x(a, ...)
+ return true, 'ss', ...
+end
+local _, _, _, <?b?>, _ = x(nil, true, 1, 'yy')
+]]
--- 暂不支持这些特殊情况,之后用其他语法定义
+-- TODO 暂不支持这些特殊情况,之后用其他语法定义
--TEST 'integer' [[
--for <?i?> in ipairs(t) do
--end
--]]
---
---TEST 'any' [[
---local <?x?> = next()
---]]
+
+TEST 'any' [[
+local <?x?> = next()
+]]