diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-12 12:58:43 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-12 12:58:43 +0800 |
commit | f1c1debb06035e2b9c11cb0a8486d14561bfc066 (patch) | |
tree | e107804918ff353c1b16a3832237b77c8a7bb867 /server/test/document_symbol/init.lua | |
parent | 650f1982d237282fecac43ba6362ec75302d91a1 (diff) | |
download | lua-language-server-f1c1debb06035e2b9c11cb0a8486d14561bfc066.zip |
修正bug
Diffstat (limited to 'server/test/document_symbol/init.lua')
-rw-r--r-- | server/test/document_symbol/init.lua | 14 |
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 |