autocmd_spec.lua 992 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. local t = require('test.testutil')
  2. local n = require('test.functional.testnvim')()
  3. local clear = n.clear
  4. local write_file = t.write_file
  5. local command = n.command
  6. local feed = n.feed
  7. local api = n.api
  8. local eq = t.eq
  9. before_each(clear)
  10. -- oldtest: Test_autocmd_invalidates_undo_on_textchanged()
  11. it('no E440 in quickfix window when autocommand invalidates undo', function()
  12. write_file(
  13. 'XTest_autocmd_invalidates_undo_on_textchanged',
  14. [[
  15. set hidden
  16. " create quickfix list (at least 2 lines to move line)
  17. vimgrep /u/j %
  18. " enter quickfix window
  19. cwindow
  20. " set modifiable
  21. setlocal modifiable
  22. " set autocmd to clear quickfix list
  23. autocmd! TextChanged <buffer> call setqflist([])
  24. " move line
  25. move+1
  26. ]]
  27. )
  28. finally(function()
  29. os.remove('XTest_autocmd_invalidates_undo_on_textchanged')
  30. end)
  31. command('edit XTest_autocmd_invalidates_undo_on_textchanged')
  32. command('so %')
  33. feed('G')
  34. eq('', api.nvim_get_vvar('errmsg'))
  35. end)