From 6ca4fba97f0d8a498fafd949c9db48bf7a870f48 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 16 Apr 2023 17:44:30 +0800 Subject: [PATCH] test(old): sync test_filetype.vim with upstream (#23127) --- test/old/testdir/test_filetype.vim | 110 ++++++++++------------------- 1 file changed, 39 insertions(+), 71 deletions(-) diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 20c33d4dc4..150cf50c2a 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -14,15 +14,14 @@ endfunc func Test_conf_type() filetype on - call writefile(['# some comment', 'must be conf'], 'Xfile') + call writefile(['# some comment', 'must be conf'], 'Xconffile', 'D') augroup filetypedetect au BufNewFile,BufRead * call assert_equal(0, did_filetype()) augroup END - split Xfile + split Xconffile call assert_equal('conf', &filetype) bwipe! - call delete('Xfile') filetype off endfunc @@ -30,15 +29,14 @@ func Test_other_type() filetype on augroup filetypedetect au BufNewFile,BufRead * call assert_equal(0, did_filetype()) - au BufNewFile,BufRead Xfile setf testfile + au BufNewFile,BufRead Xotherfile setf testfile au BufNewFile,BufRead * call assert_equal(1, did_filetype()) augroup END - call writefile(['# some comment', 'must be conf'], 'Xfile') - split Xfile + call writefile(['# some comment', 'must be conf'], 'Xotherfile', 'D') + split Xotherfile call assert_equal('testfile', &filetype) bwipe! - call delete('Xfile') filetype off endfunc @@ -358,6 +356,7 @@ let s:filename_checks = { \ 'mailcap': ['.mailcap', 'mailcap'], \ 'make': ['file.mk', 'file.mak', 'file.dsp', 'makefile', 'Makefile', 'makefile-file', 'Makefile-file', 'some-makefile', 'some-Makefile'], \ 'mallard': ['file.page'], + "\ 'man': ['file.man'], \ 'manconf': ['/etc/man.conf', 'man.config', 'any/etc/man.conf'], \ 'map': ['file.map'], \ 'maple': ['file.mv', 'file.mpl', 'file.mws'], @@ -815,13 +814,12 @@ func Run_script_detection(test_dict) filetype on for [ft, files] in items(a:test_dict) for file in files - call writefile(file, 'Xtest') + call writefile(file, 'Xtest', 'D') split Xtest call assert_equal(ft, &filetype, 'for text: ' . string(file)) bwipe! endfor endfor - call delete('Xtest') filetype off endfunc @@ -867,7 +865,7 @@ endfunc func Test_bas_file() filetype on - call writefile(['looks like BASIC'], 'Xfile.bas') + call writefile(['looks like BASIC'], 'Xfile.bas', 'D') split Xfile.bas call assert_equal('basic', &filetype) bwipe! @@ -921,7 +919,6 @@ func Test_bas_file() call assert_equal('vb', &filetype) bwipe! - call delete('Xfile.bas') filetype off endfunc @@ -930,7 +927,7 @@ func Test_cfg_file() filetype on " *.cfg defaults to cfg - call writefile(['looks like cfg'], 'cfgfile.cfg') + call writefile(['looks like cfg'], 'cfgfile.cfg', 'D') split cfgfile.cfg call assert_equal('cfg', &filetype) @@ -959,7 +956,7 @@ endfunc func Test_d_file() filetype on - call writefile(['looks like D'], 'Xfile.d') + call writefile(['looks like D'], 'Xfile.d', 'D') split Xfile.d call assert_equal('d', &filetype) bwipe! @@ -991,7 +988,6 @@ func Test_d_file() " clean up filetype off - call delete('Xfile.d') endfunc func Test_dat_file() @@ -1032,7 +1028,7 @@ endfunc func Test_dep3patch_file() filetype on - call assert_true(mkdir('debian/patches', 'p')) + call assert_true(mkdir('debian/patches', 'pR')) " series files are not patches call writefile(['Description: some awesome patch'], 'debian/patches/series') @@ -1065,14 +1061,12 @@ func Test_dep3patch_file() split debian/patches/baz call assert_notequal('dep3patch', &filetype) bwipe! - - call delete('debian', 'rf') endfunc func Test_dsl_file() filetype on - call writefile([' '], 'Xfile.ts') + call writefile([''], 'Xfile.ts', 'D') split Xfile.ts call assert_equal('xml', &filetype) bwipe! @@ -1770,14 +1746,13 @@ func Test_ts_file() call assert_equal('typescript', &filetype) bwipe! - call delete('Xfile.ts') filetype off endfunc func Test_ttl_file() filetype on - call writefile(['@base .'], 'Xfile.ttl') + call writefile(['@base .'], 'Xfile.ttl', 'D') split Xfile.ttl call assert_equal('turtle', &filetype) bwipe! @@ -1787,26 +1762,24 @@ func Test_ttl_file() call assert_equal('teraterm', &filetype) bwipe! - call delete('Xfile.ttl') filetype off endfunc func Test_xpm_file() filetype on - call writefile(['this is XPM2'], 'file.xpm') + call writefile(['this is XPM2'], 'file.xpm', 'D') split file.xpm call assert_equal('xpm2', &filetype) bwipe! - call delete('file.xpm') filetype off endfunc func Test_cls_file() filetype on - call writefile(['looks like Smalltalk'], 'Xfile.cls') + call writefile(['looks like Smalltalk'], 'Xfile.cls', 'D') split Xfile.cls call assert_equal('st', &filetype) bwipe! @@ -1845,14 +1818,13 @@ func Test_cls_file() call assert_equal('vb', &filetype) bwipe! - call delete('Xfile.cls') filetype off endfunc func Test_sig_file() filetype on - call writefile(['this is neither Lambda Prolog nor SML'], 'Xfile.sig') + call writefile(['this is neither Lambda Prolog nor SML'], 'Xfile.sig', 'D') split Xfile.sig call assert_equal('', &filetype) bwipe! @@ -1899,7 +1871,6 @@ func Test_sig_file() call assert_equal('sml', &filetype) bwipe! - call delete('Xfile.sig') filetype off endfunc @@ -1919,7 +1890,7 @@ func Test_sil_file() let protoErasedPathA = \ABCProtocol.a END - call writefile(lines, 'Xfile.sil') + call writefile(lines, 'Xfile.sil', 'D') split Xfile.sil call assert_equal('sil', &filetype) @@ -1937,14 +1908,13 @@ func Test_sil_file() call assert_equal('sile', &filetype) bwipe! - call delete('Xfile.sil') filetype off endfunc func Test_inc_file() filetype on - call writefile(['this is the fallback'], 'Xfile.inc') + call writefile(['this is the fallback'], 'Xfile.inc', 'D') split Xfile.inc call assert_equal('pov', &filetype) bwipe! @@ -2011,19 +1981,18 @@ func Test_inc_file() bwipe! " asm - call writefile(['asmsyntax=bar'], 'Xfile.inc') + call writefile(['asmsyntax=foo'], 'Xfile.inc') split Xfile.inc - call assert_equal('bar', &filetype) + call assert_equal('foo', &filetype) bwipe! - call delete('Xfile.inc') filetype off endfunc func Test_lsl_file() filetype on - call writefile(['looks like Linden Scripting Language'], 'Xfile.lsl') + call writefile(['looks like Linden Scripting Language'], 'Xfile.lsl', 'D') split Xfile.lsl call assert_equal('lsl', &filetype) bwipe! @@ -2048,7 +2017,6 @@ func Test_lsl_file() call assert_equal('larch', &filetype) bwipe! - call delete('Xfile.lsl') filetype off endfunc