From 21a2475da458e97be798bdc9261da24460da5c65 Mon Sep 17 00:00:00 2001 From: William Boman Date: Mon, 26 Dec 2022 17:43:01 +0100 Subject: refactor: interact with libuv pipes in async context (#808) Also now properly close pipes (shutdown -> close). --- tests/mason-core/managers/powershell_spec.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tests/mason-core') diff --git a/tests/mason-core/managers/powershell_spec.lua b/tests/mason-core/managers/powershell_spec.lua index 0d6851d1..0229388a 100644 --- a/tests/mason-core/managers/powershell_spec.lua +++ b/tests/mason-core/managers/powershell_spec.lua @@ -60,7 +60,7 @@ describe("powershell manager", function() end) it("should provide default powershell options via script stdin", function() - local stdin = mock.new { shutdown = mockx.just_runs } + local stdin = mock.new {} stub(spawn, "pwsh", function(args) args.on_spawn(nil, { stdin }) end) @@ -68,6 +68,9 @@ describe("powershell manager", function() stub(vim.loop, "write", function(_, _, callback) callback() end) + stub(vim.loop, "shutdown", function(_, callback) + callback() + end) vim.fn.executable.on_call_with("pwsh").returns(1) powershell().script "echo 'Is this bash?'" @@ -86,7 +89,8 @@ describe("powershell manager", function() match.is_function() ) assert.spy(vim.loop.write).was_called_with(match.is_ref(stdin), "echo 'Is this bash?'", match.is_function()) - assert.spy(stdin.shutdown).was_called(1) + assert.spy(vim.loop.shutdown).was_called(1) + assert.spy(vim.loop.shutdown).was_called_with(match.is_ref(stdin), match.is_function()) end) it("should provide default powershell options via command interface", function() -- cgit v1.2.3-70-g09d2