robin/laufey

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

robinmerge: 1dc9728daa1d8a2702

master
1.5 KiB39 linesraw
1local t = require('test.testutil')
2local n = require('test.functional.testnvim')()
3
4local describe, it, before_each = t.describe, t.it, t.before_each
5local clear = n.clear
6local command = n.command
7local eq = t.eq
8local feed = n.feed
9local fn = n.fn
10local pcall_err = t.pcall_err
11
12describe('search (/)', function()
13  before_each(clear)
14
15  it('fails with huge column (%c) value #9930', function()
16    eq([[Vim:E951: \% value too large]], pcall_err(command, '/\\v%18446744071562067968c'))
17    eq([[Vim:E951: \% value too large]], pcall_err(command, '/\\v%2147483648c'))
18  end)
19
20  it('operator + gn does not modify the Visual marks #40949', function()
21    fn.setline(1, { 'a b foo bar', 'x y zub foo', 'foo' })
22    feed('ggVj<Esc>') -- Select lines 1-2.
23    local vstart, vend = fn.getpos("'<"), fn.getpos("'>")
24    feed([[/\%Vfoo<CR>]])
25    feed('ggcgnX<Esc>')
26    eq({ vstart, vend, 'V' }, { fn.getpos("'<"), fn.getpos("'>"), fn.visualmode() })
27    -- "\%V" still means the selection: "." changes the next match in it, not the one on line 3.
28    feed('.')
29    eq({ 'a b X bar', 'x y zub X', 'foo' }, fn.getline(1, '$'))
30    -- Same for a forced-blockwise motion.
31    feed('ggd<C-v>j')
32    eq({ vstart, vend, 'V' }, { fn.getpos("'<"), fn.getpos("'>"), fn.visualmode() })
33    -- Same for an omap that starts Visual mode (custom textobj).
34    command('onoremap <silent> F :<C-U>normal! 0viw<CR>')
35    feed('GyF')
36    eq('foo', fn.getreg('"'))
37    eq({ vstart, vend, 'V' }, { fn.getpos("'<"), fn.getpos("'>"), fn.visualmode() })
38  end)
39end)