robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

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