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