mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.0.1007: no test for filetype detection for scripts
Problem: No test for filetype detection for scripts.
Solution: Add a first test file script filetype detection.
cbe6944956
This commit is contained in:
parent
e15f2b4b96
commit
48af5991b9
@ -526,4 +526,32 @@ func Test_filetype_detection()
|
||||
if has('fname_case')
|
||||
call CheckItems(s:filename_case_checks)
|
||||
endif
|
||||
filetype off
|
||||
endfunc
|
||||
|
||||
" Filetypes detected from the file contents by scripts.vim
|
||||
let s:script_checks = {
|
||||
\ 'virata': [['% Virata'],
|
||||
\ ['', '% Virata'],
|
||||
\ ['', '', '% Virata'],
|
||||
\ ['', '', '', '% Virata'],
|
||||
\ ['', '', '', '', '% Virata']],
|
||||
\ 'strace': [['execve("/usr/bin/pstree", ["pstree"], 0x7ff0 /* 63 vars */) = 0'],
|
||||
\ ['15:17:47 execve("/usr/bin/pstree", ["pstree"], ... "_=/usr/bin/strace"]) = 0'],
|
||||
\ ['__libc_start_main and something']],
|
||||
\ }
|
||||
|
||||
func Test_script_detection()
|
||||
filetype on
|
||||
for [ft, files] in items(s:script_checks)
|
||||
for file in files
|
||||
call writefile(file, 'Xtest')
|
||||
split Xtest
|
||||
call assert_equal(ft, &filetype)
|
||||
bwipe!
|
||||
endfor
|
||||
endfor
|
||||
call delete('Xtest')
|
||||
filetype off
|
||||
endfunc
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user