neovim

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

028_source_ctrl_v_spec.lua (1211B)


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