diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-27 10:30:59 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-27 10:30:59 +0800 |
commit | 5cf122870c659821929449d64bfc24d5913dbd77 (patch) | |
tree | 4a97f3ba09795033599148ddf66863ef70f1e550 /server/test/hover | |
parent | c396fb4527a5684b75672654f28208255954edcf (diff) | |
download | lua-language-server-5cf122870c659821929449d64bfc24d5913dbd77.zip |
hover过滤掉脏对象
Diffstat (limited to 'server/test/hover')
-rw-r--r-- | server/test/hover/init.lua | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/server/test/hover/init.lua b/server/test/hover/init.lua index 9b22e3dd..18a5e299 100644 --- a/server/test/hover/init.lua +++ b/server/test/hover/init.lua @@ -14,10 +14,14 @@ function TEST(script) assert(vm) local result, source = matcher.findResult(vm, pos) local hover = matcher.hover(result, source) - assert(hover) - expect = expect:gsub('^[\r\n]*(.-)[\r\n]*$', '%1'):gsub('\r\n', '\n') - local label = hover.label:gsub('^[\r\n]*(.-)[\r\n]*$', '%1'):gsub('\r\n', '\n') - assert(expect == label) + if expect then + assert(hover) + expect = expect:gsub('^[\r\n]*(.-)[\r\n]*$', '%1'):gsub('\r\n', '\n') + local label = hover.label:gsub('^[\r\n]*(.-)[\r\n]*$', '%1'):gsub('\r\n', '\n') + assert(expect == label) + else + assert(hover == nil) + end end end @@ -248,3 +252,8 @@ table.pack(n) [[ any n ]] + +TEST [[ +(<?'xxx'?>):sub() +]] +(nil) |