From 4ca61ec457822dd14966afa0752340ae8ce180a1 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, 20 Nov 2020 21:57:09 +0800 Subject: no longer beta --- test-beta/definition/arg.lua | 19 ---- test-beta/definition/bug.lua | 131 ------------------------- test-beta/definition/call.lua | 8 -- test-beta/definition/function.lua | 24 ----- test-beta/definition/init.lua | 70 -------------- test-beta/definition/label.lua | 29 ------ test-beta/definition/local.lua | 195 -------------------------------------- test-beta/definition/luadoc.lua | 140 --------------------------- test-beta/definition/method.lua | 31 ------ test-beta/definition/set.lua | 40 -------- test-beta/definition/special.lua | 126 ------------------------ test-beta/definition/table.lua | 159 ------------------------------- 12 files changed, 972 deletions(-) delete mode 100644 test-beta/definition/arg.lua delete mode 100644 test-beta/definition/bug.lua delete mode 100644 test-beta/definition/call.lua delete mode 100644 test-beta/definition/function.lua delete mode 100644 test-beta/definition/init.lua delete mode 100644 test-beta/definition/label.lua delete mode 100644 test-beta/definition/local.lua delete mode 100644 test-beta/definition/luadoc.lua delete mode 100644 test-beta/definition/method.lua delete mode 100644 test-beta/definition/set.lua delete mode 100644 test-beta/definition/special.lua delete mode 100644 test-beta/definition/table.lua (limited to 'test-beta/definition') diff --git a/test-beta/definition/arg.lua b/test-beta/definition/arg.lua deleted file mode 100644 index 9e88b2bf..00000000 --- a/test-beta/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/test-beta/definition/bug.lua b/test-beta/definition/bug.lua deleted file mode 100644 index 0550b3b9..00000000 --- a/test-beta/definition/bug.lua +++ /dev/null @@ -1,131 +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() -]] - -TEST [[ -local mt = {} - -function mt:(a, b) -end - -local function init() - return mt -end - -local t = init() -t:() -]] - -TEST [[ -local mt = {} -mt.__index = mt - -function mt:(a, b) -end - -local function init() - return setmetatable({}, mt) -end - -local t = init() -t:() -]] diff --git a/test-beta/definition/call.lua b/test-beta/definition/call.lua deleted file mode 100644 index 42502f40..00000000 --- a/test-beta/definition/call.lua +++ /dev/null @@ -1,8 +0,0 @@ -TEST [[ -function f() - local - return -end -local = f() -print() -]] diff --git a/test-beta/definition/function.lua b/test-beta/definition/function.lua deleted file mode 100644 index ce20f50b..00000000 --- a/test-beta/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/test-beta/definition/init.lua b/test-beta/definition/init.lua deleted file mode 100644 index 6e6d0a9a..00000000 --- a/test-beta/definition/init.lua +++ /dev/null @@ -1,70 +0,0 @@ -local core = require 'core.definition' -local files = require 'files' -local vm = require 'vm' - -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 - if not vm.isMetaFile(result.uri) then - positions[i] = { result.target.start, result.target.finish } - end - 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.luadoc' diff --git a/test-beta/definition/label.lua b/test-beta/definition/label.lua deleted file mode 100644 index 205915b6..00000000 --- a/test-beta/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/test-beta/definition/local.lua b/test-beta/definition/local.lua deleted file mode 100644 index 4153bfa0..00000000 --- a/test-beta/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/test-beta/definition/luadoc.lua b/test-beta/definition/luadoc.lua deleted file mode 100644 index 9360e27c..00000000 --- a/test-beta/definition/luadoc.lua +++ /dev/null @@ -1,140 +0,0 @@ -TEST [[ ----@class ----@class B : -]] - -TEST [[ ----@class ----@type B| -]] - -TEST [[ ----@class Class -local ?> ----@type Class -local x -]] - -TEST [[ ----@class Class -local ----@type Class -local ?> -]] - -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 A ----@type -]] - -TEST [[ ----@class ----@param a -]] - -TEST [[ ----@param f -function t(?>) end -]] - -TEST [[ ----@overload fun(y: boolean) ----@param x number ----@param y boolean ----@param z string -function (x, y, z) end - -print() -]] - -TEST [[ -local function f() - return 1 -end - ----@class Class -local - ----@type Class -local ?> = f() -]] - -TEST [[ ----@class Class ----@field string ----@field id integer -local mt = {} -mt. -]] - -TEST [[ ----@alias string - ----@type -]] - --- TODO -do return end -TEST [[ ----@class loli -local unit - -function unit:() -end - ----@see loli# -]] diff --git a/test-beta/definition/method.lua b/test-beta/definition/method.lua deleted file mode 100644 index aa7aacdc..00000000 --- a/test-beta/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/test-beta/definition/set.lua b/test-beta/definition/set.lua deleted file mode 100644 index f36be078..00000000 --- a/test-beta/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/test-beta/definition/special.lua b/test-beta/definition/special.lua deleted file mode 100644 index 4e3728e3..00000000 --- a/test-beta/definition/special.lua +++ /dev/null @@ -1,126 +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:() -]] - --- TODO 不支持从方法内部找外部的赋值 ---TEST [[ ---local mt ---function mt:x() --- self.() ---end --- ---local obj, _ = setmetatable({}, { __index = mt }) ---obj. = 1 ---obj:x() ---]] - --- TODO 不支持从方法内部找外部的赋值 ---TEST [[ ---local mt ---function mt:x() --- self.() ---end --- ---local obj = setmetatable({ = 1 }, { __index = mt }) ---obj:x() ---]] - --- TODO 不支持从方法内部找外部的赋值 ---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:() -]] - -TEST [[ -local mt = {} -function mt:() -end - -local obj = setmetatable({}, {__index = mt}) -function obj:x() -end - -mt:() -]] - --- TODO 通过代码执行顺序来判断? -TEST [[ -local mt = {} -function mt:() -end - -local obj = setmetatable({}, {__index = mt}) -function obj:() -end - -obj:() -]] diff --git a/test-beta/definition/table.lua b/test-beta/definition/table.lua deleted file mode 100644 index ba2d2aa3..00000000 --- a/test-beta/definition/table.lua +++ /dev/null @@ -1,159 +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.() -]] - -TEST [[ -local function f() - local t = {} - t.field1 = { - = 1, - y = 1, - z = 1, - } - t.field2 = { - x = 1, - y = 1, - z = 1, - } - t.field3 = { - x = 1, - y = 1, - z = 1, - } - return t -end -local t = f() -t.field1. -]] -- cgit v1.2.3