summaryrefslogtreecommitdiff
path: root/server/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-12 17:56:50 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-12 17:56:50 +0800
commitee7ddabf22768c57952e89098db9ffea84475ff7 (patch)
tree86f7e07c92a1925e9953eaef1755a410ed772f11 /server/test
parent94da0c9d659f7ac01bf75ccdc37f236e90f8900a (diff)
downloadlua-language-server-ee7ddabf22768c57952e89098db9ffea84475ff7.zip
支持函数返回类型
Diffstat (limited to 'server/test')
-rw-r--r--server/test/main.lua2
-rw-r--r--server/test/type_inference/init.lua19
2 files changed, 20 insertions, 1 deletions
diff --git a/server/test/main.lua b/server/test/main.lua
index f6b1cede..67e2da0a 100644
--- a/server/test/main.lua
+++ b/server/test/main.lua
@@ -26,7 +26,7 @@ local function main()
test 'vm'
test 'definition'
test 'diagnostics'
- --test 'type_inference'
+ test 'type_inference'
test 'find_lib'
print('测试完成')
diff --git a/server/test/type_inference/init.lua b/server/test/type_inference/init.lua
index 3686451f..c906fdd4 100644
--- a/server/test/type_inference/init.lua
+++ b/server/test/type_inference/init.lua
@@ -108,3 +108,22 @@ TEST 'number' [[
TEST 'table' [[
<?table?>()
]]
+
+TEST 'string' [[
+<?x?> = _VERSION
+]]
+
+TEST 'function' [[
+<?x?> = _VERSION.sub
+]]
+
+TEST 'table' [[
+<?x?> = setmetatable({})
+]]
+
+TEST 'number' [[
+local function x()
+ return 1
+end
+<?y?> = x()
+]]