annotate src/testdir/test_syntax.vim @ 14239:7457bf2db968 v8.1.0136

patch 8.1.0136: Lua tests don't cover new features commit https://github.com/vim/vim/commit/2f362bf7f9acc9ec87799d1e41bf0ae7712d1f7a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 1 19:49:27 2018 +0200 patch 8.1.0136: Lua tests don't cover new features Problem: Lua tests don't cover new features. Solution: Add more tests. (Dominique Pelle, closes https://github.com/vim/vim/issues/3130)
author Christian Brabandt <cb@256bit.org>
date Sun, 01 Jul 2018 20:00:09 +0200
parents 7cac4646c552
children 1946487c74ba
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 if !has("syntax")
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 finish
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 endif
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
11553
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
7 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
8 source screendump.vim
11553
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
9
7687
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 func GetSyntaxItem(pat)
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 let c = ''
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 let a = ['a', getreg('a'), getregtype('a')]
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 0
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 redraw!
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 call search(a:pat, 'W')
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 let synid = synID(line('.'), col('.'), 1)
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 while synid == synID(line('.'), col('.'), 1)
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 norm! v"ay
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 " stop at whitespace
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 if @a =~# '\s'
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 break
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 endif
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 let c .= @a
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 norm! l
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 endw
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 call call('setreg', a)
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 0
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 return c
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 endfunc
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 func Test_syn_iskeyword()
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 new
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 call setline(1, [
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 \ 'CREATE TABLE FOOBAR(',
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 \ ' DLTD_BY VARCHAR2(100)',
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 \ ');',
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 \ ''])
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 syntax on
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 set ft=sql
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 syn match SYN /C\k\+\>/
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 hi link SYN ErrorMsg
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 call assert_equal('DLTD_BY', GetSyntaxItem('DLTD'))
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 /\<D\k\+\>/:norm! ygn
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 call assert_equal('DLTD_BY', @0)
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 redir @c
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 syn iskeyword
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 redir END
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 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
50
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 syn iskeyword @,48-57,_,192-255
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 redir @c
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 syn iskeyword
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 redir END
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 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
56
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 setlocal isk-=_
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 call assert_equal('DLTD_BY', GetSyntaxItem('DLTD'))
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 /\<D\k\+\>/:norm! ygn
10476
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
60 let b2 = @0
7687
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 call assert_equal('DLTD', @0)
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 syn iskeyword clear
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 redir @c
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 syn iskeyword
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 redir END
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 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
68
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 quit!
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 endfunc
8937
da4f6e238374 commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents: 7687
diff changeset
71
da4f6e238374 commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents: 7687
diff changeset
72 func Test_syntax_after_reload()
da4f6e238374 commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents: 7687
diff changeset
73 split Xsomefile
da4f6e238374 commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents: 7687
diff changeset
74 call setline(1, ['hello', 'there'])
da4f6e238374 commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents: 7687
diff changeset
75 w!
da4f6e238374 commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents: 7687
diff changeset
76 only!
da4f6e238374 commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents: 7687
diff changeset
77 setl filetype=hello
da4f6e238374 commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents: 7687
diff changeset
78 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
79 call assert_false(exists('g:gotit'))
da4f6e238374 commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents: 7687
diff changeset
80 edit other
da4f6e238374 commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents: 7687
diff changeset
81 buf Xsomefile
da4f6e238374 commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents: 7687
diff changeset
82 call assert_equal('hello', &filetype)
da4f6e238374 commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents: 7687
diff changeset
83 call assert_true(exists('g:gotit'))
da4f6e238374 commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents: 7687
diff changeset
84 call delete('Xsomefile')
da4f6e238374 commit https://github.com/vim/vim/commit/c3691332f72169c486066200c0f3935418364900
Christian Brabandt <cb@256bit.org>
parents: 7687
diff changeset
85 endfunc
10476
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
86
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
87 func Test_syntime()
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
88 if !has('profile')
10478
ea1beefcd664 commit https://github.com/vim/vim/commit/4c8980b717f73042f1d625ee255fa74eddb989ba
Christian Brabandt <cb@256bit.org>
parents: 10476
diff changeset
89 return
10476
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
90 endif
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
91
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
92 syntax on
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
93 syntime on
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
94 let a = execute('syntime report')
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
95 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
96
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
97 view ../memfile_test.c
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
98 setfiletype cpp
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
99 redraw
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
100 let a = execute('syntime report')
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
101 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
102 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
103 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
104
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
105 syntime off
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
106 syntime clear
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
107 let a = execute('syntime report')
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
108 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
109 call assert_notmatch('.* cppRawString *', a)
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
110 call assert_notmatch('.* cppNumber*', a)
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
111 call assert_notmatch('[1-9]', a)
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
112
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
113 call assert_fails('syntime abc', 'E475')
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
114
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
115 syntax clear
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
116 let a = execute('syntime report')
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
117 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
118
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
119 bd
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
120 endfunc
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
121
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
122 func Test_syntax_list()
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
123 syntax on
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
124 let a = execute('syntax list')
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
125 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
126
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
127 view ../memfile_test.c
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
128 setfiletype c
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
129
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
130 let a = execute('syntax list')
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
131 call assert_match('cInclude*', a)
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
132 call assert_match('cDefine', a)
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
133
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
134 let a = execute('syntax list cDefine')
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
135 call assert_notmatch('cInclude*', a)
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
136 call assert_match('cDefine', a)
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
137 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
138
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
139 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
140 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
141
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
142 syntax clear
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
143 let a = execute('syntax list')
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
144 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
145
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
146 bd
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
147 endfunc
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
148
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
149 func Test_syntax_completion()
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
150 call feedkeys(":syn \<C-A>\<C-B>\"\<CR>", 'tx')
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
151 call assert_equal('"syn case clear cluster conceal enable include iskeyword keyword list manual match off on region reset spell sync', @:)
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
152
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
153 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
154 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
155
10534
1c6db35e3527 commit https://github.com/vim/vim/commit/2d02839050a2557bf36dab37ccd9f92168a757d1
Christian Brabandt <cb@256bit.org>
parents: 10478
diff changeset
156 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
157 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
158
1c6db35e3527 commit https://github.com/vim/vim/commit/2d02839050a2557bf36dab37ccd9f92168a757d1
Christian Brabandt <cb@256bit.org>
parents: 10478
diff changeset
159 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
160 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
161
10624
5ac9d7920f11 patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents: 10622
diff changeset
162 " 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
163 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
164 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
165 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
166 hi clear Aap
5ac9d7920f11 patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents: 10622
diff changeset
167
10476
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
168 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
169 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
170
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
171 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
172 call assert_match('^"syn match Boolean Character ', @:)
751851a84c41 commit https://github.com/vim/vim/commit/73b484c4da00011317dc68ada4f5dfc6515ad263
Christian Brabandt <cb@256bit.org>
parents: 8937
diff changeset
173 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
174
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
175 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
176 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
177 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
178 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
179 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
180 endif
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
181 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
182
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
183 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
184 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
185 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
186 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
187 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
188
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
189 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
190 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
191 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
192 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
193 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
194 endif
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
195 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
196 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
197 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
198
bcacc849852a patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 10618
diff changeset
199 syntax conceal on
bcacc849852a patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 10618
diff changeset
200 syntax conceal off
bcacc849852a patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 10618
diff changeset
201 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
202 endif
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
203
10624
5ac9d7920f11 patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents: 10622
diff changeset
204 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
205 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
206 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
207 endif
10624
5ac9d7920f11 patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents: 10622
diff changeset
208 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
209 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
210 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
211
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
212 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
213 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
214 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
215 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
216 endif
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
217 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
218 hi clear Bar
5ac9d7920f11 patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents: 10622
diff changeset
219 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
220
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
221 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
222 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
223 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
224 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
225 endif
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('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
227 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
228 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
229 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
230
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
231 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
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 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
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_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
236
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
237 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
238 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
239 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
240 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
241 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
242 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
243 endif
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
244 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
245 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
246 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
247 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
248 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
249 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
250
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
251 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
252 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
253 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
254 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
255 endif
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
256 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
257 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
258
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
259 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
260 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
261 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
262 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
263 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
264 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
265
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
266 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
267 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
268 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
269 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
270 endif
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
271 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
272 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
273
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
274 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
275 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
276 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
277 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
278 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
279 endif
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
280 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
281 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
282 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
283 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
284 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
285
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
286 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
287 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
288 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
289 endif
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
290 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
291
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 clear
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
293 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
294 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
295 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
296 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
297 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
298 endif
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
299 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
300 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
301 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
302 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
303 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
304 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 call assert_notmatch('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
306
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 clear
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
308 endfunc
4ee16e5e2e26 patch 8.0.0198: some syntax arguments take effect even after "if 0"
Christian Brabandt <cb@256bit.org>
parents: 10534
diff changeset
309
11354
129077fb57e6 patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents: 11345
diff changeset
310 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
311 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
312 if has('conceal')
5ac9d7920f11 patch 8.0.0201: completion of highlight groups includes cleared names
Christian Brabandt <cb@256bit.org>
parents: 10622
diff changeset
313 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
314 endif
10622
bcacc849852a patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 10618
diff changeset
315 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
316 call assert_fails('syntax clear @ABCD', 'E391:')
129077fb57e6 patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents: 11345
diff changeset
317 call assert_fails('syntax include @Xxx', 'E397:')
129077fb57e6 patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents: 11345
diff changeset
318 call assert_fails('syntax region X start="{"', 'E399:')
129077fb57e6 patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents: 11345
diff changeset
319 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
320 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
321 call assert_fails('syntax keyword Abc a[bc]d', 'E890:')
10622
bcacc849852a patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 10618
diff changeset
322 endfunc
bcacc849852a patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 10618
diff changeset
323
bcacc849852a patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 10618
diff changeset
324 func Test_syn_sync()
bcacc849852a patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 10618
diff changeset
325 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
326 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
327 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
328 syn sync clear
bcacc849852a patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 10618
diff changeset
329 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
330 syn clear
bcacc849852a patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 10618
diff changeset
331 endfunc
bcacc849852a patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 10618
diff changeset
332
bcacc849852a patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 10618
diff changeset
333 func Test_syn_clear()
bcacc849852a patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 10618
diff changeset
334 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
335 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
336 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
337 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
338 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
339 syn clear Foo
bcacc849852a patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 10618
diff changeset
340 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
341 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
342 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
343 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
344 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
345 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
346 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
347 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
348 hi clear Bar
10622
bcacc849852a patch 8.0.0200: some syntax arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 10618
diff changeset
349 endfunc
10626
37b1197fdd6f patch 8.0.0202: no test for invalid syntax group name
Christian Brabandt <cb@256bit.org>
parents: 10624
diff changeset
350
37b1197fdd6f patch 8.0.0202: no test for invalid syntax group name
Christian Brabandt <cb@256bit.org>
parents: 10624
diff changeset
351 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
352 syn clear
37b1197fdd6f patch 8.0.0202: no test for invalid syntax group name
Christian Brabandt <cb@256bit.org>
parents: 10624
diff changeset
353 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
354 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
355 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
356 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
357 syn clear
37b1197fdd6f patch 8.0.0202: no test for invalid syntax group name
Christian Brabandt <cb@256bit.org>
parents: 10624
diff changeset
358 hi clear Nop
37b1197fdd6f patch 8.0.0202: no test for invalid syntax group name
Christian Brabandt <cb@256bit.org>
parents: 10624
diff changeset
359 hi clear @Wrong
37b1197fdd6f patch 8.0.0202: no test for invalid syntax group name
Christian Brabandt <cb@256bit.org>
parents: 10624
diff changeset
360 endfunc
11345
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
361
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
362 func Test_ownsyntax()
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
363 new Xfoo
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
364 call setline(1, '#define FOO')
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
365 syntax on
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
366 set filetype=c
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
367 ownsyntax perl
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
368 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
369 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
370 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
371
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
372 " 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
373 split
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
374 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
375 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
376 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
377
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
378 wincmd x
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
379 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
380
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
381 syntax off
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
382 set filetype&
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
383 %bw!
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
384 endfunc
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
385
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
386 func Test_ownsyntax_completion()
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
387 call feedkeys(":ownsyntax java\<C-A>\<C-B>\"\<CR>", 'tx')
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
388 call assert_equal('"ownsyntax java javacc javascript', @:)
329653a02657 patch 8.0.0558: :ownsyntax is not tested
Christian Brabandt <cb@256bit.org>
parents: 11254
diff changeset
389 endfunc
11354
129077fb57e6 patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents: 11345
diff changeset
390
129077fb57e6 patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents: 11345
diff changeset
391 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
392 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
393 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
394 endif
129077fb57e6 patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents: 11345
diff changeset
395 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
396 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
397 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
398 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
399 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
400 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
401 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
402 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
403 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
404 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
405 endfunc
129077fb57e6 patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents: 11345
diff changeset
406
11465
7cbcba782c4e patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents: 11354
diff changeset
407 func Test_bg_detection()
7cbcba782c4e patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents: 11354
diff changeset
408 if has('gui_running')
7cbcba782c4e patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents: 11354
diff changeset
409 return
7cbcba782c4e patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents: 11354
diff changeset
410 endif
7cbcba782c4e patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents: 11354
diff changeset
411 " auto-detection of &bg, make sure sure it isn't set anywhere before
7cbcba782c4e patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents: 11354
diff changeset
412 " this test
7cbcba782c4e patch 8.0.0616: not always setting 'background' correctly after :hi Normal
Christian Brabandt <cb@256bit.org>
parents: 11354
diff changeset
413 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
414 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
415 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
416 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
417 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
418 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
419 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
420 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
421
11599
3cf157856dc8 patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents: 11579
diff changeset
422 " 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
423 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
424 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
425 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
426 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
427 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
428 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
429
0dc2e4998a15 patch 8.0.1535: C syntax test still fails when using gvim
Christian Brabandt <cb@256bit.org>
parents: 13320
diff changeset
430 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
431 endfunc
11529
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
432
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
433 func Test_syntax_hangs()
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
434 if !has('reltime') || !has('float') || !has('syntax')
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
435 return
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
436 endif
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
437
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
438 " 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
439 new
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
440 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
441 let start = reltime()
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
442 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
443 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
444 redraw
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
445 let elapsed = reltimefloat(reltime(start))
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
446 call assert_true(elapsed > 0.1)
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
447 call assert_true(elapsed < 1.0)
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
448
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
449 " 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
450 let start = reltime()
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
451 redraw
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
452 let elapsed = reltimefloat(reltime(start))
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
453 call assert_true(elapsed < 0.1)
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
454
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
455 " 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
456 let start = reltime()
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
457 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
458 redraw
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
459 let elapsed = reltimefloat(reltime(start))
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
460 call assert_true(elapsed > 0.1)
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
461 call assert_true(elapsed < 1.0)
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
462
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
463 set redrawtime&
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
464 bwipe!
998d2cf59caa patch 8.0.0647: syntax highlighting can make cause a freeze
Christian Brabandt <cb@256bit.org>
parents: 11465
diff changeset
465 endfunc
11553
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
466
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
467 func Test_conceal()
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
468 if !has('conceal')
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
469 return
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
470 endif
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
471
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
472 new
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
473 call setline(1, ['', '123456'])
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
474 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
475 syn match test45 "45" conceal
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
476
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
477 set conceallevel=0
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
478 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
479 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
480
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
481 set conceallevel=1
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
482 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
483 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
484
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
485 set conceallevel=1
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
486 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
487 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
488 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
489
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
490 set conceallevel=2
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
491 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
492 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
493
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
494 set conceallevel=3
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
495 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
496 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
497
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
498 syn clear
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
499 set conceallevel&
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
500 bw!
cbceef33af7a patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents: 11529
diff changeset
501 endfunc
11599
3cf157856dc8 patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents: 11579
diff changeset
502
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
503 func Test_synstack_synIDtrans()
11599
3cf157856dc8 patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents: 11579
diff changeset
504 new
3cf157856dc8 patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents: 11579
diff changeset
505 setfiletype c
3cf157856dc8 patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents: 11579
diff changeset
506 syntax on
3cf157856dc8 patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents: 11579
diff changeset
507 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
508
3cf157856dc8 patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents: 11579
diff changeset
509 call assert_equal([], synstack(1, 1))
3cf157856dc8 patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents: 11579
diff changeset
510
3cf157856dc8 patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents: 11579
diff changeset
511 norm f/
3cf157856dc8 patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents: 11579
diff changeset
512 call assert_equal(['cComment', 'cCommentStart'], 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
513 call assert_equal(['Comment', '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
514
3cf157856dc8 patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents: 11579
diff changeset
515 norm fA
3cf157856dc8 patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents: 11579
diff changeset
516 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
517 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
518
3cf157856dc8 patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents: 11579
diff changeset
519 norm fT
3cf157856dc8 patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents: 11579
diff changeset
520 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
521 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
522
3cf157856dc8 patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents: 11579
diff changeset
523 syn clear
3cf157856dc8 patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents: 11579
diff changeset
524 bw!
3cf157856dc8 patch 8.0.0682: no test for synIDtrans()
Christian Brabandt <cb@256bit.org>
parents: 11579
diff changeset
525 endfunc
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
526
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
527 " 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
528 func Test_syntax_c()
13329
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13322
diff changeset
529 if !CanRunVimInTerminal()
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
530 return
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
531 endif
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
532 call writefile([
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
533 \ '/* comment line at the top */',
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
534 \ ' int',
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
535 \ 'main(int argc, char **argv)// another comment',
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
536 \ '{',
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
537 \ '#if 0',
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
538 \ ' int not_used;',
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
539 \ '#else',
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
540 \ ' int used;',
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
541 \ '#endif',
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
542 \ ' 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
543 \ ' return 0x0ff;',
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
544 \ '}',
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
545 \ ' static void',
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
546 \ 'myFunction(const double count, struct nothing, long there) {',
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
547 \ ' // 123: nothing to read here',
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
548 \ ' for (int i = 0; i < count; ++i) {',
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
549 \ ' break;',
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
550 \ ' }',
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
551 \ '}',
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
552 \ ], 'Xtest.c')
13320
a90063ec1cd6 patch 8.0.1534: C syntax test fails when using gvim
Christian Brabandt <cb@256bit.org>
parents: 13306
diff changeset
553
a90063ec1cd6 patch 8.0.1534: C syntax test fails when using gvim
Christian Brabandt <cb@256bit.org>
parents: 13306
diff changeset
554 " 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
555 " 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
556 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
557
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
558 let buf = RunVimInTerminal('Xtest.c', {})
13329
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13322
diff changeset
559 call VerifyScreenDump(buf, 'Test_syntax_c_01', {})
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
560 call StopVimInTerminal(buf)
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
561
13320
a90063ec1cd6 patch 8.0.1534: C syntax test fails when using gvim
Christian Brabandt <cb@256bit.org>
parents: 13306
diff changeset
562 let $COLORFGBG = ''
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 11599
diff changeset
563 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
564 endfun
14161
7cac4646c552 patch 8.1.0098: segfault when pattern with z() is very slow
Christian Brabandt <cb@256bit.org>
parents: 13329
diff changeset
565
7cac4646c552 patch 8.1.0098: segfault when pattern with z() is very slow
Christian Brabandt <cb@256bit.org>
parents: 13329
diff changeset
566 " 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
567 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
568 new
7cac4646c552 patch 8.1.0098: segfault when pattern with z() is very slow
Christian Brabandt <cb@256bit.org>
parents: 13329
diff changeset
569 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
570 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
571 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
572 redraw!
7cac4646c552 patch 8.1.0098: segfault when pattern with z() is very slow
Christian Brabandt <cb@256bit.org>
parents: 13329
diff changeset
573 redraw!
7cac4646c552 patch 8.1.0098: segfault when pattern with z() is very slow
Christian Brabandt <cb@256bit.org>
parents: 13329
diff changeset
574 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
575 bwipe!
7cac4646c552 patch 8.1.0098: segfault when pattern with z() is very slow
Christian Brabandt <cb@256bit.org>
parents: 13329
diff changeset
576 endfunc