annotate src/testdir/test_matchadd_conceal_utf8.vim @ 17049:f38fcbf343ce v8.1.1524

patch 8.1.1524: tests are silently skipped commit https://github.com/vim/vim/commit/b0f94c1ff34d27d33aa9f96204985ea29c2eb0a1 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 13 22:19:53 2019 +0200 patch 8.1.1524: tests are silently skipped Problem: Tests are silently skipped. Solution: Throw an exception for skipped tests in more places.
author Bram Moolenaar <Bram@vim.org>
date Thu, 13 Jun 2019 22:30:07 +0200
parents 2dcaa860e3fc
children 8e9e9124c7a2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for matchadd() and conceal feature using utf-8.
17049
f38fcbf343ce patch 8.1.1524: tests are silently skipped
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
2
15607
2dcaa860e3fc patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
3 if !has('conceal')
17049
f38fcbf343ce patch 8.1.1524: tests are silently skipped
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
4 throw 'Skipped, conceal feature missing'
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 endif
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 if !has('gui_running') && has('unix')
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 set term=ansi
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 endif
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 9618
diff changeset
11 func s:screenline(lnum) abort
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 let line = []
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 for c in range(1, winwidth(0))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call add(line, nr2char(screenchar(a:lnum, c)))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 endfor
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 return s:trim(join(line, ''))
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 9618
diff changeset
17 endfunc
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 9618
diff changeset
19 func s:trim(str) abort
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 return matchstr(a:str,'^\s*\zs.\{-}\ze\s*$')
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 9618
diff changeset
21 endfunc
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 9618
diff changeset
23 func Test_match_using_multibyte_conceal_char()
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 new
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 setlocal concealcursor=n conceallevel=1
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 1put='# This is a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 " 1234567890123456
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 let expect = '#ˑThisˑisˑaˑTest'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 call cursor(1, 1)
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call matchadd('Conceal', '\%2l ', 20, -1, {'conceal': "\u02d1"})
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 let lnum = 2
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 call assert_equal(expect, s:screenline(lnum))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 quit!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 9618
diff changeset
44 endfunc