blob: 4a4387313e65a38b991e70ffa7cecc63adecbc8e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
local spy = require "luassert.spy"
local match = require "luassert.match"
local process = require "mason-core.process"
describe("process.spawn", function()
-- Unix only
it(
"should spawn command and feed output to sink",
async_test(function()
local stdio = process.in_memory_sink()
local callback = spy.new()
process.spawn("env", {
args = {},
env = {
"HELLO=world",
"MY_ENV=var",
},
stdio_sink = stdio.sink,
}, callback)
assert.wait_for(function()
assert.spy(callback).was_called(1)
assert.spy(callback).was_called_with(true, 0, match.is_number())
assert.equals(table.concat(stdio.buffers.stdout, ""), "HELLO=world\nMY_ENV=var\n")
end)
end)
)
end)
|