help_spec.lua 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. local t = require('test.testutil')
  2. local n = require('test.functional.testnvim')()
  3. local clear = n.clear
  4. local command = n.command
  5. local eq = t.eq
  6. local fn = n.fn
  7. local api = n.api
  8. local mkdir = t.mkdir
  9. local rmdir = n.rmdir
  10. local write_file = t.write_file
  11. describe(':help', function()
  12. before_each(clear)
  13. it('window closed makes cursor return to a valid win/buf #9773', function()
  14. n.add_builddir_to_rtp()
  15. command('help help')
  16. eq(1001, fn.win_getid())
  17. command('quit')
  18. eq(1000, fn.win_getid())
  19. command('autocmd WinNew * wincmd p')
  20. command('help help')
  21. -- Window 1002 is opened, but the autocmd switches back to 1000 and
  22. -- creates the help buffer there instead.
  23. eq(1000, fn.win_getid())
  24. command('quit')
  25. -- Before #9773, Nvim would crash on quitting the help window.
  26. eq(1002, fn.win_getid())
  27. end)
  28. it('multibyte help tags work #23975', function()
  29. mkdir('Xhelptags')
  30. finally(function()
  31. rmdir('Xhelptags')
  32. end)
  33. mkdir('Xhelptags/doc')
  34. write_file('Xhelptags/doc/Xhelptags.txt', '*…*')
  35. command('helptags Xhelptags/doc')
  36. command('set rtp+=Xhelptags')
  37. command('help …')
  38. eq('*…*', api.nvim_get_current_line())
  39. end)
  40. end)