arglist_spec.lua 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. -- Test argument list commands
  2. local t = require('test.testutil')
  3. local n = require('test.functional.testnvim')()
  4. local Screen = require('test.functional.ui.screen')
  5. local clear, command, eq = n.clear, n.command, t.eq
  6. local expect_exit = n.expect_exit
  7. local feed = n.feed
  8. local pcall_err = t.pcall_err
  9. describe('argument list commands', function()
  10. before_each(clear)
  11. it('quitting Vim with unedited files in the argument list throws E173', function()
  12. command('set nomore')
  13. command('args a b c')
  14. eq('Vim(quit):E173: 2 more files to edit', pcall_err(command, 'quit'))
  15. end)
  16. it(':confirm quit with unedited files in arglist', function()
  17. local screen = Screen.new(60, 6)
  18. command('set nomore')
  19. command('args a b c')
  20. feed(':confirm quit\n')
  21. screen:expect([[
  22. |
  23. {1:~ }|
  24. {3: }|
  25. :confirm quit |
  26. {6:2 more files to edit. Quit anyway?} |
  27. {6:[Y]es, (N)o: }^ |
  28. ]])
  29. feed('N')
  30. screen:expect([[
  31. ^ |
  32. {1:~ }|*4
  33. |
  34. ]])
  35. feed(':confirm quit\n')
  36. screen:expect([[
  37. |
  38. {1:~ }|
  39. {3: }|
  40. :confirm quit |
  41. {6:2 more files to edit. Quit anyway?} |
  42. {6:[Y]es, (N)o: }^ |
  43. ]])
  44. expect_exit(1000, feed, 'Y')
  45. end)
  46. end)