Mercurial > vim
annotate src/testdir/test_syntax.vim @ 30007:4123e4bd1708 v9.0.0341
patch 9.0.0341: mapset() does not restore <Nop> mapping properly
Commit: https://github.com/vim/vim/commit/92a3d20682d46359bb50a452b4f831659e799155
Author: zeertzjq <zeertzjq@outlook.com>
Date: Wed Aug 31 16:40:17 2022 +0100
patch 9.0.0341: mapset() does not restore <Nop> mapping properly
Problem: mapset() does not restore <Nop> mapping properly.
Solution: Use an empty string for <Nop>. (closes https://github.com/vim/vim/issues/11022)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 31 Aug 2022 17:45:03 +0200 |
parents | 80929331a836 |
children | ae10b91ac6b3 |
rev | line source |
---|---|
7687
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test for syntax and syntax iskeyword option |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
17089
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
3 source check.vim |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
4 CheckFeature syntax |
7687
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
11553
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
6 source view_util.vim |
13329
424321d6eea7
patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents:
13322
diff
changeset
|
7 source screendump.vim |
11553
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
8 |
7687
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 func GetSyntaxItem(pat) |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 let c = '' |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 let a = ['a', getreg('a'), getregtype('a')] |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 0 |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 redraw! |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 call search(a:pat, 'W') |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 let synid = synID(line('.'), col('.'), 1) |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 while synid == synID(line('.'), col('.'), 1) |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 norm! v"ay |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 " stop at whitespace |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 if @a =~# '\s' |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 break |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 endif |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 let c .= @a |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 norm! l |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 endw |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 call call('setreg', a) |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 0 |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 return c |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 endfunc |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 |
23043
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
30 func AssertHighlightGroups(lnum, startcol, expected, trans = 1, msg = "") |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
31 " Assert that the characters starting at a given (line, col) |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
32 " sequentially match the expected highlight groups. |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
33 " If groups are provided as a string, each character is assumed to be a |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
34 " group and spaces represent no group, useful for visually describing tests. |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
35 let l:expectedGroups = type(a:expected) == v:t_string |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
36 \ ? a:expected->split('\zs')->map({_, v -> trim(v)}) |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
37 \ : a:expected |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
38 let l:errors = 0 |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
39 let l:msg = (a:msg->empty() ? "" : a:msg .. ": ") |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
40 \ .. "Wrong highlight group at " .. a:lnum .. "," |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
41 |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
42 for l:i in range(a:startcol, a:startcol + l:expectedGroups->len() - 1) |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
43 let l:errors += synID(a:lnum, l:i, a:trans) |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
44 \ ->synIDattr("name") |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
45 \ ->assert_equal(l:expectedGroups[l:i - 1], |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
46 \ l:msg .. l:i) |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
47 endfor |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
48 endfunc |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
49 |
7687
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 func Test_syn_iskeyword() |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 new |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 call setline(1, [ |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 \ 'CREATE TABLE FOOBAR(', |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 \ ' DLTD_BY VARCHAR2(100)', |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 \ ');', |
16376
3b5d401a58ce
patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
56 \ '']) |
7687
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 syntax on |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 set ft=sql |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 syn match SYN /C\k\+\>/ |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 hi link SYN ErrorMsg |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 call assert_equal('DLTD_BY', GetSyntaxItem('DLTD')) |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 /\<D\k\+\>/:norm! ygn |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 call assert_equal('DLTD_BY', @0) |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 redir @c |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 syn iskeyword |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 redir END |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 call assert_equal("\nsyntax iskeyword not set", @c) |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 syn iskeyword @,48-57,_,192-255 |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 redir @c |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 syn iskeyword |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 redir END |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 call assert_equal("\nsyntax iskeyword @,48-57,_,192-255", @c) |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 setlocal isk-=_ |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 call assert_equal('DLTD_BY', GetSyntaxItem('DLTD')) |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 /\<D\k\+\>/:norm! ygn |
10476
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
79 let b2 = @0 |
7687
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 call assert_equal('DLTD', @0) |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 syn iskeyword clear |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 redir @c |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 syn iskeyword |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 redir END |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 call assert_equal("\nsyntax iskeyword not set", @c) |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 quit! |
61354fabf8a2
commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 endfunc |
8937
da4f6e238374
commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents:
7687
diff
changeset
|
90 |
da4f6e238374
commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents:
7687
diff
changeset
|
91 func Test_syntax_after_reload() |
da4f6e238374
commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents:
7687
diff
changeset
|
92 split Xsomefile |
da4f6e238374
commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents:
7687
diff
changeset
|
93 call setline(1, ['hello', 'there']) |
da4f6e238374
commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents:
7687
diff
changeset
|
94 w! |
da4f6e238374
commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents:
7687
diff
changeset
|
95 only! |
da4f6e238374
commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents:
7687
diff
changeset
|
96 setl filetype=hello |
da4f6e238374
commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents:
7687
diff
changeset
|
97 au FileType hello let g:gotit = 1 |
da4f6e238374
commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents:
7687
diff
changeset
|
98 call assert_false(exists('g:gotit')) |
da4f6e238374
commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents:
7687
diff
changeset
|
99 edit other |
da4f6e238374
commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents:
7687
diff
changeset
|
100 buf Xsomefile |
da4f6e238374
commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents:
7687
diff
changeset
|
101 call assert_equal('hello', &filetype) |
da4f6e238374
commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents:
7687
diff
changeset
|
102 call assert_true(exists('g:gotit')) |
da4f6e238374
commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents:
7687
diff
changeset
|
103 call delete('Xsomefile') |
da4f6e238374
commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents:
7687
diff
changeset
|
104 endfunc |
10476
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
105 |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
106 func Test_syntime() |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
107 CheckFeature profile |
10476
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
108 |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
109 syntax on |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
110 syntime on |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
111 let a = execute('syntime report') |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
112 call assert_equal("\nNo Syntax items defined for this buffer", a) |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
113 |
24596
acd9220bdd0b
patch 8.2.2837: various code lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24442
diff
changeset
|
114 let a = execute('syntime clear') |
acd9220bdd0b
patch 8.2.2837: various code lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24442
diff
changeset
|
115 call assert_equal("\nNo Syntax items defined for this buffer", a) |
acd9220bdd0b
patch 8.2.2837: various code lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24442
diff
changeset
|
116 |
10476
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
117 view ../memfile_test.c |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
118 setfiletype cpp |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
119 redraw |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
120 let a = execute('syntime report') |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
121 call assert_match('^ TOTAL *COUNT *MATCH *SLOWEST *AVERAGE *NAME *PATTERN', a) |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
122 call assert_match(' \d*\.\d* \+[^0]\d* .* cppRawString ', a) |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
123 call assert_match(' \d*\.\d* \+[^0]\d* .* cppNumber ', a) |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
124 |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
125 syntime off |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
126 syntime clear |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
127 let a = execute('syntime report') |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
128 call assert_match('^ TOTAL *COUNT *MATCH *SLOWEST *AVERAGE *NAME *PATTERN', a) |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
129 call assert_notmatch('.* cppRawString *', a) |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
130 call assert_notmatch('.* cppNumber*', a) |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
131 call assert_notmatch('[1-9]', a) |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
132 |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
133 call assert_fails('syntime abc', 'E475:') |
10476
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
134 |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
135 syntax clear |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
136 let a = execute('syntime report') |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
137 call assert_equal("\nNo Syntax items defined for this buffer", a) |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
138 |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
139 bd |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
140 endfunc |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
141 |
15097
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14161
diff
changeset
|
142 func Test_syntime_completion() |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
143 CheckFeature profile |
15097
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14161
diff
changeset
|
144 |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14161
diff
changeset
|
145 call feedkeys(":syntime \<C-A>\<C-B>\"\<CR>", 'tx') |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14161
diff
changeset
|
146 call assert_equal('"syntime clear off on report', @:) |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14161
diff
changeset
|
147 endfunc |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14161
diff
changeset
|
148 |
10476
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
149 func Test_syntax_list() |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
150 syntax on |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
151 let a = execute('syntax list') |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
152 call assert_equal("\nNo Syntax items defined for this buffer", a) |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
153 |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
154 view ../memfile_test.c |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
155 setfiletype c |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
156 |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
157 let a = execute('syntax list') |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
158 call assert_match('cInclude*', a) |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
159 call assert_match('cDefine', a) |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
160 |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
161 let a = execute('syntax list cDefine') |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
162 call assert_notmatch('cInclude*', a) |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
163 call assert_match('cDefine', a) |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
164 call assert_match(' links to Macro$', a) |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
165 |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
166 call assert_fails('syntax list ABCD', 'E28:') |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
167 call assert_fails('syntax list @ABCD', 'E392:') |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
168 |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
169 syntax clear |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
170 let a = execute('syntax list') |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
171 call assert_equal("\nNo Syntax items defined for this buffer", a) |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
172 |
20109
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20101
diff
changeset
|
173 syntax keyword Type int containedin=g1 skipwhite skipempty skipnl nextgroup=Abc |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20101
diff
changeset
|
174 let exp = "Type xxx containedin=g1 nextgroup=Abc skipnl skipwhite skipempty int" |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20101
diff
changeset
|
175 call assert_equal(exp, split(execute("syntax list"), "\n")[1]) |
e82996ad131f
patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents:
20101
diff
changeset
|
176 |
10476
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
177 bd |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
178 endfunc |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
179 |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
180 func Test_syntax_completion() |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
181 call feedkeys(":syn \<C-A>\<C-B>\"\<CR>", 'tx') |
20623
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
182 call assert_equal('"syn case clear cluster conceal enable foldlevel include iskeyword keyword list manual match off on region reset spell sync', @:) |
10476
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
183 |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
184 call feedkeys(":syn case \<C-A>\<C-B>\"\<CR>", 'tx') |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
185 call assert_equal('"syn case ignore match', @:) |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
186 |
10534
1c6db35e3527
commit https://github.com/vim/vim/commit/2d02839050a2557bf36dab37ccd9f92168a757d1
Christian Brabandt <cb@256bit.org>
parents:
10478
diff
changeset
|
187 call feedkeys(":syn spell \<C-A>\<C-B>\"\<CR>", 'tx') |
1c6db35e3527
commit https://github.com/vim/vim/commit/2d02839050a2557bf36dab37ccd9f92168a757d1
Christian Brabandt <cb@256bit.org>
parents:
10478
diff
changeset
|
188 call assert_equal('"syn spell default notoplevel toplevel', @:) |
1c6db35e3527
commit https://github.com/vim/vim/commit/2d02839050a2557bf36dab37ccd9f92168a757d1
Christian Brabandt <cb@256bit.org>
parents:
10478
diff
changeset
|
189 |
1c6db35e3527
commit https://github.com/vim/vim/commit/2d02839050a2557bf36dab37ccd9f92168a757d1
Christian Brabandt <cb@256bit.org>
parents:
10478
diff
changeset
|
190 call feedkeys(":syn sync \<C-A>\<C-B>\"\<CR>", 'tx') |
1c6db35e3527
commit https://github.com/vim/vim/commit/2d02839050a2557bf36dab37ccd9f92168a757d1
Christian Brabandt <cb@256bit.org>
parents:
10478
diff
changeset
|
191 call assert_equal('"syn sync ccomment clear fromstart linebreaks= linecont lines= match maxlines= minlines= region', @:) |
1c6db35e3527
commit https://github.com/vim/vim/commit/2d02839050a2557bf36dab37ccd9f92168a757d1
Christian Brabandt <cb@256bit.org>
parents:
10478
diff
changeset
|
192 |
10624
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
193 " Check that clearing "Aap" avoids it showing up before Boolean. |
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
194 hi Aap ctermfg=blue |
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
195 call feedkeys(":syn list \<C-A>\<C-B>\"\<CR>", 'tx') |
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
196 call assert_match('^"syn list Aap Boolean Character ', @:) |
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
197 hi clear Aap |
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
198 |
10476
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
199 call feedkeys(":syn list \<C-A>\<C-B>\"\<CR>", 'tx') |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
200 call assert_match('^"syn list Boolean Character ', @:) |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
201 |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
202 call feedkeys(":syn match \<C-A>\<C-B>\"\<CR>", 'tx') |
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
203 call assert_match('^"syn match Boolean Character ', @:) |
29890
80929331a836
patch 9.0.0283: cannot complete "syn list @cluster"
Bram Moolenaar <Bram@vim.org>
parents:
29267
diff
changeset
|
204 |
80929331a836
patch 9.0.0283: cannot complete "syn list @cluster"
Bram Moolenaar <Bram@vim.org>
parents:
29267
diff
changeset
|
205 syn cluster Aax contains=Aap |
80929331a836
patch 9.0.0283: cannot complete "syn list @cluster"
Bram Moolenaar <Bram@vim.org>
parents:
29267
diff
changeset
|
206 call feedkeys(":syn list @A\<C-A>\<C-B>\"\<CR>", 'tx') |
80929331a836
patch 9.0.0283: cannot complete "syn list @cluster"
Bram Moolenaar <Bram@vim.org>
parents:
29267
diff
changeset
|
207 call assert_match('^"syn list @Aax', @:) |
10476
751851a84c41
commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents:
8937
diff
changeset
|
208 endfunc |
10618
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
209 |
18977
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18392
diff
changeset
|
210 func Test_echohl_completion() |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18392
diff
changeset
|
211 call feedkeys(":echohl no\<C-A>\<C-B>\"\<CR>", 'tx') |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18392
diff
changeset
|
212 call assert_equal('"echohl NonText Normal none', @:) |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18392
diff
changeset
|
213 endfunc |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18392
diff
changeset
|
214 |
10618
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
215 func Test_syntax_arg_skipped() |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
216 syn clear |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
217 syntax case ignore |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
218 if 0 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
219 syntax case match |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
220 endif |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
221 call assert_match('case ignore', execute('syntax case')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
222 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
223 syn keyword Foo foo |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
224 call assert_match('Foo', execute('syntax')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
225 syn clear |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
226 call assert_match('case match', execute('syntax case')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
227 call assert_notmatch('Foo', execute('syntax')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
228 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
229 if has('conceal') |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
230 syn clear |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
231 syntax conceal on |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
232 if 0 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
233 syntax conceal off |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
234 endif |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
235 call assert_match('conceal on', execute('syntax conceal')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
236 syn clear |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
237 call assert_match('conceal off', execute('syntax conceal')) |
10622
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
238 |
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
239 syntax conceal on |
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
240 syntax conceal off |
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
241 call assert_match('conceal off', execute('syntax conceal')) |
10618
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
242 endif |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
243 |
10624
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
244 syntax region Bar start=/</ end=/>/ |
10618
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
245 if 0 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
246 syntax region NotTest start=/</ end=/>/ contains=@Spell |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
247 endif |
10624
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
248 call assert_match('Bar', execute('syntax')) |
10618
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
249 call assert_notmatch('NotTest', execute('syntax')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
250 call assert_notmatch('Spell', execute('syntax')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
251 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
252 hi Foo ctermfg=blue |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
253 let a = execute('hi Foo') |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
254 if 0 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
255 syntax rest |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
256 endif |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
257 call assert_equal(a, execute('hi Foo')) |
10624
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
258 hi clear Bar |
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
259 hi clear Foo |
10618
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
260 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
261 set ft=tags |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
262 syn off |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
263 if 0 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
264 syntax enable |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
265 endif |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
266 call assert_match('No Syntax items defined', execute('syntax')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
267 syntax enable |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
268 call assert_match('tagComment', execute('syntax')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
269 set ft= |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
270 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
271 syn clear |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
272 if 0 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
273 syntax include @Spell nothing |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
274 endif |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
275 call assert_notmatch('Spell', execute('syntax')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
276 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
277 syn clear |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
278 syn iskeyword 48-57,$,_ |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
279 call assert_match('48-57,$,_', execute('syntax iskeyword')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
280 if 0 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
281 syn clear |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
282 syn iskeyword clear |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
283 endif |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
284 call assert_match('48-57,$,_', execute('syntax iskeyword')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
285 syn iskeyword clear |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
286 call assert_match('not set', execute('syntax iskeyword')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
287 syn iskeyword 48-57,$,_ |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
288 syn clear |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
289 call assert_match('not set', execute('syntax iskeyword')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
290 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
291 syn clear |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
292 syn keyword Foo foo |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
293 if 0 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
294 syn keyword NotAdded bar |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
295 endif |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
296 call assert_match('Foo', execute('syntax')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
297 call assert_notmatch('NotAdded', execute('highlight')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
298 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
299 syn clear |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
300 syn keyword Foo foo |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
301 call assert_match('Foo', execute('syntax')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
302 call assert_match('Foo', execute('syntax list')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
303 call assert_notmatch('Foo', execute('if 0 | syntax | endif')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
304 call assert_notmatch('Foo', execute('if 0 | syntax list | endif')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
305 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
306 syn clear |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
307 syn match Fopi /asdf/ |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
308 if 0 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
309 syn match Fopx /asdf/ |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
310 endif |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
311 call assert_match('Fopi', execute('syntax')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
312 call assert_notmatch('Fopx', execute('syntax')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
313 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
314 syn clear |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
315 syn spell toplevel |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
316 call assert_match('spell toplevel', execute('syntax spell')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
317 if 0 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
318 syn spell notoplevel |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
319 endif |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
320 call assert_match('spell toplevel', execute('syntax spell')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
321 syn spell notoplevel |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
322 call assert_match('spell notoplevel', execute('syntax spell')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
323 syn spell default |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
324 call assert_match('spell default', execute('syntax spell')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
325 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
326 syn clear |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
327 if 0 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
328 syntax cluster Spell |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
329 endif |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
330 call assert_notmatch('Spell', execute('syntax')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
331 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
332 syn clear |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
333 syn keyword Foo foo |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
334 syn sync ccomment |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
335 syn sync maxlines=5 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
336 if 0 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
337 syn sync maxlines=11 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
338 endif |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
339 call assert_match('on C-style comments', execute('syntax sync')) |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
340 call assert_match('maximal 5 lines', execute('syntax sync')) |
10622
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
341 syn sync clear |
10618
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
342 if 0 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
343 syn sync ccomment |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
344 endif |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
345 call assert_notmatch('on C-style comments', execute('syntax sync')) |
22928
de6c242ec236
patch 8.2.2011: "syn sync" reports a very large number
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
346 syn sync fromstart |
de6c242ec236
patch 8.2.2011: "syn sync" reports a very large number
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
347 call assert_match('syncing starts at the first line', execute('syntax sync')) |
10618
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
348 |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
349 syn clear |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
350 endfunc |
4ee16e5e2e26
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents:
10534
diff
changeset
|
351 |
20101
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
352 " Check for an error. Used when multiple errors are thrown and we are checking |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
353 " for an earliest error. |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
354 func AssertFails(cmd, errcode) |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
355 let save_exception = '' |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
356 try |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
357 exe a:cmd |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
358 catch |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
359 let save_exception = v:exception |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
360 endtry |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
361 call assert_match(a:errcode, save_exception) |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
362 endfunc |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
363 |
11354
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
364 func Test_syntax_invalid_arg() |
10622
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
365 call assert_fails('syntax case asdf', 'E390:') |
10624
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
366 if has('conceal') |
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
367 call assert_fails('syntax conceal asdf', 'E390:') |
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
368 endif |
10622
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
369 call assert_fails('syntax spell asdf', 'E390:') |
11354
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
370 call assert_fails('syntax clear @ABCD', 'E391:') |
20101
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
371 call assert_fails('syntax include random_file', 'E484:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
372 call assert_fails('syntax include <afile>', 'E495:') |
11354
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
373 call assert_fails('syntax sync x', 'E404:') |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
374 call assert_fails('syntax keyword Abc a[', 'E789:') |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
375 call assert_fails('syntax keyword Abc a[bc]d', 'E890:') |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
20725
diff
changeset
|
376 call assert_fails('syntax cluster Abc add=A add=', 'E406:') |
19950
9cbe3a4f1492
patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
377 |
9cbe3a4f1492
patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
378 " Test for too many \z\( and unmatched \z\( |
9cbe3a4f1492
patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
379 " Not able to use assert_fails() here because both E50:/E879: and E475: |
9cbe3a4f1492
patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
380 " messages are emitted. |
9cbe3a4f1492
patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
381 set regexpengine=1 |
20101
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
382 call AssertFails("syntax region MyRegion start='\\z\\(' end='\\*/'", 'E52:') |
19950
9cbe3a4f1492
patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
383 |
20101
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
384 let cmd = "syntax region MyRegion start='" |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
385 let cmd ..= repeat("\\z\\(.\\)", 10) .. "' end='\*/'" |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
386 call AssertFails(cmd, 'E50:') |
19950
9cbe3a4f1492
patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
387 |
9cbe3a4f1492
patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
388 set regexpengine=2 |
20101
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
389 call AssertFails("syntax region MyRegion start='\\z\\(' end='\\*/'", 'E54:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
390 |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
391 let cmd = "syntax region MyRegion start='" |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
392 let cmd ..= repeat("\\z\\(.\\)", 10) .. "' end='\*/'" |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
393 call AssertFails(cmd, 'E879:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
394 set regexpengine& |
19950
9cbe3a4f1492
patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
395 |
20101
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
396 call AssertFails('syntax keyword cMyItem grouphere G1', 'E393:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
397 call AssertFails('syntax sync match Abc grouphere MyItem "abc"', 'E394:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
398 call AssertFails('syn keyword Type contains int', 'E395:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
399 call assert_fails('syntax include @Xxx', 'E397:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
400 call AssertFails('syntax region X start', 'E398:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
401 call assert_fails('syntax region X start="{"', 'E399:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
402 call AssertFails('syntax cluster contains=Abc', 'E400:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
403 call AssertFails("syntax match Character /'.'", 'E401:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
404 call AssertFails("syntax match Character /'.'/a", 'E402:') |
22375
595ea7f099cd
patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents:
22258
diff
changeset
|
405 call assert_fails('syntax sync linecont /\%(/', 'E53:') |
20101
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
406 call assert_fails('syntax sync linecont /pat', 'E404:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
407 call assert_fails('syntax sync linecont', 'E404:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
408 call assert_fails('syntax sync linecont /pat1/ linecont /pat2/', 'E403:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
409 call assert_fails('syntax sync minlines=a', 'E404:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
410 call AssertFails('syntax match ABC /x/ contains=', 'E406:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
411 call AssertFails("syntax match Character contains /'.'/", 'E405:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
412 call AssertFails('syntax match ccFoo "Foo" nextgroup=ALLBUT,F', 'E407:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
413 call AssertFails('syntax region Block start="{" contains=F,ALLBUT', 'E408:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
414 call AssertFails("syntax match Characters contains=a.*x /'.'/", 'E409:') |
22375
595ea7f099cd
patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents:
22258
diff
changeset
|
415 call assert_fails('syntax match Search /abc/ contains=ALLBUT,/\%(/', 'E53:') |
10622
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
416 endfunc |
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
417 |
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
418 func Test_syn_sync() |
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
419 syntax region HereGroup start=/this/ end=/that/ |
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
420 syntax sync match SyncHere grouphere HereGroup "pattern" |
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
421 call assert_match('SyncHere', execute('syntax sync')) |
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
422 syn sync clear |
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
423 call assert_notmatch('SyncHere', execute('syntax sync')) |
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
424 syn clear |
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
425 endfunc |
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
426 |
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
427 func Test_syn_clear() |
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
428 syntax keyword Foo foo |
10624
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
429 syntax keyword Bar tar |
10622
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
430 call assert_match('Foo', execute('syntax')) |
10624
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
431 call assert_match('Bar', execute('syntax')) |
11254
918942a3b0ef
patch 8.0.0513: getting name of cleared highlight group is wrong
Christian Brabandt <cb@256bit.org>
parents:
10626
diff
changeset
|
432 call assert_equal('Foo', synIDattr(hlID("Foo"), "name")) |
10622
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
433 syn clear Foo |
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
434 call assert_notmatch('Foo', execute('syntax')) |
10624
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
435 call assert_match('Bar', execute('syntax')) |
11254
918942a3b0ef
patch 8.0.0513: getting name of cleared highlight group is wrong
Christian Brabandt <cb@256bit.org>
parents:
10626
diff
changeset
|
436 call assert_equal('Foo', synIDattr(hlID("Foo"), "name")) |
10624
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
437 syn clear Foo Bar |
10622
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
438 call assert_notmatch('Foo', execute('syntax')) |
10624
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
439 call assert_notmatch('Bar', execute('syntax')) |
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
440 hi clear Foo |
11254
918942a3b0ef
patch 8.0.0513: getting name of cleared highlight group is wrong
Christian Brabandt <cb@256bit.org>
parents:
10626
diff
changeset
|
441 call assert_equal('Foo', synIDattr(hlID("Foo"), "name")) |
10624
5ac9d7920f11
patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents:
10622
diff
changeset
|
442 hi clear Bar |
20101
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
443 call assert_fails('syntax clear invalid_syngroup', 'E28:') |
10622
bcacc849852a
patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
10618
diff
changeset
|
444 endfunc |
10626
37b1197fdd6f
patch 8.0.0202: no test for invalid syntax group name
Christian Brabandt <cb@256bit.org>
parents:
10624
diff
changeset
|
445 |
37b1197fdd6f
patch 8.0.0202: no test for invalid syntax group name
Christian Brabandt <cb@256bit.org>
parents:
10624
diff
changeset
|
446 func Test_invalid_name() |
37b1197fdd6f
patch 8.0.0202: no test for invalid syntax group name
Christian Brabandt <cb@256bit.org>
parents:
10624
diff
changeset
|
447 syn clear |
37b1197fdd6f
patch 8.0.0202: no test for invalid syntax group name
Christian Brabandt <cb@256bit.org>
parents:
10624
diff
changeset
|
448 syn keyword Nop yes |
37b1197fdd6f
patch 8.0.0202: no test for invalid syntax group name
Christian Brabandt <cb@256bit.org>
parents:
10624
diff
changeset
|
449 call assert_fails("syntax keyword Wr\x17ong bar", 'E669:') |
37b1197fdd6f
patch 8.0.0202: no test for invalid syntax group name
Christian Brabandt <cb@256bit.org>
parents:
10624
diff
changeset
|
450 syntax keyword @Wrong bar |
37b1197fdd6f
patch 8.0.0202: no test for invalid syntax group name
Christian Brabandt <cb@256bit.org>
parents:
10624
diff
changeset
|
451 call assert_match('W18:', execute('1messages')) |
37b1197fdd6f
patch 8.0.0202: no test for invalid syntax group name
Christian Brabandt <cb@256bit.org>
parents:
10624
diff
changeset
|
452 syn clear |
37b1197fdd6f
patch 8.0.0202: no test for invalid syntax group name
Christian Brabandt <cb@256bit.org>
parents:
10624
diff
changeset
|
453 hi clear Nop |
37b1197fdd6f
patch 8.0.0202: no test for invalid syntax group name
Christian Brabandt <cb@256bit.org>
parents:
10624
diff
changeset
|
454 hi clear @Wrong |
37b1197fdd6f
patch 8.0.0202: no test for invalid syntax group name
Christian Brabandt <cb@256bit.org>
parents:
10624
diff
changeset
|
455 endfunc |
11345
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
456 |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
457 func Test_ownsyntax() |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
458 new Xfoo |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
459 call setline(1, '#define FOO') |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
460 syntax on |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
461 set filetype=c |
22258
a6af570dad75
patch 8.2.1678: crash when using ":set" after ":ownsyntax"
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
462 |
11345
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
463 ownsyntax perl |
22258
a6af570dad75
patch 8.2.1678: crash when using ":set" after ":ownsyntax"
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
464 " this should not crash |
a6af570dad75
patch 8.2.1678: crash when using ":set" after ":ownsyntax"
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
465 set |
a6af570dad75
patch 8.2.1678: crash when using ":set" after ":ownsyntax"
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
466 |
11345
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
467 call assert_equal('perlComment', synIDattr(synID(line('.'), col('.'), 1), 'name')) |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
468 call assert_equal('c', b:current_syntax) |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
469 call assert_equal('perl', w:current_syntax) |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
470 |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
471 " A new split window should have the original syntax. |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
472 split |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
473 call assert_equal('cDefine', synIDattr(synID(line('.'), col('.'), 1), 'name')) |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
474 call assert_equal('c', b:current_syntax) |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
475 call assert_equal(0, exists('w:current_syntax')) |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
476 |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
477 wincmd x |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
478 call assert_equal('perlComment', synIDattr(synID(line("."), col("."), 1), "name")) |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
479 |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
480 syntax off |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
481 set filetype& |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
482 %bw! |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
483 endfunc |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
484 |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
485 func Test_ownsyntax_completion() |
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
486 call feedkeys(":ownsyntax java\<C-A>\<C-B>\"\<CR>", 'tx') |
17869
70f53ec4db93
patch 8.1.1931: syntax test fails
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
487 call assert_equal('"ownsyntax java javacc javascript javascriptreact', @:) |
11345
329653a02657
patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
488 endfunc |
11354
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
489 |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
490 func Test_highlight_invalid_arg() |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
491 if has('gui_running') |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
492 call assert_fails('hi XXX guifg=xxx', 'E254:') |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
493 endif |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
494 call assert_fails('hi DoesNotExist', 'E411:') |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
495 call assert_fails('hi link', 'E412:') |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
496 call assert_fails('hi link a', 'E412:') |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
497 call assert_fails('hi link a b c', 'E413:') |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
498 call assert_fails('hi XXX =', 'E415:') |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
499 call assert_fails('hi XXX cterm', 'E416:') |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
500 call assert_fails('hi XXX cterm=', 'E417:') |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
501 call assert_fails('hi XXX cterm=DoesNotExist', 'E418:') |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
502 call assert_fails('hi XXX ctermfg=DoesNotExist', 'E421:') |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
503 call assert_fails('hi XXX xxx=White', 'E423:') |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
504 endfunc |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11345
diff
changeset
|
505 |
11465
7cbcba782c4e
patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
506 func Test_bg_detection() |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
507 CheckNotGui |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
508 |
26211
485c7c4afeb7
patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
509 " auto-detection of &bg, make sure it isn't set anywhere before this test |
11465
7cbcba782c4e
patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
510 hi Normal ctermbg=0 |
7cbcba782c4e
patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
511 call assert_equal('dark', &bg) |
7cbcba782c4e
patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
512 hi Normal ctermbg=4 |
7cbcba782c4e
patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
513 call assert_equal('dark', &bg) |
7cbcba782c4e
patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
514 hi Normal ctermbg=12 |
7cbcba782c4e
patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
515 call assert_equal('light', &bg) |
7cbcba782c4e
patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
516 hi Normal ctermbg=15 |
7cbcba782c4e
patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
517 call assert_equal('light', &bg) |
7cbcba782c4e
patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
518 |
11599
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
519 " manually-set &bg takes precedence over auto-detection |
11465
7cbcba782c4e
patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
520 set bg=light |
7cbcba782c4e
patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
521 hi Normal ctermbg=4 |
7cbcba782c4e
patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
522 call assert_equal('light', &bg) |
7cbcba782c4e
patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
523 set bg=dark |
7cbcba782c4e
patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
524 hi Normal ctermbg=12 |
7cbcba782c4e
patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
525 call assert_equal('dark', &bg) |
13322
0dc2e4998a15
patch 8.0.1535: C syntax test still fails when using gvim
Christian Brabandt <cb@256bit.org>
parents:
13320
diff
changeset
|
526 |
0dc2e4998a15
patch 8.0.1535: C syntax test still fails when using gvim
Christian Brabandt <cb@256bit.org>
parents:
13320
diff
changeset
|
527 hi Normal ctermbg=NONE |
11465
7cbcba782c4e
patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
528 endfunc |
11529
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
529 |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
530 func Test_syntax_hangs() |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
531 CheckFunction reltimefloat |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
532 CheckFeature syntax |
11529
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
533 |
29071
b90bca860b5a
patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28475
diff
changeset
|
534 " So, it turns out the Windows 7 implements TimerQueue timers differently |
b90bca860b5a
patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28475
diff
changeset
|
535 " and they can expire *before* the requested time has elapsed. So allow for |
b90bca860b5a
patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28475
diff
changeset
|
536 " the timeout occurring after 80 ms (5 * 16 (the typical clock tick)). |
b90bca860b5a
patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28475
diff
changeset
|
537 if has("win32") |
b90bca860b5a
patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28475
diff
changeset
|
538 let min_timeout = 0.08 |
b90bca860b5a
patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28475
diff
changeset
|
539 else |
b90bca860b5a
patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28475
diff
changeset
|
540 let min_timeout = 0.1 |
b90bca860b5a
patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28475
diff
changeset
|
541 endif |
b90bca860b5a
patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28475
diff
changeset
|
542 |
11529
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
543 " This pattern takes a long time to match, it should timeout. |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
544 new |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
545 call setline(1, ['aaa', repeat('abc ', 1000), 'ccc']) |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
546 let start = reltime() |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
547 set nolazyredraw redrawtime=101 |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
548 syn match Error /\%#=1a*.*X\@<=b*/ |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
549 redraw |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
550 let elapsed = reltimefloat(reltime(start)) |
29210
947c8434894a
patch 8.2.5124: when syntax timeout test fails it does not show the time
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
551 call assert_inrange(min_timeout, 1.0, elapsed) |
11529
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
552 |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
553 " second time syntax HL is disabled |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
554 let start = reltime() |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
555 redraw |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
556 let elapsed = reltimefloat(reltime(start)) |
29210
947c8434894a
patch 8.2.5124: when syntax timeout test fails it does not show the time
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
557 call assert_inrange(0, 0.1, elapsed) |
11529
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
558 |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
559 " after CTRL-L the timeout flag is reset |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
560 let start = reltime() |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
561 exe "normal \<C-L>" |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
562 redraw |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
563 let elapsed = reltimefloat(reltime(start)) |
29210
947c8434894a
patch 8.2.5124: when syntax timeout test fails it does not show the time
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
564 call assert_inrange(min_timeout, 1.0, elapsed) |
11529
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
565 |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
566 set redrawtime& |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
567 bwipe! |
998d2cf59caa
patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents:
11465
diff
changeset
|
568 endfunc |
11553
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
569 |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
570 func Test_conceal() |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
571 CheckFeature conceal |
11553
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
572 |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
573 new |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
574 call setline(1, ['', '123456']) |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
575 syn match test23 "23" conceal cchar=X |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
576 syn match test45 "45" conceal |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
577 |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
578 set conceallevel=0 |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
579 call assert_equal('123456 ', ScreenLines(2, 7)[0]) |
11579
52e3a77c097b
patch 8.0.0672: third item of synconcealed() changes too often
Christian Brabandt <cb@256bit.org>
parents:
11559
diff
changeset
|
580 call assert_equal([[0, '', 0], [0, '', 0], [0, '', 0], [0, '', 0], [0, '', 0], [0, '', 0]], map(range(1, 6), 'synconcealed(2, v:val)')) |
11553
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
581 |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
582 set conceallevel=1 |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
583 call assert_equal('1X 6 ', ScreenLines(2, 7)[0]) |
11579
52e3a77c097b
patch 8.0.0672: third item of synconcealed() changes too often
Christian Brabandt <cb@256bit.org>
parents:
11559
diff
changeset
|
584 call assert_equal([[0, '', 0], [1, 'X', 1], [1, 'X', 1], [1, ' ', 2], [1, ' ', 2], [0, '', 0]], map(range(1, 6), 'synconcealed(2, v:val)')) |
11553
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
585 |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
586 set conceallevel=1 |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
587 set listchars=conceal:Y |
11579
52e3a77c097b
patch 8.0.0672: third item of synconcealed() changes too often
Christian Brabandt <cb@256bit.org>
parents:
11559
diff
changeset
|
588 call assert_equal([[0, '', 0], [1, 'X', 1], [1, 'X', 1], [1, 'Y', 2], [1, 'Y', 2], [0, '', 0]], map(range(1, 6), 'synconcealed(2, v:val)')) |
11553
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
589 call assert_equal('1XY6 ', ScreenLines(2, 7)[0]) |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
590 |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
591 set conceallevel=2 |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
592 call assert_match('1X6 ', ScreenLines(2, 7)[0]) |
11579
52e3a77c097b
patch 8.0.0672: third item of synconcealed() changes too often
Christian Brabandt <cb@256bit.org>
parents:
11559
diff
changeset
|
593 call assert_equal([[0, '', 0], [1, 'X', 1], [1, 'X', 1], [1, '', 2], [1, '', 2], [0, '', 0]], map(range(1, 6), 'synconcealed(2, v:val)')) |
11553
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
594 |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
595 set conceallevel=3 |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
596 call assert_match('16 ', ScreenLines(2, 7)[0]) |
11579
52e3a77c097b
patch 8.0.0672: third item of synconcealed() changes too often
Christian Brabandt <cb@256bit.org>
parents:
11559
diff
changeset
|
597 call assert_equal([[0, '', 0], [1, '', 1], [1, '', 1], [1, '', 2], [1, '', 2], [0, '', 0]], map(range(1, 6), 'synconcealed(2, v:val)')) |
11553
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
598 |
20101
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
599 call AssertFails("syntax match Entity '&' conceal cchar=\<Tab>", 'E844:') |
64ea318298b7
patch 8.2.0606: several syntax HL errors not checked
Bram Moolenaar <Bram@vim.org>
parents:
19950
diff
changeset
|
600 |
11553
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
601 syn clear |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
602 set conceallevel& |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
603 bw! |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11529
diff
changeset
|
604 endfunc |
11599
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
605 |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
606 func Test_synstack_synIDtrans() |
11599
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
607 new |
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
608 setfiletype c |
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
609 syntax on |
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
610 call setline(1, ' /* A comment with a TODO */') |
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
611 |
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
612 call assert_equal([], synstack(1, 1)) |
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
613 |
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
614 norm f/ |
17624
4c7097a980a5
patch 8.1.1809: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17596
diff
changeset
|
615 eval synstack(line("."), col("."))->map('synIDattr(v:val, "name")')->assert_equal(['cComment', 'cCommentStart']) |
4c7097a980a5
patch 8.1.1809: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17596
diff
changeset
|
616 eval synstack(line("."), col("."))->map('synIDattr(synIDtrans(v:val), "name")')->assert_equal(['Comment', 'Comment']) |
11599
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
617 |
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
618 norm fA |
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
619 call assert_equal(['cComment'], map(synstack(line("."), col(".")), 'synIDattr(v:val, "name")')) |
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
620 call assert_equal(['Comment'], map(synstack(line("."), col(".")), 'synIDattr(synIDtrans(v:val), "name")')) |
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
621 |
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
622 norm fT |
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
623 call assert_equal(['cComment', 'cTodo'], map(synstack(line("."), col(".")), 'synIDattr(v:val, "name")')) |
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
624 call assert_equal(['Comment', 'Todo'], map(synstack(line("."), col(".")), 'synIDattr(synIDtrans(v:val), "name")')) |
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
625 |
19783
546bdeef35f1
patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
18977
diff
changeset
|
626 call assert_fails("let n=synIDtrans([])", 'E745:') |
546bdeef35f1
patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
18977
diff
changeset
|
627 |
11599
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
628 syn clear |
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
629 bw! |
3cf157856dc8
patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents:
11579
diff
changeset
|
630 endfunc |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
631 |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
632 " Check highlighting for a small piece of C code with a screen dump. |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
633 func Test_syntax_c() |
20625
116c7bd5e980
patch 8.2.0866: not enough tests for buffer writing
Bram Moolenaar <Bram@vim.org>
parents:
20623
diff
changeset
|
634 CheckRunVimInTerminal |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
635 call writefile([ |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
636 \ '/* comment line at the top */', |
18392
e15c1d8a6b99
patch 8.1.2190: syntax test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents:
18390
diff
changeset
|
637 \ 'int main(int argc, char **argv) { // another comment', |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
638 \ '#if 0', |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
639 \ ' int not_used;', |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
640 \ '#else', |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
641 \ ' int used;', |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
642 \ '#endif', |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
643 \ ' printf("Just an example piece of C code\n");', |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
644 \ ' return 0x0ff;', |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
645 \ '}', |
18390
c34ee31d0878
patch 8.1.2189: syntax highlighting wrong for tab
Bram Moolenaar <Bram@vim.org>
parents:
18382
diff
changeset
|
646 \ "\t\t ", |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
647 \ ' static void', |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
648 \ 'myFunction(const double count, struct nothing, long there) {', |
18364
ee489bb09ea8
patch 8.1.2176: syntax attributes not combined with Visual highlighting
Bram Moolenaar <Bram@vim.org>
parents:
18323
diff
changeset
|
649 \ "\t// 123: nothing to endif here", |
18323
72a0dbe1c004
patch 8.1.2156: first character after Tab is not highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17869
diff
changeset
|
650 \ "\tfor (int i = 0; i < count; ++i) {", |
72a0dbe1c004
patch 8.1.2156: first character after Tab is not highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17869
diff
changeset
|
651 \ "\t break;", |
72a0dbe1c004
patch 8.1.2156: first character after Tab is not highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17869
diff
changeset
|
652 \ "\t}", |
18382
3fd7d544eedb
patch 8.1.2185: syntax test fails
Bram Moolenaar <Bram@vim.org>
parents:
18364
diff
changeset
|
653 \ "\tNote: asdf", |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
654 \ '}', |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
655 \ ], 'Xtest.c') |
29071
b90bca860b5a
patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28475
diff
changeset
|
656 |
13320
a90063ec1cd6
patch 8.0.1534: C syntax test fails when using gvim
Christian Brabandt <cb@256bit.org>
parents:
13306
diff
changeset
|
657 " This makes the default for 'background' use "dark", check that the |
a90063ec1cd6
patch 8.0.1534: C syntax test fails when using gvim
Christian Brabandt <cb@256bit.org>
parents:
13306
diff
changeset
|
658 " response to t_RB corrects it to "light". |
a90063ec1cd6
patch 8.0.1534: C syntax test fails when using gvim
Christian Brabandt <cb@256bit.org>
parents:
13306
diff
changeset
|
659 let $COLORFGBG = '15;0' |
a90063ec1cd6
patch 8.0.1534: C syntax test fails when using gvim
Christian Brabandt <cb@256bit.org>
parents:
13306
diff
changeset
|
660 |
18392
e15c1d8a6b99
patch 8.1.2190: syntax test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents:
18390
diff
changeset
|
661 let buf = RunVimInTerminal('Xtest.c', {}) |
18382
3fd7d544eedb
patch 8.1.2185: syntax test fails
Bram Moolenaar <Bram@vim.org>
parents:
18364
diff
changeset
|
662 call term_sendkeys(buf, ":syn keyword Search Note\r") |
18390
c34ee31d0878
patch 8.1.2189: syntax highlighting wrong for tab
Bram Moolenaar <Bram@vim.org>
parents:
18382
diff
changeset
|
663 call term_sendkeys(buf, ":syn match Error /^\\s\\+$/\r") |
18364
ee489bb09ea8
patch 8.1.2176: syntax attributes not combined with Visual highlighting
Bram Moolenaar <Bram@vim.org>
parents:
18323
diff
changeset
|
664 call term_sendkeys(buf, ":set hlsearch\r") |
ee489bb09ea8
patch 8.1.2176: syntax attributes not combined with Visual highlighting
Bram Moolenaar <Bram@vim.org>
parents:
18323
diff
changeset
|
665 call term_sendkeys(buf, "/endif\r") |
ee489bb09ea8
patch 8.1.2176: syntax attributes not combined with Visual highlighting
Bram Moolenaar <Bram@vim.org>
parents:
18323
diff
changeset
|
666 call term_sendkeys(buf, "vjfC") |
13329
424321d6eea7
patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents:
13322
diff
changeset
|
667 call VerifyScreenDump(buf, 'Test_syntax_c_01', {}) |
18364
ee489bb09ea8
patch 8.1.2176: syntax attributes not combined with Visual highlighting
Bram Moolenaar <Bram@vim.org>
parents:
18323
diff
changeset
|
668 |
ee489bb09ea8
patch 8.1.2176: syntax attributes not combined with Visual highlighting
Bram Moolenaar <Bram@vim.org>
parents:
18323
diff
changeset
|
669 call term_sendkeys(buf, "\<Esc>") |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
670 call StopVimInTerminal(buf) |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
671 |
13320
a90063ec1cd6
patch 8.0.1534: C syntax test fails when using gvim
Christian Brabandt <cb@256bit.org>
parents:
13306
diff
changeset
|
672 let $COLORFGBG = '' |
13304
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
673 call delete('Xtest.c') |
013c44d9dc09
patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
11599
diff
changeset
|
674 endfun |
14161
7cac4646c552
patch 8.1.0098: segfault when pattern with z() is very slow
Christian Brabandt <cb@256bit.org>
parents:
13329
diff
changeset
|
675 |
26620
c4055c13fbe9
patch 8.2.3839: using z() with z1 not tested for syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
676 " Test \z(...) along with \z1 |
c4055c13fbe9
patch 8.2.3839: using z() with z1 not tested for syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
677 func Test_syn_zsub() |
c4055c13fbe9
patch 8.2.3839: using z() with z1 not tested for syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
678 new |
c4055c13fbe9
patch 8.2.3839: using z() with z1 not tested for syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
679 syntax on |
c4055c13fbe9
patch 8.2.3839: using z() with z1 not tested for syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
680 call setline(1, 'xxx start foo xxx not end foo xxx end foo xxx') |
c4055c13fbe9
patch 8.2.3839: using z() with z1 not tested for syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
681 let l:expected = ' ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ ' |
c4055c13fbe9
patch 8.2.3839: using z() with z1 not tested for syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
682 |
c4055c13fbe9
patch 8.2.3839: using z() with z1 not tested for syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
683 for l:re in [0, 1, 2] |
c4055c13fbe9
patch 8.2.3839: using z() with z1 not tested for syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
684 " Example taken from :help :syn-ext-match |
c4055c13fbe9
patch 8.2.3839: using z() with z1 not tested for syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
685 syntax region Z start="start \z(\I\i*\)" skip="not end \z1" end="end \z1" |
c4055c13fbe9
patch 8.2.3839: using z() with z1 not tested for syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
686 eval AssertHighlightGroups(1, 1, l:expected, 1, 'regexp=' .. l:re) |
c4055c13fbe9
patch 8.2.3839: using z() with z1 not tested for syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
687 syntax clear Z |
c4055c13fbe9
patch 8.2.3839: using z() with z1 not tested for syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
688 endfor |
c4055c13fbe9
patch 8.2.3839: using z() with z1 not tested for syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
689 |
c4055c13fbe9
patch 8.2.3839: using z() with z1 not tested for syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
690 set re& |
c4055c13fbe9
patch 8.2.3839: using z() with z1 not tested for syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
691 bw! |
c4055c13fbe9
patch 8.2.3839: using z() with z1 not tested for syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
692 endfunc |
c4055c13fbe9
patch 8.2.3839: using z() with z1 not tested for syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
693 |
14161
7cac4646c552
patch 8.1.0098: segfault when pattern with z() is very slow
Christian Brabandt <cb@256bit.org>
parents:
13329
diff
changeset
|
694 " Using \z() in a region with NFA failing should not crash. |
7cac4646c552
patch 8.1.0098: segfault when pattern with z() is very slow
Christian Brabandt <cb@256bit.org>
parents:
13329
diff
changeset
|
695 func Test_syn_wrong_z_one() |
7cac4646c552
patch 8.1.0098: segfault when pattern with z() is very slow
Christian Brabandt <cb@256bit.org>
parents:
13329
diff
changeset
|
696 new |
7cac4646c552
patch 8.1.0098: segfault when pattern with z() is very slow
Christian Brabandt <cb@256bit.org>
parents:
13329
diff
changeset
|
697 call setline(1, ['just some text', 'with foo and bar to match with']) |
7cac4646c552
patch 8.1.0098: segfault when pattern with z() is very slow
Christian Brabandt <cb@256bit.org>
parents:
13329
diff
changeset
|
698 syn region FooBar start="foo\z(.*\)bar" end="\z1" |
7cac4646c552
patch 8.1.0098: segfault when pattern with z() is very slow
Christian Brabandt <cb@256bit.org>
parents:
13329
diff
changeset
|
699 call test_override("nfa_fail", 1) |
7cac4646c552
patch 8.1.0098: segfault when pattern with z() is very slow
Christian Brabandt <cb@256bit.org>
parents:
13329
diff
changeset
|
700 redraw! |
7cac4646c552
patch 8.1.0098: segfault when pattern with z() is very slow
Christian Brabandt <cb@256bit.org>
parents:
13329
diff
changeset
|
701 redraw! |
7cac4646c552
patch 8.1.0098: segfault when pattern with z() is very slow
Christian Brabandt <cb@256bit.org>
parents:
13329
diff
changeset
|
702 call test_override("ALL", 0) |
7cac4646c552
patch 8.1.0098: segfault when pattern with z() is very slow
Christian Brabandt <cb@256bit.org>
parents:
13329
diff
changeset
|
703 bwipe! |
7cac4646c552
patch 8.1.0098: segfault when pattern with z() is very slow
Christian Brabandt <cb@256bit.org>
parents:
13329
diff
changeset
|
704 endfunc |
17596
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
705 |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
706 func Test_syntax_after_bufdo() |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
707 call writefile(['/* aaa comment */'], 'Xaaa.c') |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
708 call writefile(['/* bbb comment */'], 'Xbbb.c') |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
709 call writefile(['/* ccc comment */'], 'Xccc.c') |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
710 call writefile(['/* ddd comment */'], 'Xddd.c') |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
711 |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
712 let bnr = bufnr('%') |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
713 new Xaaa.c |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
714 badd Xbbb.c |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
715 badd Xccc.c |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
716 badd Xddd.c |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
717 exe "bwipe " . bnr |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
718 let l = [] |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
719 bufdo call add(l, bufnr('%')) |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
720 call assert_equal(4, len(l)) |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
721 |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
722 syntax on |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
723 |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
724 " This used to only enable syntax HL in the last buffer. |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
725 bufdo tab split |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
726 tabrewind |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
727 for tab in range(1, 4) |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
728 norm fm |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
729 call assert_equal(['cComment'], map(synstack(line("."), col(".")), 'synIDattr(v:val, "name")')) |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
730 tabnext |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
731 endfor |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
732 |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
733 bwipe! Xaaa.c |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
734 bwipe! Xbbb.c |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
735 bwipe! Xccc.c |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
736 bwipe! Xddd.c |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
737 syntax off |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
738 call delete('Xaaa.c') |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
739 call delete('Xbbb.c') |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
740 call delete('Xccc.c') |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
741 call delete('Xddd.c') |
892b4ea3bad6
patch 8.1.1795: no syntax HL after splitting windows with :bufdo
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
742 endfunc |
19783
546bdeef35f1
patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
18977
diff
changeset
|
743 |
20623
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
744 func Test_syntax_foldlevel() |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
745 new |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
746 call setline(1, [ |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
747 \ 'void f(int a)', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
748 \ '{', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
749 \ ' if (a == 1) {', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
750 \ ' a = 0;', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
751 \ ' } else if (a == 2) {', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
752 \ ' a = 1;', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
753 \ ' } else {', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
754 \ ' a = 2;', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
755 \ ' }', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
756 \ ' if (a > 0) {', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
757 \ ' if (a == 1) {', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
758 \ ' a = 0;', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
759 \ ' } /* missing newline */ } /* end of outer if */ else {', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
760 \ ' a = 1;', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
761 \ ' }', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
762 \ ' if (a == 1)', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
763 \ ' {', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
764 \ ' a = 0;', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
765 \ ' }', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
766 \ ' else if (a == 2)', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
767 \ ' {', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
768 \ ' a = 1;', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
769 \ ' }', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
770 \ ' else', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
771 \ ' {', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
772 \ ' a = 2;', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
773 \ ' }', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
774 \ '}', |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
775 \ ]) |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
776 setfiletype c |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
777 syntax on |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
778 set foldmethod=syntax |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
779 |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
780 call assert_fails('syn foldlevel start start', 'E390:') |
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
781 call assert_fails('syn foldlevel not_an_option', 'E390:') |
20623
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
782 |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
783 set foldlevel=1 |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
784 |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
785 syn foldlevel start |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
786 redir @c |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
787 syn foldlevel |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
788 redir END |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
789 call assert_equal("\nsyntax foldlevel start", @c) |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
790 syn sync fromstart |
22928
de6c242ec236
patch 8.2.2011: "syn sync" reports a very large number
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
791 call assert_match('from the first line$', execute('syn sync')) |
20623
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
792 let a = map(range(3,9), 'foldclosed(v:val)') |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
793 call assert_equal([3,3,3,3,3,3,3], a) " attached cascade folds together |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
794 let a = map(range(10,15), 'foldclosed(v:val)') |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
795 call assert_equal([10,10,10,10,10,10], a) " over-attached 'else' hidden |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
796 let a = map(range(16,27), 'foldclosed(v:val)') |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
797 let unattached_results = [-1,17,17,17,-1,21,21,21,-1,25,25,25] |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
798 call assert_equal(unattached_results, a) " unattached cascade folds separately |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
799 |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
800 syn foldlevel minimum |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
801 redir @c |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
802 syn foldlevel |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
803 redir END |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
804 call assert_equal("\nsyntax foldlevel minimum", @c) |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
805 syn sync fromstart |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
806 let a = map(range(3,9), 'foldclosed(v:val)') |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
807 call assert_equal([3,3,5,5,7,7,7], a) " attached cascade folds separately |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
808 let a = map(range(10,15), 'foldclosed(v:val)') |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
809 call assert_equal([10,10,10,13,13,13], a) " over-attached 'else' visible |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
810 let a = map(range(16,27), 'foldclosed(v:val)') |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
811 call assert_equal(unattached_results, a) " unattached cascade folds separately |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
812 |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
813 set foldlevel=2 |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
814 |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
815 syn foldlevel start |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
816 syn sync fromstart |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
817 let a = map(range(11,14), 'foldclosed(v:val)') |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
818 call assert_equal([11,11,11,-1], a) " over-attached 'else' hidden |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
819 |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
820 syn foldlevel minimum |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
821 syn sync fromstart |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
822 let a = map(range(11,14), 'foldclosed(v:val)') |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
823 call assert_equal([11,11,-1,-1], a) " over-attached 'else' visible |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
824 |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
825 quit! |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
826 endfunc |
99b6e6bf48bf
patch 8.2.0865: syntax foldlevel is taken from the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
20109
diff
changeset
|
827 |
20725
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
828 func Test_search_syntax_skip() |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
829 new |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
830 let lines =<< trim END |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
831 |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
832 /* This is VIM */ |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
833 Another Text for VIM |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
834 let a = "VIM" |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
835 END |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
836 call setline(1, lines) |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
837 syntax on |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
838 syntax match Comment "^/\*.*\*/" |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
839 syntax match String '".*"' |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
840 |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
841 " Skip argument using string evaluation. |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
842 1 |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
843 call search('VIM', 'w', '', 0, 'synIDattr(synID(line("."), col("."), 1), "name") =~? "comment"') |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
844 call assert_equal('Another Text for VIM', getline('.')) |
29267
f27ec19f2034
patch 8.2.5152: search() gets stuck with "c" and skip evaluates to true
Bram Moolenaar <Bram@vim.org>
parents:
29210
diff
changeset
|
845 |
20725
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
846 1 |
29267
f27ec19f2034
patch 8.2.5152: search() gets stuck with "c" and skip evaluates to true
Bram Moolenaar <Bram@vim.org>
parents:
29210
diff
changeset
|
847 call search('VIM', 'cw', '', 0, 'synIDattr(synID(line("."), col("."), 1), "name") !~? "string"') |
20725
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
848 call assert_equal(' let a = "VIM"', getline('.')) |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
849 |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
850 " Skip argument using Lambda. |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
851 1 |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
852 call search('VIM', 'w', '', 0, { -> synIDattr(synID(line("."), col("."), 1), "name") =~? "comment"}) |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
853 call assert_equal('Another Text for VIM', getline('.')) |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
854 |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
855 1 |
29267
f27ec19f2034
patch 8.2.5152: search() gets stuck with "c" and skip evaluates to true
Bram Moolenaar <Bram@vim.org>
parents:
29210
diff
changeset
|
856 call search('VIM', 'cw', '', 0, { -> synIDattr(synID(line("."), col("."), 1), "name") !~? "string"}) |
20725
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
857 call assert_equal(' let a = "VIM"', getline('.')) |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
858 |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
859 " Skip argument using funcref. |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
860 func InComment() |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
861 return synIDattr(synID(line("."), col("."), 1), "name") =~? "comment" |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
862 endfunc |
29267
f27ec19f2034
patch 8.2.5152: search() gets stuck with "c" and skip evaluates to true
Bram Moolenaar <Bram@vim.org>
parents:
29210
diff
changeset
|
863 func NotInString() |
20725
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
864 return synIDattr(synID(line("."), col("."), 1), "name") !~? "string" |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
865 endfunc |
29267
f27ec19f2034
patch 8.2.5152: search() gets stuck with "c" and skip evaluates to true
Bram Moolenaar <Bram@vim.org>
parents:
29210
diff
changeset
|
866 |
20725
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
867 1 |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
868 call search('VIM', 'w', '', 0, function('InComment')) |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
869 call assert_equal('Another Text for VIM', getline('.')) |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
870 |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
871 1 |
29267
f27ec19f2034
patch 8.2.5152: search() gets stuck with "c" and skip evaluates to true
Bram Moolenaar <Bram@vim.org>
parents:
29210
diff
changeset
|
872 call search('VIM', 'cw', '', 0, function('NotInString')) |
20725
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
873 call assert_equal(' let a = "VIM"', getline('.')) |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
874 |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
875 delfunc InComment |
29267
f27ec19f2034
patch 8.2.5152: search() gets stuck with "c" and skip evaluates to true
Bram Moolenaar <Bram@vim.org>
parents:
29210
diff
changeset
|
876 delfunc NotInString |
20725
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
877 bwipe! |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
878 endfunc |
f4455c71a8aa
patch 8.2.0915: search() cannot skip over matches like searchpair() can
Bram Moolenaar <Bram@vim.org>
parents:
20625
diff
changeset
|
879 |
23043
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
880 func Test_syn_contained_transparent() |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
881 " Comments starting with "Regression:" show the result when the highlighting |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
882 " span of the containing item is assigned to the contained region. |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
883 syntax on |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
884 |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
885 let l:case = "Transparent region contained in region" |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
886 new |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
887 syntax region X start=/\[/ end=/\]/ contained transparent |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
888 syntax region Y start=/(/ end=/)/ contains=X |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
889 |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
890 call setline(1, "==(--[~~]--)==") |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
891 let l:expected = " YYYYYYYYYY " |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
892 eval AssertHighlightGroups(1, 1, l:expected, 1, l:case) |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
893 syntax clear Y X |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
894 bw! |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
895 |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
896 let l:case = "Transparent region extends region" |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
897 new |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
898 syntax region X start=/\[/ end=/\]/ contained transparent |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
899 syntax region Y start=/(/ end=/)/ end=/e/ contains=X |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
900 |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
901 call setline(1, "==(--[~~e~~]--)==") |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
902 let l:expected = " YYYYYYYYYYYYY " |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
903 " Regression: " YYYYYYY YYY " |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
904 eval AssertHighlightGroups(1, 1, l:expected, 1, l:case) |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
905 syntax clear Y X |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
906 bw! |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
907 |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
908 let l:case = "Nested transparent regions extend region" |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
909 new |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
910 syntax region X start=/\[/ end=/\]/ contained transparent |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
911 syntax region Y start=/(/ end=/)/ end=/e/ contains=X |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
912 |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
913 call setline(1, "==(--[~~e~~[~~e~~]~~e~~]--)==") |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
914 let l:expected = " YYYYYYYYYYYYYYYYYYYYYYYYY " |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
915 " Regression: " YYYYYYY YYYYYYYYY " |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
916 eval AssertHighlightGroups(1, 1, l:expected, 1, l:case) |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
917 syntax clear Y X |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
918 bw! |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
919 |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
920 let l:case = "Transparent region contained in match" |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
921 new |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
922 syntax region X start=/\[/ end=/\]/ contained transparent |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
923 syntax match Y /(.\{-})/ contains=X |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
924 |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
925 call setline(1, "==(--[~~]--)==") |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
926 let l:expected = " YYYYYYYYYY " |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
927 eval AssertHighlightGroups(1, 1, l:expected, 1, l:case) |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
928 syntax clear Y X |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
929 bw! |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
930 |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
931 let l:case = "Transparent region extends match" |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
932 new |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
933 syntax region X start=/\[/ end=/\]/ contained transparent |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
934 syntax match Y /(.\{-}[e)]/ contains=X |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
935 |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
936 call setline(1, "==(--[~~e~~]--)==") |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
937 let l:expected = " YYYYYYYYYY " |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
938 " Regression: " YYYYYYY " |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
939 eval AssertHighlightGroups(1, 1, l:expected, 1, l:case) |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
940 syntax clear Y X |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
941 bw! |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
942 |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
943 let l:case = "Nested transparent regions extend match" |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
944 new |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
945 syntax region X start=/\[/ end=/\]/ contained transparent |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
946 syntax match Y /(.\{-}[e)]/ contains=X |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
947 |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
948 call setline(1, "==(--[~~e~~[~~e~~]~~e~~]--)==") |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
949 let l:expected = " YYYYYYYYYYYYYYYYYYYYYY " |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
950 " Regression: " YYYYYYY YYYYYY " |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
951 eval AssertHighlightGroups(1, 1, l:expected, 1, l:case) |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
952 syntax clear Y X |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
953 bw! |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
954 endfunc |
6616bf17dc94
patch 8.2.2068: transparent syntax item uses start/end of containing region
Bram Moolenaar <Bram@vim.org>
parents:
22928
diff
changeset
|
955 |
24442
d16a69f718b5
patch 8.2.2761: using "syn include" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
23043
diff
changeset
|
956 func Test_syn_include_contains_TOP() |
d16a69f718b5
patch 8.2.2761: using "syn include" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
23043
diff
changeset
|
957 let l:case = "TOP in included syntax means its group list name" |
d16a69f718b5
patch 8.2.2761: using "syn include" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
23043
diff
changeset
|
958 new |
d16a69f718b5
patch 8.2.2761: using "syn include" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
23043
diff
changeset
|
959 syntax include @INCLUDED syntax/c.vim |
d16a69f718b5
patch 8.2.2761: using "syn include" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
23043
diff
changeset
|
960 syntax region FencedCodeBlockC start=/```c/ end=/```/ contains=@INCLUDED |
d16a69f718b5
patch 8.2.2761: using "syn include" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
23043
diff
changeset
|
961 |
d16a69f718b5
patch 8.2.2761: using "syn include" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
23043
diff
changeset
|
962 call setline(1, ['```c', '#if 0', 'int', '#else', 'int', '#endif', '```' ]) |
d16a69f718b5
patch 8.2.2761: using "syn include" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
23043
diff
changeset
|
963 let l:expected = ["cCppOutIf2"] |
d16a69f718b5
patch 8.2.2761: using "syn include" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
23043
diff
changeset
|
964 eval AssertHighlightGroups(3, 1, l:expected, 1) |
d16a69f718b5
patch 8.2.2761: using "syn include" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
23043
diff
changeset
|
965 " cCppOutElse has contains=TOP |
d16a69f718b5
patch 8.2.2761: using "syn include" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
23043
diff
changeset
|
966 let l:expected = ["cType"] |
d16a69f718b5
patch 8.2.2761: using "syn include" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
23043
diff
changeset
|
967 eval AssertHighlightGroups(5, 1, l:expected, 1, l:case) |
d16a69f718b5
patch 8.2.2761: using "syn include" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
23043
diff
changeset
|
968 syntax clear |
d16a69f718b5
patch 8.2.2761: using "syn include" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
23043
diff
changeset
|
969 bw! |
d16a69f718b5
patch 8.2.2761: using "syn include" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
23043
diff
changeset
|
970 endfunc |
d16a69f718b5
patch 8.2.2761: using "syn include" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
23043
diff
changeset
|
971 |
28475
a7556b47ff09
patch 8.2.4762: using freed memory using synstack() and synID() in WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
26620
diff
changeset
|
972 " This was using freed memory |
a7556b47ff09
patch 8.2.4762: using freed memory using synstack() and synID() in WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
26620
diff
changeset
|
973 func Test_WinEnter_synstack_synID() |
a7556b47ff09
patch 8.2.4762: using freed memory using synstack() and synID() in WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
26620
diff
changeset
|
974 autocmd WinEnter * call synstack(line("."), col(".")) |
a7556b47ff09
patch 8.2.4762: using freed memory using synstack() and synID() in WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
26620
diff
changeset
|
975 autocmd WinEnter * call synID(line('.'), col('.') - 1, 1) |
a7556b47ff09
patch 8.2.4762: using freed memory using synstack() and synID() in WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
26620
diff
changeset
|
976 call setline(1, 'aaaaa') |
a7556b47ff09
patch 8.2.4762: using freed memory using synstack() and synID() in WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
26620
diff
changeset
|
977 normal! $ |
a7556b47ff09
patch 8.2.4762: using freed memory using synstack() and synID() in WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
26620
diff
changeset
|
978 new |
a7556b47ff09
patch 8.2.4762: using freed memory using synstack() and synID() in WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
26620
diff
changeset
|
979 close |
a7556b47ff09
patch 8.2.4762: using freed memory using synstack() and synID() in WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
26620
diff
changeset
|
980 |
a7556b47ff09
patch 8.2.4762: using freed memory using synstack() and synID() in WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
26620
diff
changeset
|
981 au! WinEnter |
a7556b47ff09
patch 8.2.4762: using freed memory using synstack() and synID() in WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
26620
diff
changeset
|
982 bw! |
a7556b47ff09
patch 8.2.4762: using freed memory using synstack() and synID() in WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
26620
diff
changeset
|
983 endfunc |
a7556b47ff09
patch 8.2.4762: using freed memory using synstack() and synID() in WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
26620
diff
changeset
|
984 |
24442
d16a69f718b5
patch 8.2.2761: using "syn include" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
23043
diff
changeset
|
985 |
19783
546bdeef35f1
patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
18977
diff
changeset
|
986 " vim: shiftwidth=2 sts=2 expandtab |