comparison src/testdir/test_filetype.vim @ 26628:7efd8f561d04 v8.2.3843

patch 8.2.3843: dep3patch files are not recognized Commit: https://github.com/vim/vim/commit/647ab4cede4dbf412d24748f8e0a64d1cb9239f4 Author: James McCoy <jamessan@jamessan.com> Date: Fri Dec 17 20:52:57 2021 +0000 patch 8.2.3843: dep3patch files are not recognized Problem: Dep3patch files are not recognized. Solution: Recognize dep3patch files by their location and content. (James McCoy, closes #9367)
author Bram Moolenaar <Bram@vim.org>
date Fri, 17 Dec 2021 22:00:05 +0100
parents b1f4052d6c51
children 4b8d0a62f78b
comparison
equal deleted inserted replaced
26627:a56abea18a57 26628:7efd8f561d04
1027 1027
1028 call delete('Xfile.fs') 1028 call delete('Xfile.fs')
1029 filetype off 1029 filetype off
1030 endfunc 1030 endfunc
1031 1031
1032 func Test_dep3patch_file()
1033 filetype on
1034
1035 call assert_true(mkdir('debian/patches', 'p'))
1036
1037 " series files are not patches
1038 call writefile(['Description: some awesome patch'], 'debian/patches/series')
1039 split debian/patches/series
1040 call assert_notequal('dep3patch', &filetype)
1041 bwipe!
1042
1043 " diff/patch files without the right headers should still show up as ft=diff
1044 call writefile([], 'debian/patches/foo.diff')
1045 split debian/patches/foo.diff
1046 call assert_equal('diff', &filetype)
1047 bwipe!
1048
1049 " Files with the right headers are detected as dep3patch, even if they don't
1050 " have a diff/patch extension
1051 call writefile(['Subject: dep3patches'], 'debian/patches/bar')
1052 split debian/patches/bar
1053 call assert_equal('dep3patch', &filetype)
1054 bwipe!
1055
1056 " Files in sub-directories are detected
1057 call assert_true(mkdir('debian/patches/s390x', 'p'))
1058 call writefile(['Subject: dep3patches'], 'debian/patches/s390x/bar')
1059 split debian/patches/s390x/bar
1060 call assert_equal('dep3patch', &filetype)
1061 bwipe!
1062
1063 " The detection stops when seeing the "header end" marker
1064 call writefile(['---', 'Origin: the cloud'], 'debian/patches/baz')
1065 split debian/patches/baz
1066 call assert_notequal('dep3patch', &filetype)
1067 bwipe!
1068
1069 call delete('debian/patches', 'rf')
1070 endfunc
1071
1032 " vim: shiftwidth=2 sts=2 expandtab 1072 " vim: shiftwidth=2 sts=2 expandtab