mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.0.0131
Problem: Not enough test coverage for syntax commands. Solution: Add more tests. (Dominique Pelle)
This commit is contained in:
@@ -54,7 +54,7 @@ func Test_syn_iskeyword()
|
|||||||
setlocal isk-=_
|
setlocal isk-=_
|
||||||
call assert_equal('DLTD_BY', GetSyntaxItem('DLTD'))
|
call assert_equal('DLTD_BY', GetSyntaxItem('DLTD'))
|
||||||
/\<D\k\+\>/:norm! ygn
|
/\<D\k\+\>/:norm! ygn
|
||||||
let b2=@0
|
let b2 = @0
|
||||||
call assert_equal('DLTD', @0)
|
call assert_equal('DLTD', @0)
|
||||||
|
|
||||||
syn iskeyword clear
|
syn iskeyword clear
|
||||||
@@ -80,3 +80,79 @@ func Test_syntax_after_reload()
|
|||||||
call assert_true(exists('g:gotit'))
|
call assert_true(exists('g:gotit'))
|
||||||
call delete('Xsomefile')
|
call delete('Xsomefile')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_syntime()
|
||||||
|
if !has('profile')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syntax on
|
||||||
|
syntime on
|
||||||
|
let a = execute('syntime report')
|
||||||
|
call assert_equal("\nNo Syntax items defined for this buffer", a)
|
||||||
|
|
||||||
|
view ../memfile_test.c
|
||||||
|
setfiletype cpp
|
||||||
|
redraw
|
||||||
|
let a = execute('syntime report')
|
||||||
|
call assert_match('^ TOTAL *COUNT *MATCH *SLOWEST *AVERAGE *NAME *PATTERN', a)
|
||||||
|
call assert_match(' \d*\.\d* \+[^0]\d* .* cppRawString ', a)
|
||||||
|
call assert_match(' \d*\.\d* \+[^0]\d* .* cppNumber ', a)
|
||||||
|
|
||||||
|
syntime off
|
||||||
|
syntime clear
|
||||||
|
let a = execute('syntime report')
|
||||||
|
call assert_match('^ TOTAL *COUNT *MATCH *SLOWEST *AVERAGE *NAME *PATTERN', a)
|
||||||
|
call assert_notmatch('.* cppRawString *', a)
|
||||||
|
call assert_notmatch('.* cppNumber*', a)
|
||||||
|
call assert_notmatch('[1-9]', a)
|
||||||
|
|
||||||
|
call assert_fails('syntime abc', 'E475')
|
||||||
|
|
||||||
|
syntax clear
|
||||||
|
let a = execute('syntime report')
|
||||||
|
call assert_equal("\nNo Syntax items defined for this buffer", a)
|
||||||
|
|
||||||
|
bd
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_syntax_list()
|
||||||
|
syntax on
|
||||||
|
let a = execute('syntax list')
|
||||||
|
call assert_equal("\nNo Syntax items defined for this buffer", a)
|
||||||
|
|
||||||
|
view ../memfile_test.c
|
||||||
|
setfiletype c
|
||||||
|
|
||||||
|
let a = execute('syntax list')
|
||||||
|
call assert_match('cInclude*', a)
|
||||||
|
call assert_match('cDefine', a)
|
||||||
|
|
||||||
|
let a = execute('syntax list cDefine')
|
||||||
|
call assert_notmatch('cInclude*', a)
|
||||||
|
call assert_match('cDefine', a)
|
||||||
|
call assert_match(' links to Macro$', a)
|
||||||
|
|
||||||
|
call assert_fails('syntax list ABCD', 'E28:')
|
||||||
|
call assert_fails('syntax list @ABCD', 'E392:')
|
||||||
|
|
||||||
|
syntax clear
|
||||||
|
let a = execute('syntax list')
|
||||||
|
call assert_equal("\nNo Syntax items defined for this buffer", a)
|
||||||
|
|
||||||
|
bd
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_syntax_completion()
|
||||||
|
call feedkeys(":syn \<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_equal('"syn case clear cluster conceal enable include iskeyword keyword list manual match off on region reset spell sync', @:)
|
||||||
|
|
||||||
|
call feedkeys(":syn case \<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_equal('"syn case ignore match', @:)
|
||||||
|
|
||||||
|
call feedkeys(":syn list \<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_match('^"syn list Boolean Character ', @:)
|
||||||
|
|
||||||
|
call feedkeys(":syn match \<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_match('^"syn match Boolean Character ', @:)
|
||||||
|
endfunc
|
||||||
|
@@ -764,6 +764,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
131,
|
||||||
/**/
|
/**/
|
||||||
130,
|
130,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user