commit 1b3e6e7594e1dd387207ffe304f2583e61afcb77
parent 4ace9e7e417fe26c8b73ff1d6042e6e4f3df9ebf
Author: Christian Clason <c.clason@uni-graz.at>
Date: Sat, 31 Dec 2022 16:00:01 +0100
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>
Diffstat:
1 file changed, 33 insertions(+), 5 deletions(-)
diff --git 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