Mercurial > vim
diff src/testdir/test_filetype.vim @ 30023:87063bfe81cd v9.0.0349
patch 9.0.0349: filetype of *.sil files not well detected
Commit: https://github.com/vim/vim/commit/be807d582499acbe314ead3891481cba6ca136df
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 1 15:01:25 2022 +0100
patch 9.0.0349: filetype of *.sil files not well detected
Problem: Filetype of *.sil files not well detected.
Solution: Inspect the file contents to guess the filetype.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 01 Sep 2022 16:15:03 +0200 |
parents | 32e35a6d4292 |
children | 13b02c1ea0f7 |
line wrap: on
line diff
--- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -1827,6 +1827,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