comparison src/testdir/test_filetype.vim @ 27287:9f72ec92d361 v8.2.4172

patch 8.2.4172: filetype detection for BASIC is not optimal Commit: https://github.com/vim/vim/commit/6517f14165cdebf83a07ab9d4aeeb102b4e16e92 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jan 21 14:55:13 2022 +0000 patch 8.2.4172: filetype detection for BASIC is not optimal Problem: Filetype detection for BASIC is not optimal. Solution: Improve BASIC filetype detection. (Doug Kearns)
author Bram Moolenaar <Bram@vim.org>
date Fri, 21 Jan 2022 16:00:05 +0100
parents 0b5ce27d8b68
children 839be955609f
comparison
equal deleted inserted replaced
27286:cfbf237ba257 27287:9f72ec92d361
74 \ 'autoit': ['file.au3'], 74 \ 'autoit': ['file.au3'],
75 \ 'automake': ['GNUmakefile.am', 'makefile.am', 'Makefile.am'], 75 \ 'automake': ['GNUmakefile.am', 'makefile.am', 'Makefile.am'],
76 \ 'ave': ['file.ave'], 76 \ 'ave': ['file.ave'],
77 \ 'awk': ['file.awk', 'file.gawk'], 77 \ 'awk': ['file.awk', 'file.gawk'],
78 \ 'b': ['file.mch', 'file.ref', 'file.imp'], 78 \ 'b': ['file.mch', 'file.ref', 'file.imp'],
79 \ 'basic': ['file.bas', 'file.bi', 'file.bm'],
79 \ 'bzl': ['file.bazel', 'file.bzl', 'WORKSPACE'], 80 \ 'bzl': ['file.bazel', 'file.bzl', 'WORKSPACE'],
80 \ 'bc': ['file.bc'], 81 \ 'bc': ['file.bc'],
81 \ 'bdf': ['file.bdf'], 82 \ 'bdf': ['file.bdf'],
82 \ 'beancount': ['file.beancount'], 83 \ 'beancount': ['file.beancount'],
83 \ 'bib': ['file.bib'], 84 \ 'bib': ['file.bib'],
184 \ 'focexec': ['file.fex', 'file.focexec'], 185 \ 'focexec': ['file.fex', 'file.focexec'],
185 \ 'forth': ['file.ft', 'file.fth'], 186 \ 'forth': ['file.ft', 'file.fth'],
186 \ 'fortran': ['file.f', 'file.for', 'file.fortran', 'file.fpp', 'file.ftn', 'file.f77', 'file.f90', 'file.f95', 'file.f03', 'file.f08'], 187 \ 'fortran': ['file.f', 'file.for', 'file.fortran', 'file.fpp', 'file.ftn', 'file.f77', 'file.f90', 'file.f95', 'file.f03', 'file.f08'],
187 \ 'fpcmake': ['file.fpc'], 188 \ 'fpcmake': ['file.fpc'],
188 \ 'framescript': ['file.fsl'], 189 \ 'framescript': ['file.fsl'],
189 \ 'freebasic': ['file.fb', 'file.bi'], 190 \ 'freebasic': ['file.fb'],
190 \ 'fsharp': ['file.fs', 'file.fsi', 'file.fsx'], 191 \ 'fsharp': ['file.fs', 'file.fsi', 'file.fsx'],
191 \ 'fstab': ['fstab', 'mtab'], 192 \ 'fstab': ['fstab', 'mtab'],
192 \ 'fvwm': ['/.fvwm/file', 'any/.fvwm/file'], 193 \ 'fvwm': ['/.fvwm/file', 'any/.fvwm/file'],
193 \ 'gdb': ['.gdbinit', 'gdbinit'], 194 \ 'gdb': ['.gdbinit', 'gdbinit'],
194 \ 'gdmo': ['file.mo', 'file.gdmo'], 195 \ 'gdmo': ['file.mo', 'file.gdmo'],
1169 call delete('0', 'rf') 1170 call delete('0', 'rf')
1170 call delete('0.orig', 'rf') 1171 call delete('0.orig', 'rf')
1171 filetype off 1172 filetype off
1172 endfunc 1173 endfunc
1173 1174
1175 func Test_bas_file()
1176 filetype on
1177
1178 call writefile(['looks like BASIC'], 'Xfile.bas')
1179 split Xfile.bas
1180 call assert_equal('basic', &filetype)
1181 bwipe!
1182
1183 " Test dist#ft#FTbas()
1184
1185 let g:filetype_bas = 'freebasic'
1186 split Xfile.bas
1187 call assert_equal('freebasic', &filetype)
1188 bwipe!
1189 unlet g:filetype_bas
1190
1191 " FreeBASIC
1192
1193 call writefile(["/' FreeBASIC multiline comment '/"], 'Xfile.bas')
1194 split Xfile.bas
1195 call assert_equal('freebasic', &filetype)
1196 bwipe!
1197
1198 call writefile(['#define TESTING'], 'Xfile.bas')
1199 split Xfile.bas
1200 call assert_equal('freebasic', &filetype)
1201 bwipe!
1202
1203 call writefile(['option byval'], 'Xfile.bas')
1204 split Xfile.bas
1205 call assert_equal('freebasic', &filetype)
1206 bwipe!
1207
1208 call writefile(['extern "C"'], 'Xfile.bas')
1209 split Xfile.bas
1210 call assert_equal('freebasic', &filetype)
1211 bwipe!
1212
1213 " QB64
1214
1215 call writefile(['$LET TESTING = 1'], 'Xfile.bas')
1216 split Xfile.bas
1217 call assert_equal('qb64', &filetype)
1218 bwipe!
1219
1220 call writefile(['OPTION _EXPLICIT'], 'Xfile.bas')
1221 split Xfile.bas
1222 call assert_equal('qb64', &filetype)
1223 bwipe!
1224
1225 " Visual Basic
1226
1227 call writefile(['Attribute VB_NAME = "Testing"'], 'Xfile.bas')
1228 split Xfile.bas
1229 call assert_equal('vb', &filetype)
1230 bwipe!
1231
1232 call delete('Xfile.bas')
1233 filetype off
1234 endfunc
1235
1174 " vim: shiftwidth=2 sts=2 expandtab 1236 " vim: shiftwidth=2 sts=2 expandtab