summaryrefslogtreecommitdiff
path: root/server/test/document_symbol/init.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-03-12 12:58:43 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-03-12 12:58:43 +0800
commitf1c1debb06035e2b9c11cb0a8486d14561bfc066 (patch)
treee107804918ff353c1b16a3832237b77c8a7bb867 /server/test/document_symbol/init.lua
parent650f1982d237282fecac43ba6362ec75302d91a1 (diff)
downloadlua-language-server-f1c1debb06035e2b9c11cb0a8486d14561bfc066.zip
修正bug
Diffstat (limited to 'server/test/document_symbol/init.lua')
-rw-r--r--server/test/document_symbol/init.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/server/test/document_symbol/init.lua b/server/test/document_symbol/init.lua
index f73cd6ba..fb75c3a7 100644
--- a/server/test/document_symbol/init.lua
+++ b/server/test/document_symbol/init.lua
@@ -61,6 +61,19 @@ local function eq(a, b)
return a == b
end
+local function checkArcoss(symbols)
+ local lastFinish = 0
+ for _, symbol in ipairs(symbols) do
+ assert(symbol.range[1] <= symbol.selectionRange[1])
+ assert(symbol.range[2] >= symbol.selectionRange[2])
+ assert(symbol.range[2] > lastFinish)
+ lastFinish = symbol.range[2]
+ if symbol.children then
+ checkArcoss(symbol.children)
+ end
+ end
+end
+
function TEST(script)
return function (expect)
local ast = parser:ast(script)
@@ -68,6 +81,7 @@ function TEST(script)
assert(vm)
local result = core.documentSymbol(vm)
assert(eq(expect, result))
+ checkArcoss(result)
end
end