aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKunMing Xie <qqzz014@gmail.com>2018-09-21 16:27:50 +0800
committerJustin M. Keyes <justinkz@gmail.com>2018-09-21 10:27:50 +0200
commitac4d5d993598199b5509bf15cc33784b01033291 (patch)
tree721bc22fd7c93e7d75a3d2b6efffdd62cd551820 /src
parentecdd2df88ab52ed6e39057e2a8fb9eabfbb90bd5 (diff)
downloadrneovim-ac4d5d993598199b5509bf15cc33784b01033291.tar.gz
rneovim-ac4d5d993598199b5509bf15cc33784b01033291.tar.bz2
rneovim-ac4d5d993598199b5509bf15cc33784b01033291.zip
vim-patch:8.0.0682: no test for synIDtrans() (#8966)
Problem: No test for synIDtrans(). Solution: Add a test. (Dominique Pelle, closes vim/vim#1796) https://github.com/vim/vim/commit/0b2eef24bcbe2c85c90bbde914a1782cbedc5c72
Diffstat (limited to 'src')
-rw-r--r--src/nvim/testdir/test_syntax.vim26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim
index 6d164ac895..e35c0f1105 100644
--- a/src/nvim/testdir/test_syntax.vim
+++ b/src/nvim/testdir/test_syntax.vim
@@ -450,7 +450,7 @@ func Test_bg_detection()
hi Normal ctermbg=15
call assert_equal('light', &bg)
- " manually-set &bg takes precendence over auto-detection
+ " manually-set &bg takes precedence over auto-detection
set bg=light
hi Normal ctermbg=4
call assert_equal('light', &bg)
@@ -458,3 +458,27 @@ func Test_bg_detection()
hi Normal ctermbg=12
call assert_equal('dark', &bg)
endfunc
+
+fun Test_synstack_synIDtrans()
+ new
+ setfiletype c
+ syntax on
+ call setline(1, ' /* A comment with a TODO */')
+
+ call assert_equal([], synstack(1, 1))
+
+ norm f/
+ call assert_equal(['cComment', 'cCommentStart'], map(synstack(line("."), col(".")), 'synIDattr(v:val, "name")'))
+ call assert_equal(['Comment', 'Comment'], map(synstack(line("."), col(".")), 'synIDattr(synIDtrans(v:val), "name")'))
+
+ norm fA
+ call assert_equal(['cComment'], map(synstack(line("."), col(".")), 'synIDattr(v:val, "name")'))
+ call assert_equal(['Comment'], map(synstack(line("."), col(".")), 'synIDattr(synIDtrans(v:val), "name")'))
+
+ norm fT
+ call assert_equal(['cComment', 'cTodo'], map(synstack(line("."), col(".")), 'synIDattr(v:val, "name")'))
+ call assert_equal(['Comment', 'Todo'], map(synstack(line("."), col(".")), 'synIDattr(synIDtrans(v:val), "name")'))
+
+ syn clear
+ bw!
+endfunc