aboutsummaryrefslogtreecommitdiffstats
path: root/tests/core/spawn_spec.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-05-26 00:32:28 +0200
committerGitHub <noreply@github.com>2022-05-26 00:32:28 +0200
commit621c8c6d484ed402eab0d5e44c608d4296562a96 (patch)
tree5902ffbd839fbcecef5e9e3cb9e9a3b3802dd284 /tests/core/spawn_spec.lua
parentrun autogen_metadata.lua (diff)
downloadmason-621c8c6d484ed402eab0d5e44c608d4296562a96.tar
mason-621c8c6d484ed402eab0d5e44c608d4296562a96.tar.gz
mason-621c8c6d484ed402eab0d5e44c608d4296562a96.tar.bz2
mason-621c8c6d484ed402eab0d5e44c608d4296562a96.tar.lz
mason-621c8c6d484ed402eab0d5e44c608d4296562a96.tar.xz
mason-621c8c6d484ed402eab0d5e44c608d4296562a96.tar.zst
mason-621c8c6d484ed402eab0d5e44c608d4296562a96.zip
fix(spawn): don't check executable when spawning with custom PATH (#721)
Diffstat (limited to 'tests/core/spawn_spec.lua')
-rw-r--r--tests/core/spawn_spec.lua29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/core/spawn_spec.lua b/tests/core/spawn_spec.lua
index 73bcdf28..ce6e4684 100644
--- a/tests/core/spawn_spec.lua
+++ b/tests/core/spawn_spec.lua
@@ -181,9 +181,36 @@ describe("async spawn", function()
callback(false, 127)
end)
- local result = spawn.my_cmd { check_executable = false }
+ local result = spawn.my_cmd { "arg1", check_executable = false }
assert.is_true(result:is_failure())
assert.spy(process.spawn).was_called(1)
+ assert.spy(process.spawn).was_called_with(
+ "my_cmd",
+ match.tbl_containing {
+ args = match.same { "arg1" },
+ },
+ match.is_function()
+ )
+ end)
+ )
+
+ it(
+ "should skip checking whether command is executable if with_paths is provided",
+ async_test(function()
+ stub(process, "spawn", function(_, _, callback)
+ callback(false, 127)
+ end)
+
+ local result = spawn.my_cmd { "arg1", with_paths = {} }
+ assert.is_true(result:is_failure())
+ assert.spy(process.spawn).was_called(1)
+ assert.spy(process.spawn).was_called_with(
+ "my_cmd",
+ match.tbl_containing {
+ args = match.same { "arg1" },
+ },
+ match.is_function()
+ )
end)
)
end)