aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_syntax.vim
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-08-12 15:33:22 +0200
committerDaniel Hahler <git@thequod.de>2019-08-13 22:15:54 +0200
commit4e6c59643100cf775ff65b7da67e23620ff247f8 (patch)
tree3703b6417a9cfe6b5f40a2d4878580a96566928a /src/nvim/testdir/test_syntax.vim
parent947bd293c98eda680c0e89b2d453b91eeda54272 (diff)
downloadrneovim-4e6c59643100cf775ff65b7da67e23620ff247f8.tar.gz
rneovim-4e6c59643100cf775ff65b7da67e23620ff247f8.tar.bz2
rneovim-4e6c59643100cf775ff65b7da67e23620ff247f8.zip
vim-patch:8.0.1179: Test_popup_and_window_resize() does not always pass
Problem: Test_popup_and_window_resize() does not always pass. Solution: Do not use $VIMPROG, pass the Vim executable in the vimcmd file. (Ozaki Kiichi, closes vim/vim#2186) https://github.com/vim/vim/commit/631820536e4084e01bf990f9314ec385b60b21d7 vim-patch:8.0.1526: no test using a screen dump yet Problem: No test using a screen dump yet. Solution: Add a test for C syntax highlighting. Add helper functions. https://github.com/vim/vim/commit/da65058a9c4774dc534c7ae98d24c58b5db669fa NOTE: uses modified `GetVimProg()` (which is used with skipped tests only (mostly because of `!has('terminal')`)). Vim uses a 'vimcmd' file, while Nvim uses `$NVIM_TEST_ARGX` environment variables. Ref: https://github.com/vim/vim/pull/4806
Diffstat (limited to 'src/nvim/testdir/test_syntax.vim')
-rw-r--r--src/nvim/testdir/test_syntax.vim35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim
index a3de879b2a..f75c295a1e 100644
--- a/src/nvim/testdir/test_syntax.vim
+++ b/src/nvim/testdir/test_syntax.vim
@@ -470,7 +470,7 @@ func Test_bg_detection()
hi Normal ctermbg=NONE
endfunc
-fun Test_synstack_synIDtrans()
+func Test_synstack_synIDtrans()
new
setfiletype c
syntax on
@@ -494,6 +494,39 @@ fun Test_synstack_synIDtrans()
bw!
endfunc
+" Check highlighting for a small piece of C code with a screen dump.
+func Test_syntax_c()
+ if !has('terminal')
+ return
+ endif
+ call writefile([
+ \ '/* comment line at the top */',
+ \ ' int',
+ \ 'main(int argc, char **argv)// another comment',
+ \ '{',
+ \ '#if 0',
+ \ ' int not_used;',
+ \ '#else',
+ \ ' int used;',
+ \ '#endif',
+ \ ' printf("Just an example piece of C code\n");',
+ \ ' return 0x0ff;',
+ \ '}',
+ \ ' static void',
+ \ 'myFunction(const double count, struct nothing, long there) {',
+ \ ' // 123: nothing to read here',
+ \ ' for (int i = 0; i < count; ++i) {',
+ \ ' break;',
+ \ ' }',
+ \ '}',
+ \ ], 'Xtest.c')
+ let buf = RunVimInTerminal('Xtest.c', {})
+ call VerifyScreenDump(buf, 'Test_syntax_c_01')
+ call StopVimInTerminal(buf)
+
+ call delete('Xtest.c')
+endfun
+
" Using \z() in a region with NFA failing should not crash.
func Test_syn_wrong_z_one()
new