Mercurial > vim
diff src/testdir/test_syntax.vim @ 13304:013c44d9dc09 v8.0.1526
patch 8.0.1526: no test using a screen dump yet
commit https://github.com/vim/vim/commit/da65058a9c4774dc534c7ae98d24c58b5db669fa
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 20 15:51:40 2018 +0100
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.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 20 Feb 2018 16:00:06 +0100 |
parents | 3cf157856dc8 |
children | 5a85a4b85507 |
line wrap: on
line diff
--- a/src/testdir/test_syntax.vim +++ b/src/testdir/test_syntax.vim @@ -5,6 +5,9 @@ if !has("syntax") endif source view_util.vim +if has('terminal') + source screendump.vim +endif func GetSyntaxItem(pat) let c = '' @@ -497,7 +500,7 @@ func Test_conceal() bw! endfunc -fun Test_synstack_synIDtrans() +func Test_synstack_synIDtrans() new setfiletype c syntax on @@ -520,3 +523,36 @@ fun Test_synstack_synIDtrans() syn clear 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