diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-02-03 12:08:42 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-02-11 19:03:27 +0100 |
commit | 48af5991b9ac24df48a384b41840617f5d0ff096 (patch) | |
tree | ab3f31ee45d80895c7701557b7131e3ef75a63ee /src | |
parent | e15f2b4b9623df739ca38f1115286b2a4d4956cd (diff) | |
download | rneovim-48af5991b9ac24df48a384b41840617f5d0ff096.tar.gz rneovim-48af5991b9ac24df48a384b41840617f5d0ff096.tar.bz2 rneovim-48af5991b9ac24df48a384b41840617f5d0ff096.zip |
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.
https://github.com/vim/vim/commit/cbe6944956d7c39176e8b15faa77f1c29eaf5c97
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/testdir/test_filetype.vim | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index 5b195532d4..4348f3b6f6 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -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 + |