diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-10-26 16:19:52 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-10-26 16:20:01 +0800 |
commit | 088f65ea422b6a7727a3e8a20f379d2ecddc633c (patch) | |
tree | 304672af2097b5df4401cb51a7192d097c539b29 /test/crossfile | |
parent | a55b04fc938b5b689201a7e3d330a7be9009e8ba (diff) | |
download | lua-language-server-088f65ea422b6a7727a3e8a20f379d2ecddc633c.zip |
update test
Diffstat (limited to 'test/crossfile')
-rw-r--r-- | test/crossfile/hover.lua | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index fee0f068..35528446 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -49,9 +49,11 @@ function TEST(expect) files.setText(targetUri, targetScript) files.setText(sourceUri, sourceScript) - local cachedList = targetList['?'] + sourceList['?'] - - local sourcePos = (cachedList[1][1] + cachedList[1][2]) // 2 + if targetList['?'] then + local targetPos = (targetList['?'][1][1] + targetList['?'][1][2]) // 2 + core.byUri(targetUri, targetPos) + end + local sourcePos = (sourceList['?'][1][1] + sourceList['?'][1][2]) // 2 local hover = core.byUri(sourceUri, sourcePos) assert(hover) hover = tostring(hover):gsub('\r\n', '\n') @@ -1025,22 +1027,22 @@ TEST { { path = 'a.lua', content = [[ +---@type string[] +local ss - - -for _, x in ipairs({} and {}) do - print(<?x?>) -- `x` is infered as `string` +for _, s in ipairs(ss) do + print(<?s?>) end ]], }, { path = 'b.lua', content = [[ ----@type string[] -local ss -for _, s in ipairs(ss) do - print(s) + + +for _, x in ipairs({} and {}) do + print(<?x?>) -- `x` is infered as `string` end ]], }, |