diff options
author | Christian Clason <c.clason@uni-graz.at> | 2022-12-31 16:00:01 +0100 |
---|---|---|
committer | Gautam Iyer <gautam@math.cmu.edu> | 2022-12-31 16:12:09 -0500 |
commit | 1b3e6e7594e1dd387207ffe304f2583e61afcb77 (patch) | |
tree | 8928cd0ea1d8f7ba2ec37cb82e6e4b4101bd669f | |
parent | 4ace9e7e417fe26c8b73ff1d6042e6e4f3df9ebf (diff) | |
download | rneovim-1b3e6e7594e1dd387207ffe304f2583e61afcb77.tar.gz rneovim-1b3e6e7594e1dd387207ffe304f2583e61afcb77.tar.bz2 rneovim-1b3e6e7594e1dd387207ffe304f2583e61afcb77.zip |
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 vim/vim#11765)
https://github.com/vim/vim/commit/c55e8f2c6f5cafe11494df3e2d28ff3d03b92c71
Co-authored-by: smjonas <jonas.strittmatter@gmx.de>
-rw-r--r-- | src/nvim/testdir/test_filetype.vim | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index cf155b3cb9..912e702631 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -1676,16 +1676,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 |