summaryrefslogtreecommitdiff
path: root/test/hover/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/hover/init.lua')
-rw-r--r--test/hover/init.lua12
1 files changed, 4 insertions, 8 deletions
diff --git a/test/hover/init.lua b/test/hover/init.lua
index 3f07ea30..c16e466d 100644
--- a/test/hover/init.lua
+++ b/test/hover/init.lua
@@ -1,7 +1,6 @@
local core = require 'core.hover'
-local findSource = require 'core.find-source'
-local getLabel = require 'core.hover.label'
local files = require 'files'
+local catch = require 'catch'
rawset(_G, 'TEST', true)
@@ -23,12 +22,9 @@ local accept = {
function TEST(script)
return function (expect)
files.removeAll()
- local start = script:find('<?', 1, true)
- local finish = script:find('?>', 1, true)
- local pos = (start + finish) // 2 + 1
- local new_script = script:gsub('<[!?]', ' '):gsub('[!?]>', ' ')
- files.setText('', new_script)
- local hover = core.byUri('', pos)
+ local newScript, catched = catch(script, '?')
+ files.setText('', newScript)
+ local hover = core.byUri('', catched['?'][1][1])
assert(hover)
expect = expect:gsub('^[\r\n]*(.-)[\r\n]*$', '%1'):gsub('\r\n', '\n')
local label = tostring(hover):match('```lua[\r\n]*(.-)[\r\n]*```'):gsub('\r\n', '\n')