diff options
author | Christian Clason <christian.clason@uni-due.de> | 2021-09-10 14:01:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-10 14:01:13 +0200 |
commit | aab3583e74fa3fd295bd367113be60965c748205 (patch) | |
tree | 88b33978cb29ca7ca1b4b5c45208cd32b974115a /src | |
parent | 185ed18e6cc9113ef257e5491ada657a769a9d04 (diff) | |
download | rneovim-aab3583e74fa3fd295bd367113be60965c748205.tar.gz rneovim-aab3583e74fa3fd295bd367113be60965c748205.tar.bz2 rneovim-aab3583e74fa3fd295bd367113be60965c748205.zip |
vim-patch:8.2.3399: Octave files are not recognized (#15622)
Problem: Octave files are not recognized.
Solution: Detect Octave files. (Doug Kearns)
https://github.com/vim/vim/commit/deba5eb195d6ac70171d4973091fa884809fa3fa
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/testdir/test_filetype.vim | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index 4d29d18330..5326d3460f 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -295,6 +295,7 @@ let s:filename_checks = { \ 'lss': ['file.lss'], \ 'lua': ['file.lua', 'file.rockspec', 'file.nse'], \ 'lynx': ['lynx.cfg'], + \ 'matlab': ['file.m'], \ 'm3build': ['m3makefile', 'm3overrides'], \ 'm3quake': ['file.quake', 'cm3.cfg'], \ 'm4': ['file.at'], @@ -350,6 +351,7 @@ let s:filename_checks = { \ 'obj': ['file.obj'], \ 'ocaml': ['file.ml', 'file.mli', 'file.mll', 'file.mly', '.ocamlinit', 'file.mlt', 'file.mlp', 'file.mlip', 'file.mli.cppo', 'file.ml.cppo'], \ 'occam': ['file.occ'], + \ 'octave': ['octaverc', '.octaverc', 'octave.conf'], \ 'omnimark': ['file.xom', 'file.xin'], \ 'opam': ['opam', 'file.opam', 'file.opam.template'], \ 'openroad': ['file.or'], @@ -825,4 +827,96 @@ func Test_dsl_file() filetype off endfunc +func Test_m_file() + filetype on + + call writefile(['looks like Matlab'], 'Xfile.m') + split Xfile.m + call assert_equal('matlab', &filetype) + bwipe! + + let g:filetype_m = 'octave' + split Xfile.m + call assert_equal('octave', &filetype) + bwipe! + unlet g:filetype_m + + " Test dist#ft#FTm() + + " Objective-C + + call writefile(['// Objective-C line comment'], 'Xfile.m') + split Xfile.m + call assert_equal('objc', &filetype) + bwipe! + + call writefile(['/* Objective-C block comment */'], 'Xfile.m') + split Xfile.m + call assert_equal('objc', &filetype) + bwipe! + + call writefile(['#import "test.m"'], 'Xfile.m') + split Xfile.m + call assert_equal('objc', &filetype) + bwipe! + + " Octave + + call writefile(['# Octave line comment'], 'Xfile.m') + split Xfile.m + call assert_equal('octave', &filetype) + bwipe! + + call writefile(['#{', 'Octave block comment', '#}'], 'Xfile.m') + split Xfile.m + call assert_equal('octave', &filetype) + bwipe! + + call writefile(['%{', 'Octave block comment', '%}'], 'Xfile.m') + split Xfile.m + call assert_equal('octave', &filetype) + bwipe! + + call writefile(['%!test "Octave test"'], 'Xfile.m') + split Xfile.m + call assert_equal('octave', &filetype) + bwipe! + + call writefile(['unwind_protect'], 'Xfile.m') + split Xfile.m + call assert_equal('octave', &filetype) + bwipe! + + call writefile(['function test(); 42; endfunction'], 'Xfile.m') + split Xfile.m + call assert_equal('octave', &filetype) + bwipe! + + " Mathematica + + call writefile(['(* Mathematica comment'], 'Xfile.m') + split Xfile.m + call assert_equal('mma', &filetype) + bwipe! + + " Murphi + + call writefile(['-- Murphi comment'], 'Xfile.m') + split Xfile.m + call assert_equal('murphi', &filetype) + bwipe! + + call writefile(['/* Murphi block comment */', 'Type'], 'Xfile.m') + split Xfile.m + call assert_equal('murphi', &filetype) + bwipe! + + call writefile(['Type'], 'Xfile.m') + split Xfile.m + call assert_equal('murphi', &filetype) + bwipe! + + call delete('Xfile.m') + filetype off +endfunc " vim: shiftwidth=2 sts=2 expandtab |