on master help sign in
Add syntax highlighting tests for VimL

Adds a syntax highlighting test for VimL with source file based on parts of my own configuration changed to cover as much of syntax as possible. **NOTES:** Last line of source (`syntax enable`) does not get highlighted, since `syntax` keyword is not part of highlighting rules. Related to #1213

commitcc6109a751d9a41707991cc80827534a0459ba26 authorEnsar Sarajčić <es.ensar@gmail.com> dateSun 27 Dec 2020, 09:00 (6 years ago) parent47bb4a9
2 files changed+158
tests/syntax-tests/highlighted/VimL/source.vim+79 tests/syntax-tests/source/VimL/source.vim+79
tests/syntax-tests/highlighted/VimL/source.vimnew file+79
@@ -0,0 +1,79 @@
1+if &compatible
2+ set nocompatible
3+endif
4+
5+if has('win32') || has ('win64')
6+ let $VIMHOME = $HOME . "/vimfiles"
7+elseif v:false && v:true
8+ echo "Can't get here"
9+else
10+ let $VIMHOME = $HOME . "/.vim"
11+endif
12+
13+" show existing tab with 2 spaces width
14+set tabstop=2
15+" when indenting with '>', use 2 spaces width
16+set shiftwidth=2
17+" always set autoindenting on
18+set autoindent
19+
20+autocmd VimEnter * echo "Hello Vim"
21+
22+" Allow :W and :Wq to save too
23+command! Wq :wq
24+command! W :w
25+
26+augroup vimrc
27+ autocmd!
28+ autocmd FileType * echo "New filetype"
29+augroup END
30+
31+function! s:echo(what)
32+ return a:what
33+endfunction
34+
35+function! HelloWorld(name)
36+ let l:function_local = "function_local_var"
37+ let l:parts = split(l:function_local, "_")
38+ let l:greeting = "Hello " . a:name
39+ return s:echo(l:greeting)
40+endfunction
41+
42+function! source#Hello()
43+ return "Hello from namespace"
44+endfunction
45+
46+function! EchoFunc(...)
47+ for s in a:000
48+ echon ' ' . s
49+ endfor
50+endfunction
51+
52+imap <C-h> <C-r>=HelloWorld("World")<CR>
53+
54+command! -nargs=? Echo :call EchoFunc(<args>)
55+
56+let g:global = "global var"
57+let s:script_var = "script var"
58+let w:window_var = "window war"
59+let b:buffer_var = "buffer war"
60+let t:tab_var = "tab war"
61+echo v:false
62+
63+3 + 5
64+
65+echo "Hello" ==# "Hello2"
66+echo "Hello" ==? "Hello2"
67+echo "Hello" == "Hello2"
68+echo "Hello" is "Hello2"
69+echo "Hello" isnot "Hello2"
70+echo "Hello" =~ "Hello2"
71+echo "Hello" !~ "Hello2"
72+
73+let g:dict = {}
74+let g:dict.item = ['l1', 'l2']
75+
76+let g:dict2 = {'dict_item': ['l1', 'l2'], 'di2': 'x'}
77+
78+filetype plugin indent on
79+syntax enable
tests/syntax-tests/source/VimL/source.vimnew file+79
@@ -0,0 +1,79 @@
1+if &compatible
2+ set nocompatible
3+endif
4+
5+if has('win32') || has ('win64')
6+ let $VIMHOME = $HOME . "/vimfiles"
7+elseif v:false && v:true
8+ echo "Can't get here"
9+else
10+ let $VIMHOME = $HOME . "/.vim"
11+endif
12+
13+" show existing tab with 2 spaces width
14+set tabstop=2
15+" when indenting with '>', use 2 spaces width
16+set shiftwidth=2
17+" always set autoindenting on
18+set autoindent
19+
20+autocmd VimEnter * echo "Hello Vim"
21+
22+" Allow :W and :Wq to save too
23+command! Wq :wq
24+command! W :w
25+
26+augroup vimrc
27+ autocmd!
28+ autocmd FileType * echo "New filetype"
29+augroup END
30+
31+function! s:echo(what)
32+ return a:what
33+endfunction
34+
35+function! HelloWorld(name)
36+ let l:function_local = "function_local_var"
37+ let l:parts = split(l:function_local, "_")
38+ let l:greeting = "Hello " . a:name
39+ return s:echo(l:greeting)
40+endfunction
41+
42+function! source#Hello()
43+ return "Hello from namespace"
44+endfunction
45+
46+function! EchoFunc(...)
47+ for s in a:000
48+ echon ' ' . s
49+ endfor
50+endfunction
51+
52+imap <C-h> <C-r>=HelloWorld("World")<CR>
53+
54+command! -nargs=? Echo :call EchoFunc(<args>)
55+
56+let g:global = "global var"
57+let s:script_var = "script var"
58+let w:window_var = "window war"
59+let b:buffer_var = "buffer war"
60+let t:tab_var = "tab war"
61+echo v:false
62+
63+3 + 5
64+
65+echo "Hello" ==# "Hello2"
66+echo "Hello" ==? "Hello2"
67+echo "Hello" == "Hello2"
68+echo "Hello" is "Hello2"
69+echo "Hello" isnot "Hello2"
70+echo "Hello" =~ "Hello2"
71+echo "Hello" !~ "Hello2"
72+
73+let g:dict = {}
74+let g:dict.item = ['l1', 'l2']
75+
76+let g:dict2 = {'dict_item': ['l1', 'l2'], 'di2': 'x'}
77+
78+filetype plugin indent on
79+syntax enable