bufmodifiedset_spec.lua 571 B

123456789101112131415161718192021222324
  1. local t = require('test.testutil')
  2. local n = require('test.functional.testnvim')()
  3. local clear = n.clear
  4. local eq = t.eq
  5. local eval = n.eval
  6. local source = n.source
  7. local request = n.request
  8. describe('BufModified', function()
  9. before_each(clear)
  10. it('is triggered when modified and un-modified', function()
  11. source([[
  12. let g:modified = 0
  13. autocmd BufModifiedSet * let g:modified += 1
  14. ]])
  15. request('nvim_command', [[normal! aa\<Esc>]])
  16. eq(1, eval('g:modified'))
  17. request('nvim_command', [[normal! u]])
  18. eq(2, eval('g:modified'))
  19. end)
  20. end)