diff options
author | Christian Clason <c.clason@uni-graz.at> | 2021-12-18 17:22:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-18 17:22:09 +0100 |
commit | ff1b0f632a8d3aed0ba861057e7bd8ade4540277 (patch) | |
tree | d57073bfe906ab82e5df55a091b9d565f42b0de3 /src | |
parent | 34d88edaec33bc75a60618fd62e570aa235c03ea (diff) | |
download | rneovim-ff1b0f632a8d3aed0ba861057e7bd8ade4540277.tar.gz rneovim-ff1b0f632a8d3aed0ba861057e7bd8ade4540277.tar.bz2 rneovim-ff1b0f632a8d3aed0ba861057e7bd8ade4540277.zip |
vim-patch:8.2.3843: dep3patch files are not recognized (#16700)
Problem: Dep3patch files are not recognized.
Solution: Recognize dep3patch files by their location and content. (James
McCoy, closes vim/vim#9367)
https://github.com/vim/vim/commit/647ab4cede4dbf412d24748f8e0a64d1cb9239f4
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/testdir/test_filetype.vim | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index 7ed9c68c96..dbe0cd8388 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -1004,4 +1004,44 @@ func Test_fs_file() filetype off endfunc +func Test_dep3patch_file() + filetype on + + call assert_true(mkdir('debian/patches', 'p')) + + " series files are not patches + call writefile(['Description: some awesome patch'], 'debian/patches/series') + split debian/patches/series + call assert_notequal('dep3patch', &filetype) + bwipe! + + " diff/patch files without the right headers should still show up as ft=diff + call writefile([], 'debian/patches/foo.diff') + split debian/patches/foo.diff + call assert_equal('diff', &filetype) + bwipe! + + " Files with the right headers are detected as dep3patch, even if they don't + " have a diff/patch extension + call writefile(['Subject: dep3patches'], 'debian/patches/bar') + split debian/patches/bar + call assert_equal('dep3patch', &filetype) + bwipe! + + " Files in sub-directories are detected + call assert_true(mkdir('debian/patches/s390x', 'p')) + call writefile(['Subject: dep3patches'], 'debian/patches/s390x/bar') + split debian/patches/s390x/bar + call assert_equal('dep3patch', &filetype) + bwipe! + + " The detection stops when seeing the "header end" marker + call writefile(['---', 'Origin: the cloud'], 'debian/patches/baz') + split debian/patches/baz + call assert_notequal('dep3patch', &filetype) + bwipe! + + call delete('debian/patches', 'rf') +endfunc + " vim: shiftwidth=2 sts=2 expandtab |