028_source_ctrl_v_spec.lua 1019 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. -- Test for sourcing a file with CTRL-V's at the end of the line
  2. local helpers = require('test.functional.helpers')(after_each)
  3. local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
  4. local feed_command, expect = helpers.feed_command, helpers.expect
  5. describe('CTRL-V at the end of the line', function()
  6. setup(clear)
  7. it('is working', function()
  8. insert([[
  9. firstline
  10. map __1 afirst
  11. map __2 asecond
  12. map __3 athird
  13. map __4 afourth
  14. map __5 afifth
  15. map __1 asdX
  16. map __2 asdXX
  17. map __3 asdXX
  18. map __4 asdXXX
  19. map __5 asdXXX
  20. lastline]])
  21. feed(':%s/X/<C-v><C-v>/g<cr>')
  22. feed(':/firstline/+1,/lastline/-1w! Xtestfile<cr>')
  23. feed_command('so Xtestfile')
  24. feed_command('%d')
  25. feed('Gmm__1<Esc><Esc>__2<Esc>__3<Esc><Esc>__4<Esc>__5<Esc>')
  26. feed(":'m,$s/<C-v><C-@>/0/g<cr>")
  27. expect([[
  28. sd
  29. map __2 asdsecondsdsd0map __5 asd0fifth]])
  30. end)
  31. teardown(function()
  32. os.remove('Xtestfile')
  33. end)
  34. end)