robin/laufey

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

dundargoctest: move oldtests to test directory (#22536)af23d17388

master
1.0 KiB39 linesraw
1" Test for matchadd() and conceal feature using utf-8.
2
3source check.vim
4CheckFeature conceal
5
6func s:screenline(lnum) abort
7  let line = []
8  for c in range(1, winwidth(0))
9    call add(line, nr2char(a:lnum->screenchar(c)))
10  endfor
11  return s:trim(join(line, ''))
12endfunc
13
14func s:trim(str) abort
15  return matchstr(a:str,'^\s*\zs.\{-}\ze\s*$')
16endfunc
17
18func Test_match_using_multibyte_conceal_char()
19  new
20  setlocal concealcursor=n conceallevel=1
21
22  1put='# This is a Test'
23  "             1234567890123456
24  let expect = '#ˑThisˑisˑaˑTest'
25
26  call cursor(1, 1)
27  call matchadd('Conceal', '\%2l ', 20, -1, {'conceal': "\u02d1"})
28  redraw!
29
30  let lnum = 2
31  call assert_equal(expect, s:screenline(lnum))
32  call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
33  call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
34  call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
35  call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
36  call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
37
38  quit!
39endfunc