ls_spec.lua 1.4 KB

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