mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-18 20:36:45 +00:00
refactor: async processes
This commit is contained in:
parent
4319846b8c
commit
a36ebd2a75
12 changed files with 394 additions and 379 deletions
20
tests/manage/process_spec.lua
Normal file
20
tests/manage/process_spec.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
---@module 'luassert'
|
||||
local Async = require("lazy.async")
|
||||
local Process = require("lazy.manage.process")
|
||||
|
||||
describe("process", function()
|
||||
it("runs sync", function()
|
||||
local lines = Process.exec({ "echo", "-n", "hello" })
|
||||
assert.are.same({ "hello" }, lines)
|
||||
end)
|
||||
|
||||
it("runs sync from async context", function()
|
||||
local lines ---@type string[]
|
||||
local async = Async.new(function()
|
||||
lines = Process.exec({ "echo", "-n", "hello" })
|
||||
end)
|
||||
async:wait()
|
||||
|
||||
assert.are.same({ "hello" }, lines)
|
||||
end)
|
||||
end)
|
Loading…
Add table
Add a link
Reference in a new issue