comparison src/testdir/test_filetype.vim @ 28390:cc4d3ded4004 v8.2.4720

patch 8.2.0003: Build file dependencies are incomplete Commit: https://github.com/vim/vim/commit/0bbf09ca41382302493e5db51b01d2fbdc778586 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 9 15:16:53 2022 +0100 patch 8.2.0003: Build file dependencies are incomplete Problem: Build file dependencies are incomplete. Solution: Fix the dependencies. (Ken Takata, closes https://github.com/vim/vim/issues/5356)
author Bram Moolenaar <Bram@vim.org>
date Sat, 09 Apr 2022 16:30:03 +0200
parents 90d43a367955
children 860c2c6bcdfd
comparison
equal deleted inserted replaced
28389:24fc9545bf2a 28390:cc4d3ded4004
97 \ 'cdl': ['file.cdl'], 97 \ 'cdl': ['file.cdl'],
98 \ 'cdrdaoconf': ['/etc/cdrdao.conf', '/etc/defaults/cdrdao', '/etc/default/cdrdao', '.cdrdao', 'any/etc/cdrdao.conf', 'any/etc/default/cdrdao', 'any/etc/defaults/cdrdao'], 98 \ 'cdrdaoconf': ['/etc/cdrdao.conf', '/etc/defaults/cdrdao', '/etc/default/cdrdao', '.cdrdao', 'any/etc/cdrdao.conf', 'any/etc/default/cdrdao', 'any/etc/defaults/cdrdao'],
99 \ 'cdrtoc': ['file.toc'], 99 \ 'cdrtoc': ['file.toc'],
100 \ 'cf': ['file.cfm', 'file.cfi', 'file.cfc'], 100 \ 'cf': ['file.cfm', 'file.cfi', 'file.cfc'],
101 \ 'cfengine': ['cfengine.conf'], 101 \ 'cfengine': ['cfengine.conf'],
102 \ 'cfg': ['file.cfg', 'file.hgrc', 'filehgrc', 'hgrc', 'some-hgrc'], 102 \ 'cfg': ['file.hgrc', 'filehgrc', 'hgrc', 'some-hgrc'],
103 \ 'ch': ['file.chf'], 103 \ 'ch': ['file.chf'],
104 \ 'chaiscript': ['file.chai'], 104 \ 'chaiscript': ['file.chai'],
105 \ 'chaskell': ['file.chs'], 105 \ 'chaskell': ['file.chs'],
106 \ 'chill': ['file..ch'], 106 \ 'chill': ['file..ch'],
107 \ 'chordpro': ['file.chopro', 'file.crd', 'file.cho', 'file.crdpro', 'file.chordpro'], 107 \ 'chordpro': ['file.chopro', 'file.crd', 'file.cho', 'file.crdpro', 'file.chordpro'],
148 \ 'dictdconf': ['dictd.conf', 'dictdfile.conf', 'dictd-file.conf'], 148 \ 'dictdconf': ['dictd.conf', 'dictdfile.conf', 'dictd-file.conf'],
149 \ 'diff': ['file.diff', 'file.rej'], 149 \ 'diff': ['file.diff', 'file.rej'],
150 \ 'dircolors': ['.dir_colors', '.dircolors', '/etc/DIR_COLORS', 'any/etc/DIR_COLORS'], 150 \ 'dircolors': ['.dir_colors', '.dircolors', '/etc/DIR_COLORS', 'any/etc/DIR_COLORS'],
151 \ 'dnsmasq': ['/etc/dnsmasq.conf', '/etc/dnsmasq.d/file', 'any/etc/dnsmasq.conf', 'any/etc/dnsmasq.d/file'], 151 \ 'dnsmasq': ['/etc/dnsmasq.conf', '/etc/dnsmasq.d/file', 'any/etc/dnsmasq.conf', 'any/etc/dnsmasq.d/file'],
152 \ 'dockerfile': ['Containerfile', 'Dockerfile', 'file.Dockerfile', 'Dockerfile.debian', 'Containerfile.something'], 152 \ 'dockerfile': ['Containerfile', 'Dockerfile', 'file.Dockerfile', 'Dockerfile.debian', 'Containerfile.something'],
153 \ 'dosbatch': ['file.bat', 'file.sys'], 153 \ 'dosbatch': ['file.bat'],
154 \ 'dosini': ['.editorconfig', '/etc/pacman.conf', '/etc/yum.conf', 'file.ini', 'npmrc', '.npmrc', 'php.ini', 'php.ini-5', 'php.ini-file', '/etc/yum.repos.d/file', 'any/etc/pacman.conf', 'any/etc/yum.conf', 'any/etc/yum.repos.d/file', 'file.wrap'], 154 \ 'dosini': ['.editorconfig', '/etc/pacman.conf', '/etc/yum.conf', 'file.ini', 'npmrc', '.npmrc', 'php.ini', 'php.ini-5', 'php.ini-file', '/etc/yum.repos.d/file', 'any/etc/pacman.conf', 'any/etc/yum.conf', 'any/etc/yum.repos.d/file', 'file.wrap'],
155 \ 'dot': ['file.dot', 'file.gv'], 155 \ 'dot': ['file.dot', 'file.gv'],
156 \ 'dracula': ['file.drac', 'file.drc', 'filelvs', 'filelpe', 'drac.file', 'lpe', 'lvs', 'some-lpe', 'some-lvs'], 156 \ 'dracula': ['file.drac', 'file.drc', 'filelvs', 'filelpe', 'drac.file', 'lpe', 'lvs', 'some-lpe', 'some-lvs'],
157 \ 'dtd': ['file.dtd'], 157 \ 'dtd': ['file.dtd'],
158 \ 'dtrace': ['/usr/lib/dtrace/io.d'], 158 \ 'dtrace': ['/usr/lib/dtrace/io.d'],
614 \ 614 \
615 \ 'help': [$VIMRUNTIME . '/doc/help.txt'], 615 \ 'help': [$VIMRUNTIME . '/doc/help.txt'],
616 \ } 616 \ }
617 617
618 let s:filename_case_checks = { 618 let s:filename_case_checks = {
619 \ 'modula2': ['file.DEF', 'file.MOD'], 619 \ 'modula2': ['file.DEF'],
620 \ 'bzl': ['file.BUILD', 'BUILD'], 620 \ 'bzl': ['file.BUILD', 'BUILD'],
621 \ } 621 \ }
622 622
623 func CheckItems(checks) 623 func CheckItems(checks)
624 set noswapfile 624 set noswapfile
830 830
831 call delete('Xfile.bas') 831 call delete('Xfile.bas')
832 filetype off 832 filetype off
833 endfunc 833 endfunc
834 834
835 " Test dist#ft#FTcfg()
836 func Test_cfg_file()
837 filetype on
838
839 " *.cfg defaults to cfg
840 call writefile(['looks like cfg'], 'cfgfile.cfg')
841 split cfgfile.cfg
842 call assert_equal('cfg', &filetype)
843
844 let g:filetype_cfg = 'other'
845 edit
846 call assert_equal('other', &filetype)
847 bwipe!
848 unlet g:filetype_cfg
849
850 " RAPID cfg
851 let ext = 'cfg'
852 for i in ['EIO', 'MMC', 'MOC', 'PROC', 'SIO', 'SYS']
853 call writefile([i .. ':CFG'], 'cfgfile.' .. ext)
854 execute "split cfgfile." .. ext
855 call assert_equal('rapid', &filetype)
856 bwipe!
857 call delete('cfgfile.' .. ext)
858 " check different case of file extension
859 let ext = substitute(ext, '\(\l\)', '\u\1', '')
860 endfor
861
862 filetype off
863 endfunc
864
835 func Test_d_file() 865 func Test_d_file()
836 filetype on 866 filetype on
837 867
838 call writefile(['looks like D'], 'Xfile.d') 868 call writefile(['looks like D'], 'Xfile.d')
839 split Xfile.d 869 split Xfile.d
1276 1306
1277 call delete('Xfile.m') 1307 call delete('Xfile.m')
1278 filetype off 1308 filetype off
1279 endfunc 1309 endfunc
1280 1310
1311 func Test_mod_file()
1312 filetype on
1313
1314 " *.mod defaults to Modsim III
1315 call writefile(['locks like Modsim III'], 'modfile.mod')
1316 split modfile.mod
1317 call assert_equal('modsim3', &filetype)
1318 bwipe!
1319
1320 " Users preference set by g:filetype_mod
1321 let g:filetype_mod = 'lprolog'
1322 split modfile.mod
1323 call assert_equal('lprolog', &filetype)
1324 unlet g:filetype_mod
1325 bwipe!
1326
1327 " RAPID header start with a line containing only "%%%",
1328 " but is not always present.
1329 call writefile(['%%%'], 'modfile.mod')
1330 split modfile.mod
1331 call assert_equal('rapid', &filetype)
1332 bwipe!
1333 call delete('modfile.mod')
1334
1335 " RAPID supports umlauts in module names, leading spaces,
1336 " the .mod extension is not case sensitive.
1337 call writefile([' module ÜmlautModule'], 'modfile.Mod')
1338 split modfile.Mod
1339 call assert_equal('rapid', &filetype)
1340 bwipe!
1341 call delete('modfile.Mod')
1342
1343 " RAPID is not case sensitive, embedded spaces, sysmodule,
1344 " file starts with empty line(s).
1345 call writefile(['', 'MODULE rapidmödüle (SYSMODULE,NOSTEPIN)'], 'modfile.MOD')
1346 split modfile.MOD
1347 call assert_equal('rapid', &filetype)
1348 bwipe!
1349
1350 " Modula-2 MODULE not start of line
1351 call writefile(['IMPLEMENTATION MODULE Module2Mod;'], 'modfile.MOD')
1352 split modfile.MOD
1353 call assert_equal('modula2', &filetype)
1354 bwipe!
1355
1356 " Modula-2 with comment and empty lines prior MODULE
1357 call writefile(['', '(* with', ' comment *)', '', 'MODULE Module2Mod;'], 'modfile.MOD')
1358 split modfile.MOD
1359 call assert_equal('modula2', &filetype)
1360 bwipe!
1361 call delete('modfile.MOD')
1362
1363 " LambdaProlog module
1364 call writefile(['module lpromod.'], 'modfile.mod')
1365 split modfile.mod
1366 call assert_equal('lprolog', &filetype)
1367 bwipe!
1368
1369 " LambdaProlog with comment and empty lines prior module
1370 call writefile(['', '% with', '% comment', '', 'module lpromod.'], 'modfile.mod')
1371 split modfile.mod
1372 call assert_equal('lprolog', &filetype)
1373 bwipe!
1374 call delete('modfile.mod')
1375
1376 " go.mod
1377 call writefile(['module example.com/M'], 'go.mod')
1378 split go.mod
1379 call assert_equal('gomod', &filetype)
1380 bwipe!
1381 call delete('go.mod')
1382
1383 filetype off
1384 endfunc
1385
1281 func Test_patch_file() 1386 func Test_patch_file()
1282 filetype on 1387 filetype on
1283 1388
1284 call writefile([], 'Xfile.patch') 1389 call writefile([], 'Xfile.patch')
1285 split Xfile.patch 1390 split Xfile.patch
1344 1449
1345 call delete('Xfile.pp') 1450 call delete('Xfile.pp')
1346 filetype off 1451 filetype off
1347 endfunc 1452 endfunc
1348 1453
1454 " Test dist#ft#FTprg()
1455 func Test_prg_file()
1456 filetype on
1457
1458 " *.prg defaults to clipper
1459 call writefile(['looks like clipper'], 'prgfile.prg')
1460 split prgfile.prg
1461 call assert_equal('clipper', &filetype)
1462 bwipe!
1463
1464 " Users preference set by g:filetype_prg
1465 let g:filetype_prg = 'eviews'
1466 split prgfile.prg
1467 call assert_equal('eviews', &filetype)
1468 unlet g:filetype_prg
1469 bwipe!
1470
1471 " RAPID header start with a line containing only "%%%",
1472 " but is not always present.
1473 call writefile(['%%%'], 'prgfile.prg')
1474 split prgfile.prg
1475 call assert_equal('rapid', &filetype)
1476 bwipe!
1477 call delete('prgfile.prg')
1478
1479 " RAPID supports umlauts in module names, leading spaces,
1480 " the .prg extension is not case sensitive.
1481 call writefile([' module ÜmlautModule'], 'prgfile.Prg')
1482 split prgfile.Prg
1483 call assert_equal('rapid', &filetype)
1484 bwipe!
1485 call delete('prgfile.Prg')
1486
1487 " RAPID is not case sensitive, embedded spaces, sysmodule,
1488 " file starts with empty line(s).
1489 call writefile(['', 'MODULE rapidmödüle (SYSMODULE,NOSTEPIN)'], 'prgfile.PRG')
1490 split prgfile.PRG
1491 call assert_equal('rapid', &filetype)
1492 bwipe!
1493 call delete('prgfile.PRG')
1494
1495 filetype off
1496 endfunc
1497
1349 func Test_src_file() 1498 func Test_src_file()
1350 filetype on 1499 filetype on
1351 1500
1352 " KRL header start with "&WORD", but is not always present. 1501 " KRL header start with "&WORD", but is not always present.
1353 call writefile(['&ACCESS'], 'srcfile.src') 1502 call writefile(['&ACCESS'], 'srcfile.src')
1373 let g:filetype_src = 'src' 1522 let g:filetype_src = 'src'
1374 split srcfile.SRC 1523 split srcfile.SRC
1375 call assert_equal('src', &filetype) 1524 call assert_equal('src', &filetype)
1376 bwipe! 1525 bwipe!
1377 call delete('srcfile.SRC') 1526 call delete('srcfile.SRC')
1527
1528 filetype off
1529 endfunc
1530
1531 func Test_sys_file()
1532 filetype on
1533
1534 " *.sys defaults to Batch file for MSDOS
1535 call writefile(['looks like dos batch'], 'sysfile.sys')
1536 split sysfile.sys
1537 call assert_equal('bat', &filetype)
1538 bwipe!
1539
1540 " RAPID header start with a line containing only "%%%",
1541 " but is not always present.
1542 call writefile(['%%%'], 'sysfile.sys')
1543 split sysfile.sys
1544 call assert_equal('rapid', &filetype)
1545 bwipe!
1546 call delete('sysfile.sys')
1547
1548 " RAPID supports umlauts in module names, leading spaces,
1549 " the .sys extension is not case sensitive.
1550 call writefile([' module ÜmlautModule'], 'sysfile.Sys')
1551 split sysfile.Sys
1552 call assert_equal('rapid', &filetype)
1553 bwipe!
1554 call delete('sysfile.Sys')
1555
1556 " RAPID is not case sensitive, embedded spaces, sysmodule,
1557 " file starts with empty line(s).
1558 call writefile(['', 'MODULE rapidmödüle (SYSMODULE,NOSTEPIN)'], 'sysfile.SYS')
1559 split sysfile.SYS
1560 call assert_equal('rapid', &filetype)
1561 bwipe!
1562 call delete('sysfile.SYS')
1378 1563
1379 filetype off 1564 filetype off
1380 endfunc 1565 endfunc
1381 1566
1382 func Test_tex_file() 1567 func Test_tex_file()