make_spec.lua 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. local t = require('test.testutil')
  2. local n = require('test.functional.testnvim')()
  3. local clear = n.clear
  4. local eval = n.eval
  5. local has_powershell = n.has_powershell
  6. local matches = t.matches
  7. local api = n.api
  8. local testprg = n.testprg
  9. describe(':make', function()
  10. clear()
  11. before_each(function()
  12. clear()
  13. end)
  14. describe('with powershell', function()
  15. if not has_powershell() then
  16. pending('not tested; powershell was not found', function() end)
  17. return
  18. end
  19. before_each(function()
  20. n.set_shell_powershell()
  21. end)
  22. it('captures stderr & non zero exit code #14349', function()
  23. api.nvim_set_option_value('makeprg', testprg('shell-test') .. ' foo', {})
  24. local out = eval('execute("make")')
  25. -- Error message is captured in the file and printed in the footer
  26. matches(
  27. '[\r\n]+.*[\r\n]+Unknown first argument%: foo[\r\n]+%(1 of 1%)%: Unknown first argument%: foo',
  28. out
  29. )
  30. end)
  31. it('captures stderr & zero exit code #14349', function()
  32. api.nvim_set_option_value('makeprg', testprg('shell-test'), {})
  33. local out = eval('execute("make")')
  34. -- Ensure there are no "shell returned X" messages between
  35. -- command and last line (indicating zero exit)
  36. matches('LastExitCode%s+ready [$]%s+[(]', out)
  37. matches('\n.*%: ready [$]', out)
  38. end)
  39. end)
  40. end)