From d0ff66c9abe9d6abbca12fd811e0c3cb69c1033a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 22 Nov 2019 23:26:32 +0800 Subject: =?UTF-8?q?=E6=95=B4=E7=90=86=E4=B8=80=E4=B8=8B=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server-beta/test/definition/arg.lua | 19 --- server-beta/test/definition/bug.lua | 102 ---------------- server-beta/test/definition/call.lua | 8 -- server-beta/test/definition/emmy.lua | 91 --------------- server-beta/test/definition/function.lua | 24 ---- server-beta/test/definition/init.lua | 67 ----------- server-beta/test/definition/label.lua | 29 ----- server-beta/test/definition/local.lua | 195 ------------------------------- server-beta/test/definition/method.lua | 31 ----- server-beta/test/definition/set.lua | 40 ------- server-beta/test/definition/special.lua | 124 -------------------- server-beta/test/definition/table.lua | 135 --------------------- 12 files changed, 865 deletions(-) delete mode 100644 server-beta/test/definition/arg.lua delete mode 100644 server-beta/test/definition/bug.lua delete mode 100644 server-beta/test/definition/call.lua delete mode 100644 server-beta/test/definition/emmy.lua delete mode 100644 server-beta/test/definition/function.lua delete mode 100644 server-beta/test/definition/init.lua delete mode 100644 server-beta/test/definition/label.lua delete mode 100644 server-beta/test/definition/local.lua delete mode 100644 server-beta/test/definition/method.lua delete mode 100644 server-beta/test/definition/set.lua delete mode 100644 server-beta/test/definition/special.lua delete mode 100644 server-beta/test/definition/table.lua (limited to 'server-beta/test/definition') diff --git a/server-beta/test/definition/arg.lua b/server-beta/test/definition/arg.lua deleted file mode 100644 index 9e88b2bf..00000000 --- a/server-beta/test/definition/arg.lua +++ /dev/null @@ -1,19 +0,0 @@ -TEST [[ -local function xx () - () -end -]] - -TEST [[ -local -function mt:x() - () -end -mt:x() -]] - -TEST [[ -function mt:x() - () -end -]] diff --git a/server-beta/test/definition/bug.lua b/server-beta/test/definition/bug.lua deleted file mode 100644 index 823db46d..00000000 --- a/server-beta/test/definition/bug.lua +++ /dev/null @@ -1,102 +0,0 @@ -TEST [[ -local -function _(x) -end -function _() - () -end -]] - -TEST [[ -function _() - do return end - () -end -]] - -TEST [[ -local -function a:b() - a:b() - () -end -]] - -TEST [[ -function _(...) - function _() - print() - end -end -]] - -TEST [[ -local -( / b)() -]] - -TEST [[ -local -io.load(root / .source / 'API' / path) -]] - -TEST [[ -obj[#+1] = {} -]] - -TEST [[ -self = { - results = { - = {}, - } -} -self[self.results.] = lbl -]] - -TEST [[ -self.results = { - = {}, -} -self[self.results.] = lbl -]] - -TEST [[ -self.results. = {} -self[self.results.] = lbl -]] - -TEST [[ -local mt = {} -function mt:() -end -mt:x() -mt:() -]] - -TEST [[ -local function func() - x = { - xx(), - , - } -end -]] - -TEST [[ -local -local t = { - ..., - , -} -]] - -TEST [[ -local a -local -return f(), -]] - -TEST [[ -local a = os.clock() -local ?> = os.clock() -]] diff --git a/server-beta/test/definition/call.lua b/server-beta/test/definition/call.lua deleted file mode 100644 index 42502f40..00000000 --- a/server-beta/test/definition/call.lua +++ /dev/null @@ -1,8 +0,0 @@ -TEST [[ -function f() - local - return -end -local = f() -print() -]] diff --git a/server-beta/test/definition/emmy.lua b/server-beta/test/definition/emmy.lua deleted file mode 100644 index ee8fa6a7..00000000 --- a/server-beta/test/definition/emmy.lua +++ /dev/null @@ -1,91 +0,0 @@ -TEST [[ ----@class ----@class B : -]] - -TEST [[ ----@class ----@type B| -]] - -TEST [[ ----@class A -local mt = {} -function mt:() -end - ----@type A -local obj -obj:() -]] - -TEST [[ ----@class A -local = {} -function mt:cast() -end - ----@type A -local -:cast() -]] - -TEST [[ ----@type A -local ?> - ----@class A -local -]] - -TEST [[ ----@type A -local obj -obj:() - ----@class A -local mt -function mt:() -end -]] - -TEST [[ ----@type A -local obj -obj:() - -local mt = {} -mt.__index = mt -function mt:() -end ----@class A -local obj = setmetatable({}, mt) -]] - -TEST [[ ----@alias ----@type -]] - -TEST [[ ----@class ----@param a -]] - -TEST [[ ----@class Class ----@field ----@field id integer -local mt = {} -mt. -]] - -TEST [[ ----@class loli -local unit - -function unit:() -end - ----@see loli# -]] diff --git a/server-beta/test/definition/function.lua b/server-beta/test/definition/function.lua deleted file mode 100644 index ce20f50b..00000000 --- a/server-beta/test/definition/function.lua +++ /dev/null @@ -1,24 +0,0 @@ - -TEST [[ -function () end -() -]] - -TEST [[ -local function () end -() -]] - -TEST [[ -local x -local function () - () -end -]] - -TEST [[ -local -function () -end -() -]] diff --git a/server-beta/test/definition/init.lua b/server-beta/test/definition/init.lua deleted file mode 100644 index 645765a2..00000000 --- a/server-beta/test/definition/init.lua +++ /dev/null @@ -1,67 +0,0 @@ -local core = require 'core.definition' -local files = require 'files' - -rawset(_G, 'TEST', true) - -local function catch_target(script) - local list = {} - local cur = 1 - while true do - local start, finish = script:find('', cur) - if not start then - break - end - list[#list+1] = { start + 2, finish - 2 } - cur = finish + 1 - end - return list -end - -local function founded(targets, results) - 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 - goto NEXT - end - end - do return false end - ::NEXT:: - end - return true -end - -function TEST(script) - files.removeAll() - local target = catch_target(script) - local start = script:find('', 1, true) - local pos = (start + finish) // 2 + 1 - local new_script = script:gsub('<[!?]', ' '):gsub('[!?]>', ' ') - files.setText('', new_script) - - local results = core('', pos) - if results then - local positions = {} - for i, result in ipairs(results) do - positions[i] = { result.target.start, result.target.finish } - end - assert(founded(target, positions)) - else - assert(#target == 0) - end -end - -require 'definition.local' -require 'definition.set' -require 'definition.arg' -require 'definition.function' -require 'definition.table' -require 'definition.method' -require 'definition.label' -require 'definition.call' -require 'definition.bug' -require 'definition.special' ---require 'definition.emmy' diff --git a/server-beta/test/definition/label.lua b/server-beta/test/definition/label.lua deleted file mode 100644 index 205915b6..00000000 --- a/server-beta/test/definition/label.lua +++ /dev/null @@ -1,29 +0,0 @@ -TEST [[ -:::: -goto -]] - -TEST [[ -goto -:::: -]] - -TEST [[ -::LABEL:: -function _() - goto -end -]] - -TEST [[ -do - goto -end -:::: -]] - -TEST [[ -::LABEL:: -goto -:::: -]] diff --git a/server-beta/test/definition/local.lua b/server-beta/test/definition/local.lua deleted file mode 100644 index 4153bfa0..00000000 --- a/server-beta/test/definition/local.lua +++ /dev/null @@ -1,195 +0,0 @@ -TEST [[ -local -() -]] - -TEST [[ -local z, y, -() -]] - -TEST [[ -local = 1 -() -]] - -TEST [[ -local z, y, = 1 -() -]] - -TEST [[ -local x -local -() -]] - -TEST [[ -local -do - () -end -]] - -TEST [[ -local -do - local x -end -() -]] - -TEST [[ -local -if then - local x -end -]] - -TEST [[ -local -if x then - local x -elseif then - local x -end -]] - -TEST [[ -local -if x then - local x -elseif x then - local x -else - local x -end -() -]] - -TEST [[ -local -if x then - () -elseif x then - local x -else - local x -end -]] - -TEST [[ -local -for x = 1, 10 do -end -() -]] - -TEST [[ -local x -for = 1, 10 do - () -end -]] - -TEST [[ -local -for x in x do -end -() -]] - -TEST [[ -local -for x in do -end -]] - -TEST [[ -local x -for in x do - () -end -]] - -TEST [[ -local x -for z, y, in x do - () -end -]] - -TEST [[ -local -while do -end -]] - -TEST [[ -local -while x do - () -end -]] - -TEST [[ -local -while x do - local x -end -() -]] - -TEST [[ -local -repeat - () -until true -]] - -TEST [[ -local -repeat - local x -until true -() -]] - -TEST [[ -local -repeat -until -]] - -TEST [[ -local x -repeat - local -until -]] - -TEST [[ -local -function _() - local x -end -() -]] - -TEST [[ -local -return function () - () -end -]] - -TEST [[ -local -local x = function () - () -end -]] - -TEST [[ -local ?> -]] diff --git a/server-beta/test/definition/method.lua b/server-beta/test/definition/method.lua deleted file mode 100644 index aa7aacdc..00000000 --- a/server-beta/test/definition/method.lua +++ /dev/null @@ -1,31 +0,0 @@ -TEST [[ -function mt:() -end -function mt:b() - mt:() -end -]] - -TEST [[ -function mt:() -end -function mt:m2() - self:() -end -]] - -TEST [[ -function mt:m3() - mt:() -end -function mt:() -end -]] - -TEST [[ -function mt:m3() - self:() -end -function mt:() -end -]] diff --git a/server-beta/test/definition/set.lua b/server-beta/test/definition/set.lua deleted file mode 100644 index f36be078..00000000 --- a/server-beta/test/definition/set.lua +++ /dev/null @@ -1,40 +0,0 @@ -TEST [[ - = 1 -() -]] - -TEST [[ -do - = 1 -end -() -]] - -TEST [[ - = 1 -do - local x = 1 -end -() -]] - -TEST [[ -x = 1 -do - local = 1 - do - = 2 - end - () -end -]] - -TEST [[ - = 1 -if y then - = 2 -else - = 3 -end -print() -]] diff --git a/server-beta/test/definition/special.lua b/server-beta/test/definition/special.lua deleted file mode 100644 index 6bbf104c..00000000 --- a/server-beta/test/definition/special.lua +++ /dev/null @@ -1,124 +0,0 @@ -TEST [[ -_ENV. = 1 -print() -]] - -TEST [[ -_G. = 1 -print() -]] - -TEST [[ - -print() -]] - -TEST [[ -local mt -mt.__index = mt -function mt:() -end - -local obj = setmetatable({}, mt) -obj:() -]] - -TEST [[ -local mt -function mt:() -end - -local obj = setmetatable({}, { __index = mt }) -obj:() -]] - -TEST [[ -local mt -function mt:() -end - -setmetatable(api, { __index = mt }) -api:() -]] - -TEST [[ -local mt -local api -function mt:() -end - -setmetatable(api, { __index = mt }) -api:() -]] - -TEST [[ -local mt -function mt:x() - self.() -end - -local obj, _ = setmetatable({}, { __index = mt }) -obj. = 1 -obj:x() -]] - -TEST [[ -local mt -function mt:x() - self.() -end - -local obj = setmetatable({ = 1 }, { __index = mt }) -obj:x() -]] - -TEST [[ -local mt -function mt:x() - self.a.() -end - -local obj = setmetatable({ - a = { - = 1, - } -}, { __index = mt }) -obj:x() -]] - -TEST [[ -local sm = setmetatable -local mt -mt.__index = mt -function mt:() -end - -local obj = sm({}, mt) -obj:() -]] - --- TODO ---TEST [[ ---local mt = {} ---function mt:() ---end --- ---local obj = setmetatable({}, {__index = mt}) ---function obj:x() ---end --- ---mt:() ---]] - --- TODO 通过代码执行顺序来判断 ---TEST [[ ---local mt = {} ---function mt:x() ---end --- ---local obj = setmetatable({}, {__index = mt}) ---function obj:() ---end --- ---obj:() ---]] diff --git a/server-beta/test/definition/table.lua b/server-beta/test/definition/table.lua deleted file mode 100644 index 34078413..00000000 --- a/server-beta/test/definition/table.lua +++ /dev/null @@ -1,135 +0,0 @@ -TEST [[ -local -a = { - -} -]] - -TEST [[ -local t -t. = 1 -t.() -]] - -TEST [[ -t. = 1 -t.() -]] - -TEST [[ -local -t.x = 1 -.x = 1 -]] - -TEST [[ -t. = 1 -t..y = 1 -]] - -TEST [[ -local t -t. = 1 -t.() -]] - -TEST [[ -local t -t[] = 1 -t[]() -]] - -TEST [[ -local t -t[] = 1 -t[]() -]] - -TEST [[ -local t -t[] = 1 -t[]() -]] - -TEST [[ -local t -t[] = 1 -t[]() -]] - -TEST [[ -local t -t. = 1 -t[]() -]] - -TEST [[ -local t -t. = 1 -t..b() -]] - -TEST [[ -local t -local -t[]() -]] - -TEST[[ -local -local _ = { - _ = -} -]] - -TEST[[ -local -t { - _ = .x -} -]] - -TEST[[ -local t = { - = 1, -} -t.() -]] - -TEST[[ -local t = { - [] = 1, -} -t.() -]] - -TEST[[ -local t;t = { - = 1, -} -t.() -]] - -TEST[[ -local t;t = { - = 1, -} -t.() -]] - ---TEST[[ ---local t = { --- = 1, ---} ---y.() ---]] - ---TEST[[ ---local t = { --- = 1, ---} ---local y = { --- insert = 1, ---} ---t.() ---]] -- cgit v1.2.3