summaryrefslogtreecommitdiff
path: root/server/test/definition
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-11-29 09:56:54 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-11-29 09:56:54 +0800
commit79d073d7b3ae2f508f0d2e154ed59f87530740e7 (patch)
treedfc428c3ca49671435c2e2a99889c97a2f505950 /server/test/definition
parent9d2265692897472cb1efc3891ef89fe3a58126b0 (diff)
downloadlua-language-server-79d073d7b3ae2f508f0d2e154ed59f87530740e7.zip
换成新的parser
Diffstat (limited to 'server/test/definition')
-rw-r--r--server/test/definition/init.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/server/test/definition/init.lua b/server/test/definition/init.lua
index b88cfeef..8bf2411d 100644
--- a/server/test/definition/init.lua
+++ b/server/test/definition/init.lua
@@ -1,4 +1,5 @@
local matcher = require 'matcher'
+local parser = require 'parser'
rawset(_G, 'TEST', true)
@@ -7,8 +8,10 @@ function TEST(script)
local finish = script:find('!>', 1, true) - 1
local pos = script:find('<?', 1, true) + 2
local new_script = script:gsub('<[!?]', ' '):gsub('[!?]>', ' ')
+ local ast, err = parser:ast(new_script)
+ assert(ast)
- local suc, a, b = matcher.definition(new_script, pos)
+ local suc, a, b = matcher.definition(ast, pos)
assert(suc)
assert(a == start)
assert(b == finish)