aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-06-02 14:53:21 -0400
committerJustin M. Keyes <justinkz@gmail.com>2016-06-02 14:53:21 -0400
commit8bf94f8f0d97d1896106931991631fa51dd5869d (patch)
treecbcf847baef7a636aab4c5f120ce1bac624e3812 /src/nvim/testdir
parent1a21a0cc4f89bfab1caeff88859a46c7a816ac70 (diff)
parent17cb95b2225f2f9c19f584fb32dc9d11708eb7f9 (diff)
downloadrneovim-8bf94f8f0d97d1896106931991631fa51dd5869d.tar.gz
rneovim-8bf94f8f0d97d1896106931991631fa51dd5869d.tar.bz2
rneovim-8bf94f8f0d97d1896106931991631fa51dd5869d.zip
Merge pull request #4869 from jamessan/vim-7.4.1142
vim-patch:7.4.1142,7.4.1695
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/Makefile1
-rw-r--r--src/nvim/testdir/test_syntax.vim63
2 files changed, 64 insertions, 0 deletions
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile
index 867cab9fbf..94643bc843 100644
--- a/src/nvim/testdir/Makefile
+++ b/src/nvim/testdir/Makefile
@@ -39,6 +39,7 @@ NEW_TESTS = \
test_cursor_func.res \
test_help_tagjump.res \
test_menu.res \
+ test_syntax.res \
test_timers.res \
test_viml.res \
test_alot.res
diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim
new file mode 100644
index 0000000000..309c0f460b
--- /dev/null
+++ b/src/nvim/testdir/test_syntax.vim
@@ -0,0 +1,63 @@
+" Test for syntax and syntax iskeyword option
+
+func GetSyntaxItem(pat)
+ let c = ''
+ let a = ['a', getreg('a'), getregtype('a')]
+ 0
+ redraw!
+ call search(a:pat, 'W')
+ let synid = synID(line('.'), col('.'), 1)
+ while synid == synID(line('.'), col('.'), 1)
+ norm! v"ay
+ " stop at whitespace
+ if @a =~# '\s'
+ break
+ endif
+ let c .= @a
+ norm! l
+ endw
+ call call('setreg', a)
+ 0
+ return c
+endfunc
+
+func Test_syn_iskeyword()
+ new
+ call setline(1, [
+ \ 'CREATE TABLE FOOBAR(',
+ \ ' DLTD_BY VARCHAR2(100)',
+ \ ');',
+ \ ''])
+
+ syntax on
+ set ft=sql
+ syn match SYN /C\k\+\>/
+ hi link SYN ErrorMsg
+ call assert_equal('DLTD_BY', GetSyntaxItem('DLTD'))
+ /\<D\k\+\>/:norm! ygn
+ call assert_equal('DLTD_BY', @0)
+ redir @c
+ syn iskeyword
+ redir END
+ call assert_equal("\nsyntax iskeyword not set", @c)
+
+ syn iskeyword @,48-57,_,192-255
+ redir @c
+ syn iskeyword
+ redir END
+ call assert_equal("\nsyntax iskeyword @,48-57,_,192-255", @c)
+
+ setlocal isk-=_
+ call assert_equal('DLTD_BY', GetSyntaxItem('DLTD'))
+ /\<D\k\+\>/:norm! ygn
+ let b2=@0
+ call assert_equal('DLTD', @0)
+
+ syn iskeyword clear
+ redir @c
+ syn iskeyword
+ redir END
+ call assert_equal("\nsyntax iskeyword not set", @c)
+
+ quit!
+endfunc