ls_spec.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. local t = require('test.testutil')
  2. local n = require('test.functional.testnvim')()
  3. local clear = n.clear
  4. local command = n.command
  5. local eq = t.eq
  6. local eval = n.eval
  7. local feed = n.feed
  8. local api = n.api
  9. local testprg = n.testprg
  10. local retry = t.retry
  11. describe(':ls', function()
  12. before_each(function()
  13. clear()
  14. end)
  15. it('R, F for :terminal buffers', function()
  16. api.nvim_set_option_value('shell', string.format('"%s" INTERACT', testprg('shell-test')), {})
  17. command('edit foo')
  18. command('set hidden')
  19. command('terminal')
  20. command('vsplit')
  21. command('terminal')
  22. feed('iexit<cr>')
  23. retry(nil, 5000, function()
  24. local ls_output = eval('execute("ls")')
  25. -- Normal buffer.
  26. eq('\n 1 h ', string.match(ls_output, '\n *1....'))
  27. -- Terminal buffer [R]unning.
  28. eq('\n 2 #aR', string.match(ls_output, '\n *2....'))
  29. -- Terminal buffer [F]inished.
  30. eq('\n 3 %aF', string.match(ls_output, '\n *3....'))
  31. end)
  32. retry(nil, 5000, function()
  33. local ls_output = eval('execute("ls R")')
  34. -- Just the [R]unning terminal buffer.
  35. eq('\n 2 #aR ', string.match(ls_output, '^\n *2 ... '))
  36. end)
  37. retry(nil, 5000, function()
  38. local ls_output = eval('execute("ls F")')
  39. -- Just the [F]inished terminal buffer.
  40. eq('\n 3 %aF ', string.match(ls_output, '^\n *3 ... '))
  41. end)
  42. end)
  43. end)