neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

autoformat_join_spec.lua (1197B)


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