summaryrefslogtreecommitdiff
path: root/make/unittest.lua
blob: 25839c96f218203fda6a7d8e489acd5903aaa3be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
local platform = ...
local fs = require 'bee.filesystem'
local sp = require 'bee.subprocess'
local pf = require 'bee.platform'
local exe = platform == 'msvc' and ".exe" or ""
local CWD = fs.current_path()

local process = assert(sp.spawn {
    CWD / 'bin' / pf.OS / ('lua-language-server' .. exe),
    CWD / 'test.lua',
    '-E',
    stdout = true,
    stderr = true,
})

for line in process.stdout:lines 'l' do
    print(line)
end
process:wait()
local err = process.stderr:read 'a'
if err ~= '' then
    error(err)
end