macro_spec.lua 709 B

12345678910111213141516171819202122232425262728293031
  1. local helpers = require('test.functional.helpers')(after_each)
  2. local eq = helpers.eq
  3. local eval = helpers.eval
  4. local feed = helpers.feed
  5. local clear = helpers.clear
  6. local expect = helpers.expect
  7. local command = helpers.command
  8. describe('macros', function()
  9. before_each(clear)
  10. it('can be recorded and replayed', function()
  11. feed('qiahello<esc>q')
  12. expect('hello')
  13. eq(eval('@i'), 'ahello')
  14. feed('@i')
  15. expect('hellohello')
  16. eq(eval('@i'), 'ahello')
  17. end)
  18. it('applies maps', function()
  19. command('imap x l')
  20. command('nmap l a')
  21. feed('qilxxx<esc>q')
  22. expect('lll')
  23. eq(eval('@i'), 'lxxx')
  24. feed('@i')
  25. expect('llllll')
  26. eq(eval('@i'), 'lxxx')
  27. end)
  28. end)