# HG changeset patch # User Bram Moolenaar # Date 1672498804 -3600 # Node ID 60fe50450ee564d62dae9cf83b9d06be20b024db # Parent f005bcdf9a62cdf951a106b1661313d8553c14a4 patch 9.0.1120: tex filetype detection not sufficiently tested Commit: https://github.com/vim/vim/commit/c55e8f2c6f5cafe11494df3e2d28ff3d03b92c71 Author: smjonas Date: Sat Dec 31 14:46:53 2022 +0000 patch 9.0.1120: tex filetype detection not sufficiently tested Problem: Tex filetype detection not sufficiently tested. Solution: Add more test cases for "tex" detection. (Jonas Strittmatter, closes #11765) diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -1653,17 +1653,45 @@ endfunc func Test_tex_file() filetype on - " only tests one case, should do more - let lines =<< trim END - % This is a sentence. + call writefile(['%& pdflatex'], 'Xfile.tex') + split Xfile.tex + call assert_equal('tex', &filetype) + bwipe - This is a sentence. - END - call writefile(lines, "Xfile.tex") + call writefile(['\newcommand{\test}{some text}'], 'Xfile.tex') + split Xfile.tex + call assert_equal('tex', &filetype) + bwipe + + " tex_flavor is unset + call writefile(['%& plain'], 'Xfile.tex') split Xfile.tex call assert_equal('plaintex', &filetype) bwipe + let g:tex_flavor = 'plain' + call writefile(['just some text'], 'Xfile.tex') + split Xfile.tex + call assert_equal('plaintex', &filetype) + bwipe + + let lines =<< trim END + % This is a comment. + + \usemodule[translate] + END + call writefile(lines, 'Xfile.tex') + split Xfile.tex + call assert_equal('context', &filetype) + bwipe + + let g:tex_flavor = 'context' + call writefile(['just some text'], 'Xfile.tex') + split Xfile.tex + call assert_equal('context', &filetype) + bwipe + unlet g:tex_flavor + call delete('Xfile.tex') filetype off endfunc diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1120, +/**/ 1119, /**/ 1118,