diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-08-27 16:54:26 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-08-27 16:54:26 +0200 |
commit | cbe6944956d7c39176e8b15faa77f1c29eaf5c97 (patch) | |
tree | 7f9cce58ff3118b649bba83e09e463ce4b902d86 | |
parent | c572da5f67aa5cdbbc127fc6f1d0a42e38468325 (diff) | |
download | vim-cbe6944956d7c39176e8b15faa77f1c29eaf5c97.zip |
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.
-rw-r--r-- | src/testdir/test_filetype.vim | 28 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index 9cce23a5c..061c3795a 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -527,4 +527,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 + diff --git a/src/version.c b/src/version.c index 5df1fc36a..7b23a9a9f 100644 --- a/src/version.c +++ b/src/version.c @@ -770,6 +770,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1007, +/**/ 1006, /**/ 1005, |