diff options
author | Doug Kearns <dougkearns@gmail.com> | 2023-08-20 20:51:12 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-08-20 20:53:47 +0200 |
commit | 19a3bc3addf9b4aa8150a01b11b4249c67d15d3b (patch) | |
tree | 9a6778b92527ccb378862faadb48ca8d033354de /src/testdir | |
parent | 6633611f4280f33934c2ab9b6a3e84c04f054ad3 (diff) |
patch 9.0.1773: cannot distinguish Forth and Fortran *.f filesv9.0.1773
Problem: cannot distinguish Forth and Fortran *.f files
Solution: Add Filetype detection Code
Also add *.4th as a Forth filetype
closes: #12251
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_filetype.vim | 64 |
1 files changed, 62 insertions, 2 deletions
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index 778736b36c..a8ce88cca0 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -246,7 +246,7 @@ def s:GetFilenameChecks(): dict<list<string>> fish: ['file.fish'], focexec: ['file.fex', 'file.focexec'], form: ['file.frm'], - forth: ['file.ft', 'file.fth'], + forth: ['file.ft', 'file.fth', 'file.4th'], fortran: ['file.f', 'file.for', 'file.fortran', 'file.fpp', 'file.ftn', 'file.f77', 'file.f90', 'file.f95', 'file.f03', 'file.f08'], fpcmake: ['file.fpc'], framescript: ['file.fsl'], @@ -1265,6 +1265,54 @@ func Test_ex_file() filetype off endfunc +func Test_f_file() + filetype on + + call writefile(['looks like Fortran'], 'Xfile.f', 'D') + split Xfile.f + call assert_equal('fortran', &filetype) + bwipe! + + let g:filetype_f = 'forth' + split Xfile.f + call assert_equal('forth', &filetype) + bwipe! + unlet g:filetype_f + + " Test dist#ft#FTf() + + " Forth + + call writefile(['( Forth inline comment )'], 'Xfile.f') + split Xfile.f + call assert_equal('forth', &filetype) + bwipe! + + call writefile(['\ Forth line comment'], 'Xfile.f') + split Xfile.f + call assert_equal('forth', &filetype) + bwipe! + + call writefile([': squared ( n -- n^2 )', 'dup * ;'], 'Xfile.f') + split Xfile.f + call assert_equal('forth', &filetype) + bwipe! + + " SwiftForth + + call writefile(['{ ================', 'Header comment', '================ }'], 'Xfile.f') + split Xfile.f + call assert_equal('forth', &filetype) + bwipe! + + call writefile(['OPTIONAL Maybe Descriptive text'], 'Xfile.f') + split Xfile.f + call assert_equal('forth', &filetype) + bwipe! + + filetype off +endfunc + func Test_foam_file() filetype on call assert_true(mkdir('0', 'pR')) @@ -1355,7 +1403,7 @@ func Test_fs_file() " Test dist#ft#FTfs() - " Forth (Gforth) + " Forth call writefile(['( Forth inline comment )'], 'Xfile.fs') split Xfile.fs @@ -1372,6 +1420,18 @@ func Test_fs_file() call assert_equal('forth', &filetype) bwipe! + " SwiftForth + + call writefile(['{ ================', 'Header comment', '================ }'], 'Xfile.fs') + split Xfile.fs + call assert_equal('forth', &filetype) + bwipe! + + call writefile(['OPTIONAL Maybe Descriptive text'], 'Xfile.fs') + split Xfile.fs + call assert_equal('forth', &filetype) + bwipe! + filetype off endfunc |