From: smjonas Date: Sat, 31 Dec 2022 14:46:53 +0000 (+0000) Subject: patch 9.0.1120: tex filetype detection not sufficiently tested X-Git-Tag: v9.0.1120 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c55e8f2c6f5cafe11494df3e2d28ff3d03b92c71;p=vim 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 index 4556eb1d1..77e68c7ea 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -1653,16 +1653,44 @@ endfunc func Test_tex_file() filetype on - " only tests one case, should do more + call writefile(['%& pdflatex'], 'Xfile.tex') + split Xfile.tex + call assert_equal('tex', &filetype) + bwipe + + 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 sentence. + % This is a comment. - This is a sentence. + \usemodule[translate] END - call writefile(lines, "Xfile.tex") + call writefile(lines, 'Xfile.tex') split Xfile.tex - call assert_equal('plaintex', &filetype) + 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 diff --git a/src/version.c b/src/version.c index 92c70ea99..230db82be 100644 --- a/src/version.c +++ b/src/version.c @@ -695,6 +695,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1120, /**/ 1119, /**/