summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-03-04 16:57:57 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-03-04 16:57:57 +0800
commit171ed306f84850be46620145358dcfdf37387de2 (patch)
tree614bf1479866b23e6663e71daf4cb8bb0b4024f9 /test
parent9451329b33de1e7b69f2793ac5f94715826c9895 (diff)
downloadlua-language-server-171ed306f84850be46620145358dcfdf37387de2.zip
update
Diffstat (limited to 'test')
-rw-r--r--test/definition/bug.lua77
-rw-r--r--test/definition/luadoc.lua82
2 files changed, 70 insertions, 89 deletions
diff --git a/test/definition/bug.lua b/test/definition/bug.lua
index 58c2ed59..b564f764 100644
--- a/test/definition/bug.lua
+++ b/test/definition/bug.lua
@@ -251,80 +251,3 @@ local <!v!> = t[a]
t[a] = <?v?>
]]
-
-TEST [[
----@class A
----@field x number
-
----@class B: A
----@field <!x!> boolean
-
----@type B
-local t
-
-t.<?x?>
-]]
-
-TEST [[
----@class A
----@field <!x!> number
-
----@class B: A
-
----@type B
-local t
-
-t.<?x?>
-]]
-
-TEST [[
----@class A
-local A
-
-function A:x() end
-
----@class B: A
-local B
-
-<!function B:x() end!>
-
----@type B
-local t
-
-local <!<?v?>!> = t.x
-]]
-
-TEST [[
----@class A
-local A
-
-<!function A:x() end!>
-
----@class B: A
-local B
-
----@type B
-local t
-
-local <!<?v?>!> = t.x
-]]
-
--- TODO
---TEST [[
------@class A
---local A
---
------@return A
---function A:x() end
---
------@class B: A
---local <!B!>
---
------@return B
---function B:x() end
---
------@type B
---local t
---
---local <!<?v?>!> = t.x()
---]]
diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua
index 8124261c..118eff5e 100644
--- a/test/definition/luadoc.lua
+++ b/test/definition/luadoc.lua
@@ -17,7 +17,7 @@ local x
TEST [[
---@class Class
-local <!t!>
+local t
---@type Class
local <?<!x!>?>
]]
@@ -35,21 +35,59 @@ obj:<?cast?>()
TEST [[
---@class A
-local <!mt!> = {}
-function mt:cast()
-end
+---@field x number
----@type A
-local <!obj!>
-<?obj?>:cast()
+---@class B: A
+---@field <!x!> boolean
+
+---@type B
+local t
+
+t.<?x?>
]]
TEST [[
----@type A
-local <?<!obj!>?>
+---@class A
+---@field <!x!> number
+---@class B: A
+
+---@type B
+local t
+
+t.<?x?>
+]]
+
+TEST [[
---@class A
-local <!mt!>
+local A
+
+function A:x() end
+
+---@class B: A
+local B
+
+<!function B:x() end!>
+
+---@type B
+local t
+
+local <!<?v?>!> = t.x
+]]
+
+TEST [[
+---@class A
+local A
+
+<!function A:x() end!>
+
+---@class B: A
+local B
+
+---@type B
+local t
+
+local <!<?v?>!> = t.x
]]
TEST [[
@@ -116,11 +154,12 @@ print(<?f?>)
TEST [[
local function f()
- return 1
+ local x
+ return x
end
---@class Class
-local <!mt!>
+local mt
---@type Class
local <?<!x!>?> = f()
@@ -212,6 +251,25 @@ TEST [[
]]
TEST [[
+---@class A
+local A
+
+---@return A
+function A:x() end
+
+---@class B: A
+local <!B!>
+
+---@return B
+function B:x() end
+
+---@type B
+local t
+
+local <!<?v?>!> = t.x()
+]]
+
+TEST [[
---@return <!fun()!>
local function f() end