forked from aniani/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)
This commit is contained in:
@@ -1653,17 +1653,45 @@ endfunc
|
|||||||
func Test_tex_file()
|
func Test_tex_file()
|
||||||
filetype on
|
filetype on
|
||||||
|
|
||||||
" only tests one case, should do more
|
call writefile(['%& pdflatex'], 'Xfile.tex')
|
||||||
let lines =<< trim END
|
split Xfile.tex
|
||||||
% This is a sentence.
|
call assert_equal('tex', &filetype)
|
||||||
|
bwipe
|
||||||
|
|
||||||
This is a sentence.
|
call writefile(['\newcommand{\test}{some text}'], 'Xfile.tex')
|
||||||
END
|
split Xfile.tex
|
||||||
call writefile(lines, "Xfile.tex")
|
call assert_equal('tex', &filetype)
|
||||||
|
bwipe
|
||||||
|
|
||||||
|
" tex_flavor is unset
|
||||||
|
call writefile(['%& plain'], 'Xfile.tex')
|
||||||
split Xfile.tex
|
split Xfile.tex
|
||||||
call assert_equal('plaintex', &filetype)
|
call assert_equal('plaintex', &filetype)
|
||||||
bwipe
|
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')
|
call delete('Xfile.tex')
|
||||||
filetype off
|
filetype off
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -695,6 +695,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1120,
|
||||||
/**/
|
/**/
|
||||||
1119,
|
1119,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user