summaryrefslogtreecommitdiff
path: root/test/crossfile
diff options
context:
space:
mode:
Diffstat (limited to 'test/crossfile')
-rw-r--r--test/crossfile/completion.lua109
-rw-r--r--test/crossfile/definition.lua25
-rw-r--r--test/crossfile/diagnostic.lua1
-rw-r--r--test/crossfile/hover.lua3
4 files changed, 136 insertions, 2 deletions
diff --git a/test/crossfile/completion.lua b/test/crossfile/completion.lua
index 172f9d6f..50ebad45 100644
--- a/test/crossfile/completion.lua
+++ b/test/crossfile/completion.lua
@@ -80,6 +80,7 @@ local function removeMetas(results)
util.tableMultiRemove(results, removes)
end
+---@diagnostic disable: await-in-sync
function TEST(data)
files.removeAll()
@@ -87,7 +88,7 @@ function TEST(data)
local pos
for _, info in ipairs(data) do
local uri = furi.encode(info.path)
- local script = info.content
+ local script = info.content or ''
if info.main then
local newScript, catched = catch(script, '?')
pos = catched['?'][1][1]
@@ -565,9 +566,115 @@ TEST {
]],
main = true,
},
+ completion = nil,
}
TEST {
+ { path = 'f/a.lua' },
+ { path = 'f/b.lua' },
+ {
+ path = 'c.lua',
+ content = [[
+ require '<??>'
+ ]],
+ main = true,
+ },
+ completion = {
+ {
+ label = 'a',
+ kind = CompletionItemKind.Reference,
+ textEdit = EXISTS,
+ },
+ {
+ label = 'b',
+ kind = CompletionItemKind.Reference,
+ textEdit = EXISTS,
+ },
+ {
+ label = 'f.a',
+ kind = CompletionItemKind.Reference,
+ textEdit = EXISTS,
+ },
+ {
+ label = 'f.b',
+ kind = CompletionItemKind.Reference,
+ textEdit = EXISTS,
+ },
+ }
+}
+
+TEST {
+ { path = 'f/a.lua' },
+ { path = 'f/b.lua' },
+ {
+ path = 'c.lua',
+ content = [[
+ require 'a<??>'
+ ]],
+ main = true,
+ },
+ completion = {
+ {
+ label = 'a',
+ kind = CompletionItemKind.Reference,
+ textEdit = EXISTS,
+ },
+ {
+ label = 'f.a',
+ kind = CompletionItemKind.Reference,
+ textEdit = EXISTS,
+ },
+ }
+}
+
+config.set('Lua.runtime.pathStrict', true)
+
+TEST {
+ { path = 'f/a.lua' },
+ { path = 'f/b.lua' },
+ {
+ path = 'c.lua',
+ content = [[
+ require '<??>'
+ ]],
+ main = true,
+ },
+ completion = {
+ {
+ label = 'f.a',
+ kind = CompletionItemKind.Reference,
+ textEdit = EXISTS,
+ },
+ {
+ label = 'f.b',
+ kind = CompletionItemKind.Reference,
+ textEdit = EXISTS,
+ },
+ }
+}
+
+TEST {
+ { path = 'f/a.lua' },
+ { path = 'f/b.lua' },
+ {
+ path = 'c.lua',
+ content = [[
+ require 'a<??>'
+ ]],
+ main = true,
+ },
+ completion = {
+ {
+ label = 'f.a',
+ kind = CompletionItemKind.Reference,
+ textEdit = EXISTS,
+ },
+ }
+}
+
+config.set('Lua.runtime.pathStrict', false)
+
+TEST {
{
path = 'xxx.lua',
content = ''
diff --git a/test/crossfile/definition.lua b/test/crossfile/definition.lua
index b233141c..058f5d18 100644
--- a/test/crossfile/definition.lua
+++ b/test/crossfile/definition.lua
@@ -117,6 +117,31 @@ TEST {
},
}
+config.set('Lua.runtime.pathStrict', true)
+TEST {
+ {
+ path = 'aaa/bbb.lua',
+ content = '',
+ },
+ {
+ path = 'b.lua',
+ content = 'require "<?bbb?>"',
+ },
+}
+
+TEST {
+ {
+ path = 'aaa/bbb.lua',
+ content = '<!!>',
+ },
+ {
+ path = 'b.lua',
+ content = 'require "<?aaa.bbb?>"',
+ },
+}
+
+config.set('Lua.runtime.pathStrict', false)
+
TEST {
{
path = 'a.lua',
diff --git a/test/crossfile/diagnostic.lua b/test/crossfile/diagnostic.lua
index 7735f4c5..c2d043f4 100644
--- a/test/crossfile/diagnostic.lua
+++ b/test/crossfile/diagnostic.lua
@@ -29,6 +29,7 @@ local function founded(targets, results)
return true
end
+---@diagnostic disable: await-in-sync
function TEST(datas)
files.removeAll()
diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua
index 35528446..f23850a5 100644
--- a/test/crossfile/hover.lua
+++ b/test/crossfile/hover.lua
@@ -37,6 +37,7 @@ local function eq(a, b)
return a == b
end
+---@diagnostic disable: await-in-sync
function TEST(expect)
files.removeAll()
@@ -592,7 +593,7 @@ function f(arg1: integer, arg2: integer)
---
```lua
-function f()
+function f(arg3: any)
```]]}