summaryrefslogtreecommitdiff
path: root/server/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-10 17:21:06 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-10 17:21:06 +0800
commit2cfae303e62840e68af966eac1fc96a03e026c4d (patch)
tree6f2501e6014aed71d59aed514aa9e006b9f80781 /server/test
parent795f4182c82704c9c28798625f97052552a3ed58 (diff)
downloadlua-language-server-2cfae303e62840e68af966eac1fc96a03e026c4d.zip
更新vm
Diffstat (limited to 'server/test')
-rw-r--r--server/test/main.lua1
-rw-r--r--server/test/vm/init.lua21
2 files changed, 22 insertions, 0 deletions
diff --git a/server/test/main.lua b/server/test/main.lua
index 3167089e..5b372421 100644
--- a/server/test/main.lua
+++ b/server/test/main.lua
@@ -27,6 +27,7 @@ local function main()
test 'type_inference'
test 'definition'
test 'find_lib'
+ test 'vm'
print('测试完成')
end
diff --git a/server/test/vm/init.lua b/server/test/vm/init.lua
new file mode 100644
index 00000000..db096252
--- /dev/null
+++ b/server/test/vm/init.lua
@@ -0,0 +1,21 @@
+local matcher = require 'matcher'
+local parser = require 'parser'
+
+rawset(_G, 'TEST', true)
+
+function TEST(script)
+ local ast = parser:ast(script)
+ assert(ast)
+ local results = matcher.vm(ast)
+ assert(results)
+end
+
+TEST [[
+do
+ x = 1
+end
+]]
+
+TEST [[
+return nil, 1, true, 'xx'
+]]