autoformat_join_spec.lua 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. -- Tests for setting the '[,'] marks when joining lines.
  2. local n = require('test.functional.testnvim')()
  3. local clear, feed, insert = n.clear, n.feed, n.insert
  4. local command, expect = n.command, n.expect
  5. local poke_eventloop = n.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)