robin/laufey

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

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

master
1.4 KiB39 linesraw
1-- Tests for adjusting window and contents
2
3local n = require('test.functional.testnvim')()
4local t = require('test.testutil')
5local Screen = require('test.functional.ui.screen')
6
7local describe, it, setup = t.describe, t.it, t.setup
8local clear, command = n.clear, n.command
9local insert = n.insert
10
11describe('063: Test for ":match", "matchadd()" and related functions', function()
12  setup(clear)
13
14  it('is working', function()
15    local screen = Screen.new(40, 5)
16
17    command('highlight MyGroup1 term=bold ctermbg=red guibg=red')
18    command('highlight MyGroup2 term=italic ctermbg=green guibg=green')
19    command('highlight MyGroup3 term=underline ctermbg=blue guibg=blue')
20
21    -- Check that "matchaddpos()" positions matches correctly
22    insert('abcdefghijklmnopq')
23    command("call matchaddpos('MyGroup1', [[1, 5], [1, 8, 3]], 10, 3)")
24    screen:expect([[
25      abcd{30:e}fg{30:hij}klmnop^q                       |
26      {1:~                                       }|*3
27                                              |
28    ]])
29
30    command('call clearmatches()')
31    command("call setline(1, 'abcdΣabcdef')")
32    command("call matchaddpos('MyGroup1', [[1, 4, 2], [1, 9, 2]])")
33    screen:expect([[
34      abc{30:dΣ}ab{30:cd}e^f                             |
35      {1:~                                       }|*3
36                                              |
37    ]])
38  end)
39end)