summaryrefslogtreecommitdiff
path: root/server/test.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-04-17 09:41:49 +0800
committerGitHub <noreply@github.com>2019-04-17 09:41:49 +0800
commite32e137cf89d1fd4c8af57cb513fdf575a8c688d (patch)
treef053cdb83b01ae7c91b1a3df22d4a2eab339786f /server/test.lua
parente676b97ee6c54ac843b51f2d6062689a428f0c28 (diff)
parent613db1b0a66872f7907651072ed4498420d7aa63 (diff)
downloadlua-language-server-e32e137cf89d1fd4c8af57cb513fdf575a8c688d.zip
Merge pull request #21 from Xiaobin0860/macx
修复一处Unix-like系统路径问题,并在maxOS下测试通过
Diffstat (limited to 'server/test.lua')
-rw-r--r--server/test.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/server/test.lua b/server/test.lua
new file mode 100644
index 00000000..d39edda4
--- /dev/null
+++ b/server/test.lua
@@ -0,0 +1,30 @@
+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 is_macos = package.cpath:sub(-3) == '.so'
+ local ext = is_macos and '' or '.exe'
+ local exe = root / 'bin' / 'lua-language-server' .. ext
+ 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)