summaryrefslogtreecommitdiff
path: root/server-beta/test/hover/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server-beta/test/hover/init.lua')
-rw-r--r--server-beta/test/hover/init.lua24
1 files changed, 8 insertions, 16 deletions
diff --git a/server-beta/test/hover/init.lua b/server-beta/test/hover/init.lua
index 87b4cc99..9552e753 100644
--- a/server-beta/test/hover/init.lua
+++ b/server-beta/test/hover/init.lua
@@ -1,28 +1,20 @@
-local parser = require 'parser'
-local core = require 'core'
-local buildVM = require 'vm'
+local core = require 'core.hover'
+local files = require 'files'
rawset(_G, 'TEST', true)
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('[!?]>', ' ')
- local ast = parser:parse(new_script, 'lua', 'Lua 5.3')
- local vm = buildVM(ast)
- assert(vm)
- local source = core.findSource(vm, pos)
- local hover = core.hover(source)
- 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
+ local hover = core(new_script, pos)
+ 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)
end
end