Skip to content

Commit cbe6944

Browse files
committed
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.
1 parent c572da5 commit cbe6944

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

src/testdir/test_filetype.vim

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,4 +527,32 @@ func Test_filetype_detection()
527527
if has('fname_case')
528528
call CheckItems(s:filename_case_checks)
529529
endif
530+
filetype off
531+
endfunc
532+
533+
" Filetypes detected from the file contents by scripts.vim
534+
let s:script_checks = {
535+
\ 'virata': [['% Virata'],
536+
\ ['', '% Virata'],
537+
\ ['', '', '% Virata'],
538+
\ ['', '', '', '% Virata'],
539+
\ ['', '', '', '', '% Virata']],
540+
\ 'strace': [['execve("/usr/bin/pstree", ["pstree"], 0x7ff0 /* 63 vars */) = 0'],
541+
\ ['15:17:47 execve("/usr/bin/pstree", ["pstree"], ... "_=/usr/bin/strace"]) = 0'],
542+
\ ['__libc_start_main and something']],
543+
\ }
544+
545+
func Test_script_detection()
546+
filetype on
547+
for [ft, files] in items(s:script_checks)
548+
for file in files
549+
call writefile(file, 'Xtest')
550+
split Xtest
551+
call assert_equal(ft, &filetype)
552+
bwipe!
553+
endfor
554+
endfor
555+
call delete('Xtest')
556+
filetype off
530557
endfunc
558+

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,8 @@ static char *(features[]) =
769769

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
1007,
772774
/**/
773775
1006,
774776
/**/

0 commit comments

Comments
 (0)