summaryrefslogtreecommitdiff
path: root/server/test/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-19 15:45:13 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-19 15:45:13 +0800
commitcb7dc2445d5840ca453b1d39a1ad2efbe5767a41 (patch)
tree9b8b374946d862a067c918f48944aacd8163f005 /server/test/vm
parent510fa41e64286e32b921da66dbca0c4063c1eb4d (diff)
downloadlua-language-server-cb7dc2445d5840ca453b1d39a1ad2efbe5767a41.zip
整理代码
Diffstat (limited to 'server/test/vm')
-rw-r--r--server/test/vm/dirty.lua0
-rw-r--r--server/test/vm/example.lua1
-rw-r--r--server/test/vm/init.lua122
-rw-r--r--server/test/vm/normal.lua117
4 files changed, 121 insertions, 119 deletions
diff --git a/server/test/vm/dirty.lua b/server/test/vm/dirty.lua
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/server/test/vm/dirty.lua
diff --git a/server/test/vm/example.lua b/server/test/vm/example.lua
new file mode 100644
index 00000000..39ef4f4b
--- /dev/null
+++ b/server/test/vm/example.lua
@@ -0,0 +1 @@
+TEST(io.load(ROOT / 'src' / 'matcher' / 'vm.lua'))
diff --git a/server/test/vm/init.lua b/server/test/vm/init.lua
index 9b7de1e2..a95373f1 100644
--- a/server/test/vm/init.lua
+++ b/server/test/vm/init.lua
@@ -12,122 +12,6 @@ function TEST(script)
assert(results)
end
-TEST [[
-do
- x = 1
-end
-]]
-
-TEST [[
-return nil, 1, true, 'xx'
-]]
-
-TEST [[
-return a
-]]
-
-TEST [[
-retrun a.b:c(1, 2, ...)[1][name]
-]]
-
-TEST [[
-return 1 + 1
-]]
-
-TEST [[
-return -1
-]]
-
-TEST [[
-return ...
-]]
-
-TEST [[
-return function (a, b, ...)
-end
-]]
-
-TEST [[
-return {
- a = 1,
- b = {
- c = d,
- e = f,
- },
- g,
- h,
- 1,
-}
-]]
-
-TEST [[
-::LABEL::
-goto LABEL
-goto NEXT
-::NEXT::
-]]
-
-TEST [[
-a, b, c = 1, 2, ...
-]]
-
-TEST [[
-local a, b, c = 1, 2, ...
-]]
-
-TEST [[
-a[#a+1] = 1
-]]
-
-TEST [[
-xx(a, b, 2, 3, ...)
-]]
-
-TEST [[
-if a then
-elseif b then
-elseif c then
-else
-end
-]]
-
-TEST [[
-for i = 1, 10, 1 do
-end
-]]
-
-TEST [[
-for a, b, c in pairs(t) do
-end
-]]
-
-TEST [[
-while true do
-end
-]]
-
-TEST [[
-repeat
-until true
-]]
-
-TEST [[
-function xx:yy(a, b, c, ...)
-end
-]]
-
-TEST [[
-local function xx(a, b, c, ...)
-end
-]]
-
-TEST [[
-local v = 1
-local function xx()
- print(v)
-end
-local v = 2
-xx()
-]]
-
-TEST(io.load(ROOT / 'src' / 'matcher' / 'vm.lua'))
+require 'vm.normal'
+require 'vm.example'
+require 'vm.dirty'
diff --git a/server/test/vm/normal.lua b/server/test/vm/normal.lua
new file mode 100644
index 00000000..de9c6ca2
--- /dev/null
+++ b/server/test/vm/normal.lua
@@ -0,0 +1,117 @@
+TEST [[
+do
+ x = 1
+end
+]]
+
+TEST [[
+return nil, 1, true, 'xx'
+]]
+
+TEST [[
+return a
+]]
+
+TEST [[
+retrun a.b:c(1, 2, ...)[1][name]
+]]
+
+TEST [[
+return 1 + 1
+]]
+
+TEST [[
+return -1
+]]
+
+TEST [[
+return ...
+]]
+
+TEST [[
+return function (a, b, ...)
+end
+]]
+
+TEST [[
+return {
+ a = 1,
+ b = {
+ c = d,
+ e = f,
+ },
+ g,
+ h,
+ 1,
+}
+]]
+
+TEST [[
+::LABEL::
+goto LABEL
+goto NEXT
+::NEXT::
+]]
+
+TEST [[
+a, b, c = 1, 2, ...
+]]
+
+TEST [[
+local a, b, c = 1, 2, ...
+]]
+
+TEST [[
+a[#a+1] = 1
+]]
+
+TEST [[
+xx(a, b, 2, 3, ...)
+]]
+
+TEST [[
+if a then
+elseif b then
+elseif c then
+else
+end
+]]
+
+TEST [[
+for i = 1, 10, 1 do
+end
+]]
+
+TEST [[
+for a, b, c in pairs(t) do
+end
+]]
+
+TEST [[
+while true do
+end
+]]
+
+TEST [[
+repeat
+until true
+]]
+
+TEST [[
+function xx:yy(a, b, c, ...)
+end
+]]
+
+TEST [[
+local function xx(a, b, c, ...)
+end
+]]
+
+TEST [[
+local v = 1
+local function xx()
+ print(v)
+end
+local v = 2
+xx()
+]]