diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-03-16 17:03:11 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-03-16 17:03:11 +0800 |
commit | f09aca72ff61f2ec997a6be57a3204865dfd1f6e (patch) | |
tree | f51fe1cfee4e2db59bd721c03bb619f184835234 /test/completion | |
parent | 5a3d967ce028460adc34b7a227239202248a4f0d (diff) | |
download | lua-language-server-f09aca72ff61f2ec997a6be57a3204865dfd1f6e.zip |
pass test
Diffstat (limited to 'test/completion')
-rw-r--r-- | test/completion/init.lua | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/test/completion/init.lua b/test/completion/init.lua index 1a3c088b..b8c988f9 100644 --- a/test/completion/init.lua +++ b/test/completion/init.lua @@ -31,6 +31,25 @@ local function eq(a, b) return a == b end +local function include(a, b) + if a == EXISTS and b ~= nil then + return true + end + local tp1, tp2 = type(a), type(b) + if tp1 ~= tp2 then + return false + end + if tp1 == 'table' then + for k in pairs(a) do + if not eq(a[k], b[k]) then + return false + end + end + return true + end + return a == b +end + rawset(_G, 'TEST', true) local Cared = { @@ -68,7 +87,12 @@ function TEST(script) end end assert(result) - assert(eq(expect, result)) + if expect.include then + expect.include = nil + assert(include(expect, result)) + else + assert(eq(expect, result)) + end end end @@ -2086,6 +2110,23 @@ f({aaa $}) TEST [[ ---@class cc +---@field iffff number # a1 + +---@param x cc +local function f(x) end + +f({if$}) +]] +{ + include = true, + { + label = 'iffff', + kind = define.CompletionItemKind.Property, + }, +} + +TEST [[ +---@class cc ---@field aaa number # a1 ---@field bbb number # a2 |