wundo_spec.lua 966 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. -- Specs for :wundo and underlying functions
  2. local n = require('test.functional.testnvim')()
  3. local command = n.command
  4. local clear = n.clear
  5. local eval = n.eval
  6. local spawn = n.spawn
  7. local nvim_prog = n.nvim_prog
  8. local set_session = n.set_session
  9. describe(':wundo', function()
  10. before_each(clear)
  11. after_each(function()
  12. os.remove(eval('getcwd()') .. '/foo')
  13. end)
  14. it('safely fails on new, non-empty buffer', function()
  15. command('normal! iabc')
  16. command('wundo foo') -- This should not segfault. #1027
  17. --TODO: check messages for error message
  18. end)
  19. end)
  20. describe('u_* functions', function()
  21. it('safely fail on new, non-empty buffer', function()
  22. local session = spawn({
  23. nvim_prog,
  24. '-u',
  25. 'NONE',
  26. '-i',
  27. 'NONE',
  28. '--embed',
  29. '-c',
  30. 'set undodir=. undofile',
  31. })
  32. set_session(session)
  33. command('echo "True"') -- Should not error out due to crashed Neovim
  34. session:close()
  35. end)
  36. end)