robin/laufey

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

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

master
1.3 KiB58 linesraw
1-- Test for sourcing a file with CTRL-V's at the end of the line
2
3local n = require('test.functional.testnvim')()
4local t = require('test.testutil')
5
6local describe, it, before_each, teardown = t.describe, t.it, t.before_each, t.teardown
7local clear, feed, insert = n.clear, n.feed, n.insert
8local feed_command, expect = n.feed_command, n.expect
9
10describe('028', function()
11  before_each(clear)
12
13  it('CTRL-V at the end of the line is working', function()
14    insert([[
15      firstline
16      map __1 afirst
17      map __2 asecond
18      map __3 athird
19      map __4 afourth
20      map __5 afifth
21      map __1 asdX
22      map __2 asdXX
23      map __3 asdXX
24      map __4 asdXXX
25      map __5 asdXXX
26      lastline]])
27
28    feed(':%s/X/<C-v><C-v>/g<cr>')
29    feed(':/firstline/+1,/lastline/-1w! Xtestfile<cr>')
30    feed_command('so Xtestfile')
31    feed_command('%d')
32    feed('Gmm__1<Esc><Esc>__2<Esc>__3<Esc><Esc>__4<Esc>__5<Esc>')
33    feed(":'m,$s/<C-v><C-@>/0/g<cr>")
34
35    expect([[
36      sd
37      map __2 asdsecondsdsd0map __5 asd0fifth]])
38  end)
39
40  it('CTRL-X/CTRL-A is working', function()
41    insert([[
42      12352
43
44      12354]])
45    feed_command('/12352')
46    feed('<C-A>')
47    feed_command('/12354')
48    feed('<C-X>')
49    expect([[
50      12353
51
52      12353]])
53  end)
54
55  teardown(function()
56    os.remove('Xtestfile')
57  end)
58end)