diff options
Diffstat (limited to 'server-beta/test/rename/init.lua')
-rw-r--r-- | server-beta/test/rename/init.lua | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/server-beta/test/rename/init.lua b/server-beta/test/rename/init.lua index 646401a0..fdb47ebe 100644 --- a/server-beta/test/rename/init.lua +++ b/server-beta/test/rename/init.lua @@ -1,6 +1,5 @@ -local core = require 'core' -local parser = require 'parser' -local buildVM = require 'vm' +local core = require 'core.rename' +local files = require 'files' local function catch_target(script) local list = {} @@ -10,7 +9,10 @@ local function catch_target(script) if not start then break end - list[#list+1] = { start + 2, finish - 2 } + list[#list+1] = { + start = start + 2, + finish = finish - 2, + } cur = finish + 1 end return list @@ -22,7 +24,7 @@ local function founded(targets, results) end for _, target in ipairs(targets) do for _, result in ipairs(results) do - if target[1] == result[1] and target[2] == result[2] then + if target.start == result.start and target.finish == result.finish then goto NEXT end end @@ -34,17 +36,15 @@ end function TEST(newName) return function (script) + files.removeAll() local target = catch_target(script) 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') - assert(ast) - local vm = buildVM(ast) - assert(vm) + files.setText('', new_script) - local positions = core.rename(vm, pos, newName) + local positions = core('', pos, newName) if positions then assert(founded(target, positions)) else |