2021-07-02 05:15:40 -07:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
|
|
|
local clear = helpers.clear
|
|
|
|
local eval = helpers.eval
|
|
|
|
local has_powershell = helpers.has_powershell
|
|
|
|
local matches = helpers.matches
|
2024-01-12 06:11:28 -07:00
|
|
|
local meths = helpers.meths
|
2022-06-22 05:51:52 -07:00
|
|
|
local testprg = helpers.testprg
|
2021-07-02 05:15:40 -07:00
|
|
|
|
|
|
|
describe(':make', function()
|
|
|
|
clear()
|
2024-01-02 18:09:18 -07:00
|
|
|
before_each(function()
|
2021-07-02 05:15:40 -07:00
|
|
|
clear()
|
|
|
|
end)
|
|
|
|
|
|
|
|
describe('with powershell', function()
|
|
|
|
if not has_powershell() then
|
2024-01-02 18:09:18 -07:00
|
|
|
pending('not tested; powershell was not found', function() end)
|
2021-07-02 05:15:40 -07:00
|
|
|
return
|
|
|
|
end
|
2024-01-02 18:09:18 -07:00
|
|
|
before_each(function()
|
2021-07-02 05:15:40 -07:00
|
|
|
helpers.set_shell_powershell()
|
|
|
|
end)
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('captures stderr & non zero exit code #14349', function()
|
2024-01-12 06:11:28 -07:00
|
|
|
meths.nvim_set_option_value('makeprg', testprg('shell-test') .. ' foo', {})
|
2021-07-02 05:15:40 -07:00
|
|
|
local out = eval('execute("make")')
|
|
|
|
-- Error message is captured in the file and printed in the footer
|
2024-01-02 18:09:18 -07:00
|
|
|
matches(
|
|
|
|
'[\r\n]+.*[\r\n]+Unknown first argument%: foo[\r\n]+%(1 of 1%)%: Unknown first argument%: foo',
|
|
|
|
out
|
|
|
|
)
|
2021-07-02 05:15:40 -07:00
|
|
|
end)
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('captures stderr & zero exit code #14349', function()
|
2024-01-12 06:11:28 -07:00
|
|
|
meths.nvim_set_option_value('makeprg', testprg('shell-test'), {})
|
2021-07-02 05:15:40 -07:00
|
|
|
local out = eval('execute("make")')
|
|
|
|
-- Ensure there are no "shell returned X" messages between
|
2023-03-19 14:25:12 -07:00
|
|
|
-- command and last line (indicating zero exit)
|
|
|
|
matches('LastExitCode%s+ready [$]%s+[(]', out)
|
2021-07-02 05:15:40 -07:00
|
|
|
matches('\n.*%: ready [$]', out)
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
end)
|