1
0
forked from aniani/vim

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)
This commit is contained in:
Bram Moolenaar
2022-06-30 16:25:21 +01:00
parent d25f003342
commit cdbfc6dbab
5 changed files with 82 additions and 4 deletions

View File

@@ -313,7 +313,6 @@ let s:filename_checks = {
\ 'lotos': ['file.lot', 'file.lotos'],
\ 'lout': ['file.lou', 'file.lout'],
\ 'lpc': ['file.lpc', 'file.ulpc'],
\ 'lprolog': ['file.sig'],
\ 'lsl': ['file.lsl'],
\ 'lss': ['file.lss'],
\ 'lua': ['file.lua', 'file.rockspec', 'file.nse'],
@@ -1760,4 +1759,59 @@ func Test_cls_file()
filetype off
endfunc
func Test_sig_file()
filetype on
call writefile(['this is neither Lambda Prolog nor SML'], 'Xfile.sig')
split Xfile.sig
call assert_equal('', &filetype)
bwipe!
" Test dist#ft#FTsig()
let g:filetype_sig = 'sml'
split Xfile.sig
call assert_equal('sml', &filetype)
bwipe!
unlet g:filetype_sig
" Lambda Prolog
call writefile(['sig foo.'], 'Xfile.sig')
split Xfile.sig
call assert_equal('lprolog', &filetype)
bwipe!
call writefile(['/* ... */'], 'Xfile.sig')
split Xfile.sig
call assert_equal('lprolog', &filetype)
bwipe!
call writefile(['% ...'], 'Xfile.sig')
split Xfile.sig
call assert_equal('lprolog', &filetype)
bwipe!
" SML signature file
call writefile(['signature FOO ='], 'Xfile.sig')
split Xfile.sig
call assert_equal('sml', &filetype)
bwipe!
call writefile(['structure FOO ='], 'Xfile.sig')
split Xfile.sig
call assert_equal('sml', &filetype)
bwipe!
call writefile(['(* ... *)'], 'Xfile.sig')
split Xfile.sig
call assert_equal('sml', &filetype)
bwipe!
call delete('Xfile.sig')
filetype off
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -735,6 +735,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
12,
/**/
11,
/**/