robin/laufey

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

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

master
4.1 KiB95 linesraw
1local n = require('test.functional.testnvim')()
2local t = require('test.testutil')
3local Screen = require('test.functional.ui.screen')
4
5local describe, it, before_each = t.describe, t.it, t.before_each
6local clear = n.clear
7local exec = n.exec
8local feed = n.feed
9
10before_each(clear)
11
12describe('matchaddpos()', function()
13  -- oldtest: Test_matchaddpos_dump()
14  it('can add more than 8 match positions vim-patch:9.0.0620', function()
15    local screen = Screen.new(60, 14)
16    exec([[
17      call setline(1, ['1234567890123']->repeat(14))
18      call matchaddpos('Search', range(1, 12)->map({i, v -> [v, v]}))
19    ]])
20    screen:expect([[
21      {10:^1}234567890123                                               |
22      1{10:2}34567890123                                               |
23      12{10:3}4567890123                                               |
24      123{10:4}567890123                                               |
25      1234{10:5}67890123                                               |
26      12345{10:6}7890123                                               |
27      123456{10:7}890123                                               |
28      1234567{10:8}90123                                               |
29      12345678{10:9}0123                                               |
30      123456789{10:0}123                                               |
31      1234567890{10:1}23                                               |
32      12345678901{10:2}3                                               |
33      1234567890123                                               |
34                                                                  |
35    ]])
36  end)
37end)
38
39describe('match highlighting', function()
40  -- oldtest: Test_match_in_linebreak()
41  it('does not continue in linebreak vim-patch:8.2.3698', function()
42    local screen = Screen.new(75, 10)
43    exec([=[
44      set breakindent linebreak breakat+=]
45      call printf('%s]%s', repeat('x', 50), repeat('x', 70))->setline(1)
46      call matchaddpos('ErrorMsg', [[1, 51]])
47    ]=])
48    screen:expect([[
49      ^xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx{9:]}                        |
50      xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx     |
51      {1:~                                                                          }|*7
52                                                                                 |
53    ]])
54  end)
55
56  it('is shown with incsearch vim-patch:8.2.3940', function()
57    local screen = Screen.new(75, 6)
58    exec([[
59      set incsearch
60      call setline(1, range(20))
61      call matchaddpos('ErrorMsg', [3])
62    ]])
63    screen:expect([[
64      ^0                                                                          |
65      1                                                                          |
66      {9:2}                                                                          |
67      3                                                                          |
68      4                                                                          |
69                                                                                 |
70    ]])
71    feed(':s/0')
72    screen:expect([[
73      {10:0}                                                                          |
74      1                                                                          |
75      {9:2}                                                                          |
76      3                                                                          |
77      4                                                                          |
78      :s/0^                                                                       |
79    ]])
80  end)
81
82  it('on a Tab vim-patch:8.2.4062', function()
83    local screen = Screen.new(75, 10)
84    exec([[
85      set linebreak
86      call setline(1, "\tix")
87      call matchadd('ErrorMsg', '\t')
88    ]])
89    screen:expect([[
90      {9:       ^ }ix                                                                 |
91      {1:~                                                                          }|*8
92                                                                                 |
93    ]])
94  end)
95end)