summaryrefslogtreecommitdiff
path: root/server-beta/test/definition
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-11-22 23:26:32 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-11-22 23:26:32 +0800
commitd0ff66c9abe9d6abbca12fd811e0c3cb69c1033a (patch)
treebb34518d70b85de7656dbdbe958dfa221a3ff3b3 /server-beta/test/definition
parent0a2c2ad15e1ec359171fb0dd4c72e57c5b66e9ba (diff)
downloadlua-language-server-d0ff66c9abe9d6abbca12fd811e0c3cb69c1033a.zip
整理一下目录结构
Diffstat (limited to 'server-beta/test/definition')
-rw-r--r--server-beta/test/definition/arg.lua19
-rw-r--r--server-beta/test/definition/bug.lua102
-rw-r--r--server-beta/test/definition/call.lua8
-rw-r--r--server-beta/test/definition/emmy.lua91
-rw-r--r--server-beta/test/definition/function.lua24
-rw-r--r--server-beta/test/definition/init.lua67
-rw-r--r--server-beta/test/definition/label.lua29
-rw-r--r--server-beta/test/definition/local.lua195
-rw-r--r--server-beta/test/definition/method.lua31
-rw-r--r--server-beta/test/definition/set.lua40
-rw-r--r--server-beta/test/definition/special.lua124
-rw-r--r--server-beta/test/definition/table.lua135
12 files changed, 0 insertions, 865 deletions
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 (<!xx!>)
- <?xx?>()
-end
-]]
-
-TEST [[
-local <!mt!>
-function mt:x()
- <?self?>()
-end
-mt:x()
-]]
-
-TEST [[
-function mt:x(<!self!>)
- <?self?>()
-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 <!x!>
-function _(x)
-end
-function _()
- <?x?>()
-end
-]]
-
-TEST [[
-function _(<!x!>)
- do return end
- <?x?>()
-end
-]]
-
-TEST [[
-local <!a!>
-function a:b()
- a:b()
- <?self?>()
-end
-]]
-
-TEST [[
-function _(...)
- function _()
- print(<?...?>)
- end
-end
-]]
-
-TEST [[
-local <!a!>
-(<?a?> / b)()
-]]
-
-TEST [[
-local <!args!>
-io.load(root / <?args?>.source / 'API' / path)
-]]
-
-TEST [[
-obj[#<?obj?>+1] = {}
-]]
-
-TEST [[
-self = {
- results = {
- <!labels!> = {},
- }
-}
-self[self.results.<?labels?>] = lbl
-]]
-
-TEST [[
-self.results = {
- <!labels!> = {},
-}
-self[self.results.<?labels?>] = lbl
-]]
-
-TEST [[
-self.results.<!labels!> = {}
-self[self.results.<?labels?>] = lbl
-]]
-
-TEST [[
-local mt = {}
-function mt:<!x!>()
-end
-mt:x()
-mt:<?x?>()
-]]
-
-TEST [[
-local function func(<!a!>)
- x = {
- xx(),
- <?a?>,
- }
-end
-]]
-
-TEST [[
-local <!x!>
-local t = {
- ...,
- <?x?>,
-}
-]]
-
-TEST [[
-local a
-local <!b!>
-return f(), <?b?>
-]]
-
-TEST [[
-local a = os.clock()
-local <?<!b!>?> = 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 <!x!>
- return <!x!>
-end
-local <!y!> = f()
-print(<?y?>)
-]]
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 <!A!>
----@class B : <?A?>
-]]
-
-TEST [[
----@class <!A!>
----@type B|<?A?>
-]]
-
-TEST [[
----@class A
-local mt = {}
-function mt:<!cast!>()
-end
-
----@type A
-local obj
-obj:<?cast?>()
-]]
-
-TEST [[
----@class A
-local <!mt!> = {}
-function mt:cast()
-end
-
----@type A
-local <!obj!>
-<?obj?>:cast()
-]]
-
-TEST [[
----@type A
-local <?<!obj!>?>
-
----@class A
-local <!mt!>
-]]
-
-TEST [[
----@type A
-local obj
-obj:<?func?>()
-
----@class A
-local mt
-function mt:<!func!>()
-end
-]]
-
-TEST [[
----@type A
-local obj
-obj:<?func?>()
-
-local mt = {}
-mt.__index = mt
-function mt:<!func!>()
-end
----@class A
-local obj = setmetatable({}, mt)
-]]
-
-TEST [[
----@alias <!B A!>
----@type <?B?>
-]]
-
-TEST [[
----@class <!Class!>
----@param a <?Class?>
-]]
-
-TEST [[
----@class Class
----@field <!name string!>
----@field id integer
-local mt = {}
-mt.<?name?>
-]]
-
-TEST [[
----@class loli
-local unit
-
-function unit:<!pants!>()
-end
-
----@see loli#<?pants?>
-]]
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 <!x!> () end
-<?x?>()
-]]
-
-TEST [[
-local function <!x!> () end
-<?x?>()
-]]
-
-TEST [[
-local x
-local function <!x!> ()
- <?x?>()
-end
-]]
-
-TEST [[
-local <!x!>
-function <!x!>()
-end
-<?x?>()
-]]
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 finish = 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 [[
-::<!LABEL!>::
-goto <?LABEL?>
-]]
-
-TEST [[
-goto <?LABEL?>
-::<!LABEL!>::
-]]
-
-TEST [[
-::LABEL::
-function _()
- goto <?LABEL?>
-end
-]]
-
-TEST [[
-do
- goto <?LABEL?>
-end
-::<!LABEL!>::
-]]
-
-TEST [[
-::LABEL::
-goto <?LABEL?>
-::<!LABEL!>::
-]]
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 <!x!>
-<?x?>()
-]]
-
-TEST [[
-local z, y, <!x!>
-<?x?>()
-]]
-
-TEST [[
-local <!x!> = 1
-<?x?>()
-]]
-
-TEST [[
-local z, y, <!x!> = 1
-<?x?>()
-]]
-
-TEST [[
-local x
-local <!x!>
-<?x?>()
-]]
-
-TEST [[
-local <!x!>
-do
- <?x?>()
-end
-]]
-
-TEST [[
-local <!x!>
-do
- local x
-end
-<?x?>()
-]]
-
-TEST [[
-local <!x!>
-if <?x?> then
- local x
-end
-]]
-
-TEST [[
-local <!x!>
-if x then
- local x
-elseif <?x?> then
- local x
-end
-]]
-
-TEST [[
-local <!x!>
-if x then
- local x
-elseif x then
- local x
-else
- local x
-end
-<?x?>()
-]]
-
-TEST [[
-local <!x!>
-if x then
- <?x?>()
-elseif x then
- local x
-else
- local x
-end
-]]
-
-TEST [[
-local <!x!>
-for x = 1, 10 do
-end
-<?x?>()
-]]
-
-TEST [[
-local x
-for <!x!> = 1, 10 do
- <?x?>()
-end
-]]
-
-TEST [[
-local <!x!>
-for x in x do
-end
-<?x?>()
-]]
-
-TEST [[
-local <!x!>
-for x in <?x?> do
-end
-]]
-
-TEST [[
-local x
-for <!x!> in x do
- <?x?>()
-end
-]]
-
-TEST [[
-local x
-for z, y, <!x!> in x do
- <?x?>()
-end
-]]
-
-TEST [[
-local <!x!>
-while <?x?> do
-end
-]]
-
-TEST [[
-local <!x!>
-while x do
- <?x?>()
-end
-]]
-
-TEST [[
-local <!x!>
-while x do
- local x
-end
-<?x?>()
-]]
-
-TEST [[
-local <!x!>
-repeat
- <?x?>()
-until true
-]]
-
-TEST [[
-local <!x!>
-repeat
- local x
-until true
-<?x?>()
-]]
-
-TEST [[
-local <!x!>
-repeat
-until <?x?>
-]]
-
-TEST [[
-local x
-repeat
- local <!x!>
-until <?x?>
-]]
-
-TEST [[
-local <!x!>
-function _()
- local x
-end
-<?x?>()
-]]
-
-TEST [[
-local <!x!>
-return function ()
- <?x?>()
-end
-]]
-
-TEST [[
-local <!x!>
-local x = function ()
- <?x?>()
-end
-]]
-
-TEST [[
-local <?<!x!>?>
-]]
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:<!a!>()
-end
-function mt:b()
- mt:<?a?>()
-end
-]]
-
-TEST [[
-function mt:<!m1!>()
-end
-function mt:m2()
- self:<?m1?>()
-end
-]]
-
-TEST [[
-function mt:m3()
- mt:<?m4?>()
-end
-function mt:<!m4!>()
-end
-]]
-
-TEST [[
-function mt:m3()
- self:<?m4?>()
-end
-function mt:<!m4!>()
-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 [[
-<!x!> = 1
-<?x?>()
-]]
-
-TEST [[
-do
- <!global!> = 1
-end
-<?global?>()
-]]
-
-TEST [[
-<!x!> = 1
-do
- local x = 1
-end
-<?x?>()
-]]
-
-TEST [[
-x = 1
-do
- local <!x!> = 1
- do
- <!x!> = 2
- end
- <?x?>()
-end
-]]
-
-TEST [[
-<!x!> = 1
-if y then
- <!x!> = 2
-else
- <!x!> = 3
-end
-print(<?x?>)
-]]
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.<!x!> = 1
-print(<?x?>)
-]]
-
-TEST [[
-_G.<!x!> = 1
-print(<?x?>)
-]]
-
-TEST [[
-<!rawset(_G, 'x', 1)!>
-print(<?x?>)
-]]
-
-TEST [[
-local mt
-mt.__index = mt
-function mt:<!method1!>()
-end
-
-local obj = setmetatable({}, mt)
-obj:<?method1?>()
-]]
-
-TEST [[
-local mt
-function mt:<!method1!>()
-end
-
-local obj = setmetatable({}, { __index = mt })
-obj:<?method1?>()
-]]
-
-TEST [[
-local mt
-function mt:<!method1!>()
-end
-
-setmetatable(api, { __index = mt })
-api:<?method1?>()
-]]
-
-TEST [[
-local mt
-local api
-function mt:<!method1!>()
-end
-
-setmetatable(api, { __index = mt })
-api:<?method1?>()
-]]
-
-TEST [[
-local mt
-function mt:x()
- self.<?init?>()
-end
-
-local obj, _ = setmetatable({}, { __index = mt })
-obj.<!init!> = 1
-obj:x()
-]]
-
-TEST [[
-local mt
-function mt:x()
- self.<?init?>()
-end
-
-local obj = setmetatable({ <!init!> = 1 }, { __index = mt })
-obj:x()
-]]
-
-TEST [[
-local mt
-function mt:x()
- self.a.<?out?>()
-end
-
-local obj = setmetatable({
- a = {
- <!out!> = 1,
- }
-}, { __index = mt })
-obj:x()
-]]
-
-TEST [[
-local sm = setmetatable
-local mt
-mt.__index = mt
-function mt:<!method1!>()
-end
-
-local obj = sm({}, mt)
-obj:<?method1?>()
-]]
-
--- TODO
---TEST [[
---local mt = {}
---function mt:<!x!>()
---end
---
---local obj = setmetatable({}, {__index = mt})
---function obj:x()
---end
---
---mt:<?x?>()
---]]
-
--- TODO 通过代码执行顺序来判断
---TEST [[
---local mt = {}
---function mt:x()
---end
---
---local obj = setmetatable({}, {__index = mt})
---function obj:<!x!>()
---end
---
---obj:<?x?>()
---]]
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 <!t!>
-a = {
- <?t?>
-}
-]]
-
-TEST [[
-local t
-t.<!x!> = 1
-t.<?x?>()
-]]
-
-TEST [[
-t.<!x!> = 1
-t.<?x?>()
-]]
-
-TEST [[
-local <!t!>
-t.x = 1
-<?t?>.x = 1
-]]
-
-TEST [[
-t.<!x!> = 1
-t.<?x?>.y = 1
-]]
-
-TEST [[
-local t
-t.<!x!> = 1
-t.<?x?>()
-]]
-
-TEST [[
-local t
-t[<!1!>] = 1
-t[<?1?>]()
-]]
-
-TEST [[
-local t
-t[<!true!>] = 1
-t[<?true?>]()
-]]
-
-TEST [[
-local t
-t[<!"method"!>] = 1
-t[<?"method"?>]()
-]]
-
-TEST [[
-local t
-t[<!"longString"!>] = 1
-t[<?[==[longString]==]?>]()
-]]
-
-TEST [[
-local t
-t.<!x!> = 1
-t[<?'x'?>]()
-]]
-
-TEST [[
-local t
-t.<!a!> = 1
-t.<?a?>.b()
-]]
-
-TEST [[
-local t
-local <!x!>
-t[<?x?>]()
-]]
-
-TEST[[
-local <!t!>
-local _ = {
- _ = <?t?>
-}
-]]
-
-TEST[[
-local <!t!>
-t {
- _ = <?t?>.x
-}
-]]
-
-TEST[[
-local t = {
- <!insert!> = 1,
-}
-t.<?insert?>()
-]]
-
-TEST[[
-local t = {
- [<!'insert'!>] = 1,
-}
-t.<?insert?>()
-]]
-
-TEST[[
-local t;t = {
- <!insert!> = 1,
-}
-t.<?insert?>()
-]]
-
-TEST[[
-local t;t = {
- <!insert!> = 1,
-}
-t.<?insert?>()
-]]
-
---TEST[[
---local t = {
--- <!insert!> = 1,
---}
---y.<?insert?>()
---]]
-
---TEST[[
---local t = {
--- <!insert!> = 1,
---}
---local y = {
--- insert = 1,
---}
---t.<?insert?>()
---]]