summaryrefslogtreecommitdiff
path: root/server/test.lua
diff options
context:
space:
mode:
authorxl000 <l_xb@foxmail.com>2019-04-17 01:16:12 +0800
committerxl000 <l_xb@foxmail.com>2019-04-17 01:16:12 +0800
commitae53ebf48299680b8906e848903fb32d56ee90a5 (patch)
treeb4c2c5a410b8cff43e46f22101e372253b6472a5 /server/test.lua
parente676b97ee6c54ac843b51f2d6062689a428f0c28 (diff)
downloadlua-language-server-ae53ebf48299680b8906e848903fb32d56ee90a5.zip
Unix-like系统路径问题,osx下测试通过
Diffstat (limited to 'server/test.lua')
-rw-r--r--server/test.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/server/test.lua b/server/test.lua
new file mode 100644
index 00000000..fe2efd23
--- /dev/null
+++ b/server/test.lua
@@ -0,0 +1,28 @@
+local fs = require 'bee.filesystem'
+local subprocess = require 'bee.subprocess'
+
+ROOT = fs.current_path()
+package.path = (ROOT / 'src' / '?.lua'):string()
+ .. ';' .. (ROOT / 'src' / '?' / 'init.lua'):string()
+
+local function runTest(root)
+ local exe = root / 'bin' / 'lua-language-server'
+ local test = root / 'test' / 'main.lua'
+ local lua = subprocess.spawn {
+ exe,
+ test,
+ '-E',
+ stdout = true,
+ stderr = true,
+ }
+ for line in lua.stdout:lines 'l' do
+ print(line)
+ end
+ lua:wait()
+ local err = lua.stderr:read 'a'
+ if err ~= '' then
+ error(err)
+ end
+end
+
+runTest(ROOT)