diff src/testdir/test_filetype.vim @ 27070:b353bd9faec8 v8.2.4064

patch 8.2.4064: foam files are not detected Commit: https://github.com/vim/vim/commit/2284f6cca384e0ccc352bfec7277dc26386cac3d Author: Elwardi <elwardifadeli@gmail.com> Date: Tue Jan 11 18:14:23 2022 +0000 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 #9501)
author Bram Moolenaar <Bram@vim.org>
date Tue, 11 Jan 2022 19:15:04 +0100
parents 499b9122b9ff
children d539c144aeb4
line wrap: on
line diff
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -1121,4 +1121,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