Skip to content

Commit 0b2eef2

Browse files
committed
patch 8.0.0682: no test for synIDtrans()
Problem: No test for synIDtrans(). Solution: Add a test. (Dominique Pelle, closes #1796)
1 parent 18d90b9 commit 0b2eef2

2 files changed

Lines changed: 27 additions & 2 deletions

File tree

src/testdir/test_syntax.vim

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ func Test_bg_detection()
418418
hi Normal ctermbg=15
419419
call assert_equal('light', &bg)
420420

421-
" manually-set &bg takes precendence over auto-detection
421+
" manually-set &bg takes precedence over auto-detection
422422
set bg=light
423423
hi Normal ctermbg=4
424424
call assert_equal('light', &bg)
@@ -461,7 +461,6 @@ func Test_syntax_hangs()
461461
bwipe!
462462
endfunc
463463

464-
465464
func Test_conceal()
466465
if !has('conceal')
467466
return
@@ -497,3 +496,27 @@ func Test_conceal()
497496
set conceallevel&
498497
bw!
499498
endfunc
499+
500+
fun Test_synstack_synIDtrans()
501+
new
502+
setfiletype c
503+
syntax on
504+
call setline(1, ' /* A comment with a TODO */')
505+
506+
call assert_equal([], synstack(1, 1))
507+
508+
norm f/
509+
call assert_equal(['cComment', 'cCommentStart'], map(synstack(line("."), col(".")), 'synIDattr(v:val, "name")'))
510+
call assert_equal(['Comment', 'Comment'], map(synstack(line("."), col(".")), 'synIDattr(synIDtrans(v:val), "name")'))
511+
512+
norm fA
513+
call assert_equal(['cComment'], map(synstack(line("."), col(".")), 'synIDattr(v:val, "name")'))
514+
call assert_equal(['Comment'], map(synstack(line("."), col(".")), 'synIDattr(synIDtrans(v:val), "name")'))
515+
516+
norm fT
517+
call assert_equal(['cComment', 'cTodo'], map(synstack(line("."), col(".")), 'synIDattr(v:val, "name")'))
518+
call assert_equal(['Comment', 'Todo'], map(synstack(line("."), col(".")), 'synIDattr(synIDtrans(v:val), "name")'))
519+
520+
syn clear
521+
bw!
522+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
682,
767769
/**/
768770
681,
769771
/**/

0 commit comments

Comments
 (0)