vim-patch:9.0.0349: filetype of *.sil files not well detected (#20050)

Problem:    Filetype of *.sil files not well detected.
Solution:   Inspect the file contents to guess the filetype.
be807d5824
This commit is contained in:
Jonas Strittmatter
2022-09-02 08:16:17 +02:00
committed by GitHub
parent 12fe197cff
commit ce80b8f50d
5 changed files with 75 additions and 5 deletions

View File

@@ -1824,6 +1824,44 @@ func Test_sig_file()
filetype off
endfunc
" Test dist#ft#FTsil()
func Test_sil_file()
filetype on
split Xfile.sil
call assert_equal('sil', &filetype)
bwipe!
let lines =<< trim END
// valid
let protoErasedPathA = \ABCProtocol.a
// also valid
let protoErasedPathA =
\ABCProtocol.a
END
call writefile(lines, 'Xfile.sil')
split Xfile.sil
call assert_equal('sil', &filetype)
bwipe!
" SILE
call writefile(['% some comment'], 'Xfile.sil')
split Xfile.sil
call assert_equal('sile', &filetype)
bwipe!
call writefile(['\begin[papersize=a6]{document}foo\end{document}'], 'Xfile.sil')
split Xfile.sil
call assert_equal('sile', &filetype)
bwipe!
call delete('Xfile.sil')
filetype off
endfunc
func Test_inc_file()
filetype on