From ae53ebf48299680b8906e848903fb32d56ee90a5 Mon Sep 17 00:00:00 2001 From: xl000 Date: Wed, 17 Apr 2019 01:16:12 +0800 Subject: =?UTF-8?q?Unix-like=E7=B3=BB=E7=BB=9F=E8=B7=AF=E5=BE=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8Cosx=E4=B8=8B=E6=B5=8B=E8=AF=95=E9=80=9A?= =?UTF-8?q?=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/test.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 server/test.lua (limited to 'server/test.lua') 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) -- cgit v1.2.3 From 613db1b0a66872f7907651072ed4498420d7aa63 Mon Sep 17 00:00:00 2001 From: xl000 Date: Wed, 17 Apr 2019 01:47:52 +0800 Subject: =?UTF-8?q?subprocess.spawn=E5=B8=A6=E4=B8=8Aexe=E6=89=A9=E5=B1=95?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/test.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'server/test.lua') diff --git a/server/test.lua b/server/test.lua index fe2efd23..d39edda4 100644 --- a/server/test.lua +++ b/server/test.lua @@ -6,7 +6,9 @@ package.path = (ROOT / 'src' / '?.lua'):string() .. ';' .. (ROOT / 'src' / '?' / 'init.lua'):string() local function runTest(root) - local exe = root / 'bin' / 'lua-language-server' + 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, -- cgit v1.2.3