aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2022-01-11 21:02:58 +0100
committerGitHub <noreply@github.com>2022-01-11 21:02:58 +0100
commit70fe3ce004f1c17328257349da5528757fdcd354 (patch)
tree06c62d6fe6629d527d34c84541d9ff89be0bdaad /src
parent074b033e7e10baf3f4401a1652c1de197f5b5c4e (diff)
downloadrneovim-70fe3ce004f1c17328257349da5528757fdcd354.tar.gz
rneovim-70fe3ce004f1c17328257349da5528757fdcd354.tar.bz2
rneovim-70fe3ce004f1c17328257349da5528757fdcd354.zip
vim-patch:8.2.4064: foam files are not detected (#17041)
* vim-patch:8.2.4064: foam files are not detected Problem: Foam files are not detected. Solution: Detect the foam filetype by the path and file contents. (Mohammed Elwardi Fadeli, closes vim/vim#9501) https://github.com/vim/vim/commit/2284f6cca384e0ccc352bfec7277dc26386cac3d * Port foam ft detection to filetype.lua Co-authored-by: Gregory Anders <greg@gpanders.com>
Diffstat (limited to 'src')
-rw-r--r--src/nvim/testdir/test_filetype.vim50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim
index 45a10cc193..6e92baa939 100644
--- a/src/nvim/testdir/test_filetype.vim
+++ b/src/nvim/testdir/test_filetype.vim
@@ -1096,4 +1096,54 @@ func Test_git_file()
filetype off
endfunc
+func Test_foam_file()
+ filetype on
+ call assert_true(mkdir('0', 'p'))
+ call assert_true(mkdir('0.orig', 'p'))
+
+ call writefile(['FoamFile {', ' object something;'], 'Xfile1Dict')
+ split Xfile1Dict
+ call assert_equal('foam', &filetype)
+ bwipe!
+
+ call writefile(['FoamFile {', ' object something;'], 'Xfile1Dict.something')
+ split Xfile1Dict.something
+ call assert_equal('foam', &filetype)
+ bwipe!
+
+ call writefile(['FoamFile {', ' object something;'], 'XfileProperties')
+ split XfileProperties
+ call assert_equal('foam', &filetype)
+ bwipe!
+
+ call writefile(['FoamFile {', ' object something;'], 'XfileProperties.something')
+ split XfileProperties.something
+ call assert_equal('foam', &filetype)
+ bwipe!
+
+ call writefile(['FoamFile {', ' object something;'], 'XfileProperties')
+ split XfileProperties
+ call assert_equal('foam', &filetype)
+ bwipe!
+
+ call writefile(['FoamFile {', ' object something;'], 'XfileProperties.something')
+ split XfileProperties.something
+ call assert_equal('foam', &filetype)
+ bwipe!
+
+ call writefile(['FoamFile {', ' object something;'], '0/Xfile')
+ split 0/Xfile
+ call assert_equal('foam', &filetype)
+ bwipe!
+
+ call writefile(['FoamFile {', ' object something;'], '0.orig/Xfile')
+ split 0.orig/Xfile
+ call assert_equal('foam', &filetype)
+ bwipe!
+
+ call delete('0', 'rf')
+ call delete('0.orig', 'rf')
+ filetype off
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab