Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
30022:b8bc697bb6a1 | 30023:87063bfe81cd |
---|---|
1825 | 1825 |
1826 call delete('Xfile.sig') | 1826 call delete('Xfile.sig') |
1827 filetype off | 1827 filetype off |
1828 endfunc | 1828 endfunc |
1829 | 1829 |
1830 " Test dist#ft#FTsil() | |
1831 func Test_sil_file() | |
1832 filetype on | |
1833 | |
1834 split Xfile.sil | |
1835 call assert_equal('sil', &filetype) | |
1836 bwipe! | |
1837 | |
1838 let lines =<< trim END | |
1839 // valid | |
1840 let protoErasedPathA = \ABCProtocol.a | |
1841 | |
1842 // also valid | |
1843 let protoErasedPathA = | |
1844 \ABCProtocol.a | |
1845 END | |
1846 call writefile(lines, 'Xfile.sil') | |
1847 | |
1848 split Xfile.sil | |
1849 call assert_equal('sil', &filetype) | |
1850 bwipe! | |
1851 | |
1852 " SILE | |
1853 | |
1854 call writefile(['% some comment'], 'Xfile.sil') | |
1855 split Xfile.sil | |
1856 call assert_equal('sile', &filetype) | |
1857 bwipe! | |
1858 | |
1859 call writefile(['\begin[papersize=a6]{document}foo\end{document}'], 'Xfile.sil') | |
1860 split Xfile.sil | |
1861 call assert_equal('sile', &filetype) | |
1862 bwipe! | |
1863 | |
1864 call delete('Xfile.sil') | |
1865 filetype off | |
1866 endfunc | |
1867 | |
1830 func Test_inc_file() | 1868 func Test_inc_file() |
1831 filetype on | 1869 filetype on |
1832 | 1870 |
1833 call writefile(['this is the fallback'], 'Xfile.inc') | 1871 call writefile(['this is the fallback'], 'Xfile.inc') |
1834 split Xfile.inc | 1872 split Xfile.inc |