summaryrefslogtreecommitdiff
path: root/server/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-05 16:45:36 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-05 16:45:36 +0800
commit34c2d6ac30f9d990d4008f52c6436aae68fb2844 (patch)
treec17f19ebcedc322fb62fe04fc264e2a04c9383d2 /server/test
parent7f3aa8ed3eba0f07a4bd258407f3eaa038f2ce6f (diff)
downloadlua-language-server-34c2d6ac30f9d990d4008f52c6436aae68fb2844.zip
转到实现
Diffstat (limited to 'server/test')
-rw-r--r--server/test/implementation/arg.lua23
-rw-r--r--server/test/implementation/bug.lua15
-rw-r--r--server/test/implementation/function.lua24
-rw-r--r--server/test/implementation/if.lua106
-rw-r--r--server/test/implementation/init.lua59
-rw-r--r--server/test/implementation/local.lua191
-rw-r--r--server/test/implementation/set.lua31
-rw-r--r--server/test/implementation/table.lua6
-rw-r--r--server/test/main.lua1
9 files changed, 0 insertions, 456 deletions
diff --git a/server/test/implementation/arg.lua b/server/test/implementation/arg.lua
deleted file mode 100644
index 2004d666..00000000
--- a/server/test/implementation/arg.lua
+++ /dev/null
@@ -1,23 +0,0 @@
-TEST [[
-local function xx (<!xx!>)
- <?xx?> = 1
-end
-]]
-
-TEST [[
-local function x (x, <!...!>)
- x = <?...?>
-end
-]]
-
-TEST [[
-function mt<!:!>x()
- <?self?> = 1
-end
-]]
-
-TEST [[
-function mt:x(<!self!>)
- <?self?> = 1
-end
-]]
diff --git a/server/test/implementation/bug.lua b/server/test/implementation/bug.lua
deleted file mode 100644
index b0e890ca..00000000
--- a/server/test/implementation/bug.lua
+++ /dev/null
@@ -1,15 +0,0 @@
-TEST [[
-local <!x!>
-function _(x)
-end
-function _()
- <?x?>
-end
-]]
-
-TEST [[
-function _(<!x!>)
- do return end
- <?x?> = 1
-end
-]]
diff --git a/server/test/implementation/function.lua b/server/test/implementation/function.lua
deleted file mode 100644
index 90b75da8..00000000
--- a/server/test/implementation/function.lua
+++ /dev/null
@@ -1,24 +0,0 @@
-
-TEST [[
-function <!x!> () end
-<?x?> = 1
-]]
-
-TEST [[
-local function <!x!> () end
-<?x?> = 1
-]]
-
-TEST [[
-local x
-local function <!x!> ()
- <?x?> = 1
-end
-]]
-
-TEST [[
-local x
-function <!x!>()
-end
-<?x?> = 1
-]]
diff --git a/server/test/implementation/if.lua b/server/test/implementation/if.lua
deleted file mode 100644
index 0da8be1a..00000000
--- a/server/test/implementation/if.lua
+++ /dev/null
@@ -1,106 +0,0 @@
-TEST [[
-<!x!> = 1
-if 1 then
- x = 1
-else
- <?x?> = 1
-end
-]]
-
-TEST [[
-<!x!> = 1
-if 1 then
- <!x!> = 1
-else
- <!x!> = 1
-end
-<?x?> = 1
-]]
-
-TEST [[
-<!x!> = 1
-if 1 then
- <!x!> = 1
-elseif 1 then
- <!x!> = 1
-else
- <!x!> = 1
-end
-<?x?> = 1
-]]
-
-TEST [[
-<!x!> = 1
-if 1 then
- <!x!> = 1
-elseif 1 then
- <!x!> = 1
- if 1 then
- <!x!> = 1
- end
-else
- <!x!> = 1
-end
-<?x?> = 1
-]]
-
-TEST [[
-<!x!> = 1
-while true do
- <!x!> = 1
-end
-<?x?> = 1
-]]
-
-TEST [[
-<!x!> = 1
-for _ in _ do
- <!x!> = 1
-end
-<?x?> = 1
-]]
-
-TEST [[
-<!x!> = 1
-for _ = 1, 1 do
- <!x!> = 1
-end
-<?x?> = 1
-]]
-
-TEST [[
-x3 = 1
-repeat
- <!x3!> = 1
-until <?x3?> == 1
-]]
-
-TEST [[
-<!x!> = 1
-repeat
- <!x!> = 1
-until 1
-<?x?> = 1
-]]
-
-TEST [[
-<!x!> = 1
-while 1 do
- x = 1
- <!x!> = 1
-end
-<?x?> = 1
-]]
-
-TEST [[
-<!x!> = 1
-if 1 then
- if 1 then
- x = 1
- end
-else
- if 1 then
- <?x?> = 1
- end
-end
-]]
diff --git a/server/test/implementation/init.lua b/server/test/implementation/init.lua
deleted file mode 100644
index 94db86fc..00000000
--- a/server/test/implementation/init.lua
+++ /dev/null
@@ -1,59 +0,0 @@
-local matcher = require 'matcher'
-local parser = require 'parser'
-
-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)
- while true do
- local target = table.remove(targets)
- if not target then
- break
- end
- for i, result in ipairs(results) do
- if target[1] == result[1] and target[2] == result[2] then
- table.remove(results, i)
- goto CONTINUE
- end
- end
- do return false end
- ::CONTINUE::
- end
- if #results == 0 then
- return true
- else
- return false
- end
-end
-
-function TEST(script)
- local target = catch_target(script)
- local pos = script:find('<?', 1, true) + 2
- local new_script = script:gsub('<[!?]', ' '):gsub('[!?]>', ' ')
- local ast, err = parser:ast(new_script)
- assert(ast)
- local suc, result = matcher.implementation(ast, pos)
- assert(suc)
- assert(founded(target, result))
-end
-
-require 'implementation.set'
-require 'implementation.local'
-require 'implementation.arg'
-require 'implementation.function'
-require 'implementation.if'
---require 'implementation.table'
-require 'implementation.bug'
diff --git a/server/test/implementation/local.lua b/server/test/implementation/local.lua
deleted file mode 100644
index 7e9b3db0..00000000
--- a/server/test/implementation/local.lua
+++ /dev/null
@@ -1,191 +0,0 @@
-TEST [[
-local <!x!>
-<?x?> = 1
-]]
-
-TEST [[
-local z, y, <!x!>
-<?x?> = 1
-]]
-
-TEST [[
-local <!x!> = 1
-<?x?> = 1
-]]
-
-TEST [[
-local z, y, <!x!> = 1
-<?x?> = 1
-]]
-
-TEST [[
-local x
-local <!x!>
-<?x?> = 1
-]]
-
-TEST [[
-local <!x!>
-do
- <?x?> = 1
-end
-]]
-
-TEST [[
-local <!x!>
-do
- local x
-end
-<?x?> = 1
-]]
-
-TEST [[
-local <!x!>
-if <?x?> then
- local x
-end
-]]
-
-TEST [[
-local <!x2!>
-if x2 then
- local x2
-elseif <?x2?> then
- local x2
-end
-]]
-
-TEST [[
-local <!x!>
-if x then
- local x
-elseif x then
- local x
-else
- local x
-end
-<?x?> = 1
-]]
-
-TEST [[
-local <!x!>
-if x then
- <?x?> = 1
-elseif x then
- local x
-else
- local x
-end
-]]
-
-TEST [[
-local <!x!>
-for x = 1, 10 do
-end
-<?x?> = 1
-]]
-
-TEST [[
-local x
-for <!x!> = 1, 10 do
- <?x?> = 1
-end
-]]
-
-TEST [[
-local <!x!>
-for x in x do
-end
-<?x?> = 1
-]]
-
-TEST [[
-local <!x!>
-for x in <?x?> do
-end
-]]
-
-TEST [[
-local x
-for <!x!> in x do
- <?x?> = 1
-end
-]]
-
-TEST [[
-local x
-for z, y, <!x!> in x do
- <?x?> = 1
-end
-]]
-
-TEST [[
-local <!x!>
-while <?x?> do
-end
-]]
-
-TEST [[
-local <!x!>
-while x do
- <?x?> = 1
-end
-]]
-
-TEST [[
-local <!x!>
-while x do
- local x
-end
-<?x?> = 1
-]]
-
-TEST [[
-local <!x!>
-repeat
- <?x?> = 1
-until true
-]]
-
-TEST [[
-local <!x!>
-repeat
- local x
-until true
-<?x?> = 1
-]]
-
-TEST [[
-local <!x!>
-repeat
-until <?x?>
-]]
-
-TEST [[
-local x
-repeat
- local <!x!>
-until <?x?>
-]]
-
-TEST [[
-local <!x!>
-function _()
- local x
-end
-<?x?> = 1
-]]
-
-TEST [[
-local <!x!>
-return function ()
- <?x?> = 1
-end
-]]
-
-TEST [[
-local <!x!>
-local x = function ()
- <?x?> = 1
-end
-]]
diff --git a/server/test/implementation/set.lua b/server/test/implementation/set.lua
deleted file mode 100644
index 5c4a1a2e..00000000
--- a/server/test/implementation/set.lua
+++ /dev/null
@@ -1,31 +0,0 @@
-TEST [[
-<!x!> = 1
-<?x?> = 1
-]]
-
-TEST [[
-global = 1
-do
- <!global!> = 2
-end
-<?global?> = 3
-]]
-
-TEST [[
-<!x!> = 1
-do
- local x = 1
-end
-<?x?> = 1
-]]
-
-TEST [[
-x = 1
-do
- local x = 1
- do
- <!x!> = 2
- end
- <?x?> = 1
-end
-]]
diff --git a/server/test/implementation/table.lua b/server/test/implementation/table.lua
deleted file mode 100644
index 13a3b555..00000000
--- a/server/test/implementation/table.lua
+++ /dev/null
@@ -1,6 +0,0 @@
-TEST [[
-local t = {
- <!x!> = 1,
-}
-t.<?x?> = 1
-]]
diff --git a/server/test/main.lua b/server/test/main.lua
index 089f59b8..58394989 100644
--- a/server/test/main.lua
+++ b/server/test/main.lua
@@ -21,7 +21,6 @@ local function main()
end
test 'definition'
- --test 'implementation'
print('测试完成')
end