autoformat_join_spec.lua 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. -- Tests for setting the '[,'] marks when joining lines.
  2. local helpers = require('test.functional.helpers')(after_each)
  3. local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
  4. local command, expect = helpers.command, helpers.expect
  5. local poke_eventloop = helpers.poke_eventloop
  6. describe('autoformat join', function()
  7. setup(clear)
  8. it('is working', function()
  9. insert([[
  10. O sodales, ludite, vos qui
  11. attamen consulite per voster honur. Tua pulchra facies me fay planszer milies
  12. This line.
  13. Should be joined with the next line
  14. and with this line
  15. Results:]])
  16. feed('gg')
  17. feed('0gqj<cr>')
  18. poke_eventloop()
  19. command([[let a=string(getpos("'[")).'/'.string(getpos("']"))]])
  20. command("g/^This line/;'}-join")
  21. command([[let b=string(getpos("'[")).'/'.string(getpos("']"))]])
  22. command("$put ='First test: Start/End '.string(a)")
  23. command("$put ='Second test: Start/End '.string(b)")
  24. expect([[
  25. O sodales, ludite, vos qui attamen consulite per voster honur.
  26. Tua pulchra facies me fay planszer milies
  27. This line. Should be joined with the next line and with this line
  28. Results:
  29. First test: Start/End '[0, 1, 1, 0]/[0, 2, 1, 0]'
  30. Second test: Start/End '[0, 4, 11, 0]/[0, 4, 67, 0]']])
  31. end)
  32. end)