diff options
Diffstat (limited to 'test/crossfile')
-rw-r--r-- | test/crossfile/completion.lua | 31 | ||||
-rw-r--r-- | test/crossfile/infer.lua | 53 |
2 files changed, 84 insertions, 0 deletions
diff --git a/test/crossfile/completion.lua b/test/crossfile/completion.lua index d613f621..113b0327 100644 --- a/test/crossfile/completion.lua +++ b/test/crossfile/completion.lua @@ -127,6 +127,37 @@ end TEST { { path = 'abc.lua', + content = [[ + ---@meta + + ---@class A + ---@field f1 integer + ---@field f2 boolean + + ---@type A[] + X = {} +]], + }, + { + path = 'test.lua', + content = [[ X[1].<??>]], + main = true, + }, + completion = { + { + label = 'f1', + kind = CompletionItemKind.Field, + }, + { + label = 'f2', + kind = CompletionItemKind.Field, + }, + } +} + +TEST { + { + path = 'abc.lua', content = '', }, { diff --git a/test/crossfile/infer.lua b/test/crossfile/infer.lua index 2f2c35ad..de29007b 100644 --- a/test/crossfile/infer.lua +++ b/test/crossfile/infer.lua @@ -110,3 +110,56 @@ end }, infer = 'V', } + +TEST { + { path = 'a.lua', content = [[ +X = 1 +X = true +]], }, + { path = 'b.lua', content = [[ +print(<?X?>) +]], }, + infer = 'integer', +} + +TEST { + { path = 'a.lua', content = [[ +---@meta +X = 1 +X = true +]], }, + { path = 'b.lua', content = [[ +print(<?X?>) +]], }, + infer = 'boolean|integer', +} + +TEST { + { path = 'a.lua', content = [[ +return 1337, "string", true +]], }, + { path = 'b.lua', content = [[ +local <?a?>, b, c = require 'a +]], }, + infer = 'integer', +} + +TEST { + { path = 'a.lua', content = [[ +return 1337, "string", true +]], }, + { path = 'b.lua', content = [[ +local a, <?b?>, c = require 'a +]], }, + infer = 'unknown', +} + +TEST { + { path = 'a.lua', content = [[ +return 1337, "string", true +]], }, + { path = 'b.lua', content = [[ +local a, b, <?c?> = require 'a +]], }, + infer = 'nil', +} |