diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-19 14:28:21 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-19 14:28:21 +0800 |
commit | 4fa58592a21c151b9235b4c8e774aa5583426a3e (patch) | |
tree | 80ab0d6a298b1246a06ed726ca8030e437e9e7c2 /server/test | |
parent | 2e634c583108b627ec941b8e178e74f19104ee7e (diff) | |
download | lua-language-server-4fa58592a21c151b9235b4c8e774aa5583426a3e.zip |
现代化改造一下
Diffstat (limited to 'server/test')
-rw-r--r-- | server/test/definition/init.lua | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/server/test/definition/init.lua b/server/test/definition/init.lua index 216fc6ed..190b5736 100644 --- a/server/test/definition/init.lua +++ b/server/test/definition/init.lua @@ -18,25 +18,19 @@ local function catch_target(script) end local function founded(targets, results) - while true do - local target = table.remove(targets) - if not target then - break - end - for i, result in ipairs(results) do + if #targets ~= #results then + return false + end + for _, target in ipairs(targets) do + for _, result in ipairs(results) do if target[1] == result[1] and target[2] == result[2] then - table.remove(results, i) - goto CONTINUE + goto NEXT end end do return false end - ::CONTINUE:: - end - if #results == 0 then - return true - else - return false + ::NEXT:: end + return true end function TEST(script) |