normal_spec.lua 968 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 fn = n.fn
  6. local feed = n.feed
  7. local expect = n.expect
  8. local eq = t.eq
  9. local eval = n.eval
  10. before_each(clear)
  11. describe(':normal!', function()
  12. it('can get out of Insert mode if called from Ex mode #17924', function()
  13. feed('gQnormal! Ifoo<CR>')
  14. expect('foo')
  15. end)
  16. it('does not execute command in Ex mode when running out of characters', function()
  17. command('let g:var = 0')
  18. command('normal! gQlet g:var = 1')
  19. eq(0, eval('g:var'))
  20. end)
  21. it('gQinsert does not hang #17980', function()
  22. command('normal! gQinsert')
  23. expect('')
  24. end)
  25. it('can stop Visual mode without closing cmdwin vim-patch:9.0.0234', function()
  26. feed('q:')
  27. feed('v')
  28. eq('v', fn.mode(1))
  29. eq(':', fn.getcmdwintype())
  30. command('normal! \027')
  31. eq('n', fn.mode(1))
  32. eq(':', fn.getcmdwintype())
  33. end)
  34. end)