summaryrefslogtreecommitdiff
path: root/test/crossfile/hover.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/crossfile/hover.lua')
-rw-r--r--test/crossfile/hover.lua84
1 files changed, 71 insertions, 13 deletions
diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua
index 86471936..492efe43 100644
--- a/test/crossfile/hover.lua
+++ b/test/crossfile/hover.lua
@@ -41,20 +41,17 @@ end
function TEST(expect)
files.removeAll()
- local targetScript, targetList = catch(expect[1].content, '?')
- local targetUri = furi.encode(expect[1].path)
-
- local sourceScript, sourceList = catch(expect[2].content, '?')
- local sourceUri = furi.encode(expect[2].path)
-
- files.setText(targetUri, targetScript)
- files.setText(sourceUri, sourceScript)
-
- if targetList['?'] then
- local targetPos = (targetList['?'][1][1] + targetList['?'][1][2]) // 2
- core.byUri(targetUri, targetPos)
+ local sourcePos, sourceUri
+ for _, file in ipairs(expect) do
+ local script, list = catch(file.content, '?')
+ local uri = furi.encode(file.path)
+ files.setText(uri, script)
+ if list['?'] then
+ sourceUri = uri
+ sourcePos = (list['?'][1][1] + list['?'][1][2]) // 2
+ end
end
- local sourcePos = (sourceList['?'][1][1] + sourceList['?'][1][2]) // 2
+
local hover = core.byUri(sourceUri, sourcePos)
assert(hover)
hover = tostring(hover):gsub('\r\n', '\n')
@@ -1075,3 +1072,64 @@ global G: A {
}
```]]
}
+
+TEST {
+ {
+ path = 'a.lua',
+ content = [[
+ ---@overload fun(self, a)
+ function C:<?f?>(a, b) end
+ ]]
+ },
+ hover = [[
+```lua
+method C:f(a: any, b: any)
+```
+
+---
+
+```lua
+method C:f(a: any)
+```]]
+}
+
+TEST {
+ {
+ path = 'a.lua',
+ content = [[
+ ---@overload fun(self, a)
+ function C.<?f?>(a, b) end
+ ]]
+ },
+ hover = [[
+```lua
+function C.f(a: any, b: any)
+```
+
+---
+
+```lua
+function C.f(self: any, a: any)
+```]]
+}
+
+TEST {
+ {
+ path = 'a.lua',
+ content = [[
+ ---@async
+ ---@overload async fun(self, a)
+ function C:<?f?>(a, b) end
+ ]]
+ },
+ hover = [[
+```lua
+async method C:f(a: any, b: any)
+```
+
+---
+
+```lua
+async method C:f(a: any)
+```]]
+}