comparison src/testdir/test_filetype.vim @ 29338:f4f531986753 v9.0.0012

patch 9.0.0012: signature files not detected properly Commit: https://github.com/vim/vim/commit/cdbfc6dbab1d63aa56af316d6b13e37939e7f7a8 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 30 16:25:21 2022 +0100 patch 9.0.0012: signature files not detected properly Problem: Signature files not detected properly. Solution: Add a function to better detect signature files. (Doug Kearns)
author Bram Moolenaar <Bram@vim.org>
date Thu, 30 Jun 2022 17:30:06 +0200
parents 1f1d99bba06c
children 7f5db9decf32
comparison
equal deleted inserted replaced
29337:2987bdf4f6cc 29338:f4f531986753
311 \ 'logindefs': ['/etc/login.defs', 'any/etc/login.defs'], 311 \ 'logindefs': ['/etc/login.defs', 'any/etc/login.defs'],
312 \ 'logtalk': ['file.lgt'], 312 \ 'logtalk': ['file.lgt'],
313 \ 'lotos': ['file.lot', 'file.lotos'], 313 \ 'lotos': ['file.lot', 'file.lotos'],
314 \ 'lout': ['file.lou', 'file.lout'], 314 \ 'lout': ['file.lou', 'file.lout'],
315 \ 'lpc': ['file.lpc', 'file.ulpc'], 315 \ 'lpc': ['file.lpc', 'file.ulpc'],
316 \ 'lprolog': ['file.sig'],
317 \ 'lsl': ['file.lsl'], 316 \ 'lsl': ['file.lsl'],
318 \ 'lss': ['file.lss'], 317 \ 'lss': ['file.lss'],
319 \ 'lua': ['file.lua', 'file.rockspec', 'file.nse'], 318 \ 'lua': ['file.lua', 'file.rockspec', 'file.nse'],
320 \ 'lynx': ['lynx.cfg'], 319 \ 'lynx': ['lynx.cfg'],
321 \ 'm3build': ['m3makefile', 'm3overrides'], 320 \ 'm3build': ['m3makefile', 'm3overrides'],
1758 1757
1759 call delete('Xfile.cls') 1758 call delete('Xfile.cls')
1760 filetype off 1759 filetype off
1761 endfunc 1760 endfunc
1762 1761
1762 func Test_sig_file()
1763 filetype on
1764
1765 call writefile(['this is neither Lambda Prolog nor SML'], 'Xfile.sig')
1766 split Xfile.sig
1767 call assert_equal('', &filetype)
1768 bwipe!
1769
1770 " Test dist#ft#FTsig()
1771
1772 let g:filetype_sig = 'sml'
1773 split Xfile.sig
1774 call assert_equal('sml', &filetype)
1775 bwipe!
1776 unlet g:filetype_sig
1777
1778 " Lambda Prolog
1779
1780 call writefile(['sig foo.'], 'Xfile.sig')
1781 split Xfile.sig
1782 call assert_equal('lprolog', &filetype)
1783 bwipe!
1784
1785 call writefile(['/* ... */'], 'Xfile.sig')
1786 split Xfile.sig
1787 call assert_equal('lprolog', &filetype)
1788 bwipe!
1789
1790 call writefile(['% ...'], 'Xfile.sig')
1791 split Xfile.sig
1792 call assert_equal('lprolog', &filetype)
1793 bwipe!
1794
1795 " SML signature file
1796
1797 call writefile(['signature FOO ='], 'Xfile.sig')
1798 split Xfile.sig
1799 call assert_equal('sml', &filetype)
1800 bwipe!
1801
1802 call writefile(['structure FOO ='], 'Xfile.sig')
1803 split Xfile.sig
1804 call assert_equal('sml', &filetype)
1805 bwipe!
1806
1807 call writefile(['(* ... *)'], 'Xfile.sig')
1808 split Xfile.sig
1809 call assert_equal('sml', &filetype)
1810 bwipe!
1811
1812 call delete('Xfile.sig')
1813 filetype off
1814 endfunc
1815
1816
1763 " vim: shiftwidth=2 sts=2 expandtab 1817 " vim: shiftwidth=2 sts=2 expandtab