comparison src/testdir/test_syntax.vim @ 11599:3cf157856dc8 v8.0.0682

patch 8.0.0682: no test for synIDtrans() commit https://github.com/vim/vim/commit/0b2eef24bcbe2c85c90bbde914a1782cbedc5c72 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 27 15:43:49 2017 +0200 patch 8.0.0682: no test for synIDtrans() Problem: No test for synIDtrans(). Solution: Add a test. (Dominique Pelle, closes https://github.com/vim/vim/issues/1796)
author Christian Brabandt <cb@256bit.org>
date Tue, 27 Jun 2017 15:45:04 +0200
parents 52e3a77c097b
children 013c44d9dc09
comparison
equal deleted inserted replaced
11598:b6949d46de6b 11599:3cf157856dc8
416 hi Normal ctermbg=12 416 hi Normal ctermbg=12
417 call assert_equal('light', &bg) 417 call assert_equal('light', &bg)
418 hi Normal ctermbg=15 418 hi Normal ctermbg=15
419 call assert_equal('light', &bg) 419 call assert_equal('light', &bg)
420 420
421 " manually-set &bg takes precendence over auto-detection 421 " manually-set &bg takes precedence over auto-detection
422 set bg=light 422 set bg=light
423 hi Normal ctermbg=4 423 hi Normal ctermbg=4
424 call assert_equal('light', &bg) 424 call assert_equal('light', &bg)
425 set bg=dark 425 set bg=dark
426 hi Normal ctermbg=12 426 hi Normal ctermbg=12
459 459
460 set redrawtime& 460 set redrawtime&
461 bwipe! 461 bwipe!
462 endfunc 462 endfunc
463 463
464
465 func Test_conceal() 464 func Test_conceal()
466 if !has('conceal') 465 if !has('conceal')
467 return 466 return
468 endif 467 endif
469 468
495 494
496 syn clear 495 syn clear
497 set conceallevel& 496 set conceallevel&
498 bw! 497 bw!
499 endfunc 498 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