mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-10 04:23:51 -05:00
Fix ansible ftdetect
This commit is contained in:
16
scripts/test
16
scripts/test
@@ -2,10 +2,12 @@
|
||||
|
||||
set -e
|
||||
|
||||
vim --clean -N -u <(
|
||||
echo "filetype plugin indent on"
|
||||
echo "syntax enable"
|
||||
echo "let &rtp='$PWD,'.&rtp"
|
||||
echo "source scripts/test_filetypes.vim"
|
||||
echo "exec ':q!'"
|
||||
)
|
||||
vim --clean -N --cmd "
|
||||
filetype plugin indent on
|
||||
syntax enable
|
||||
let &rtp='$PWD,'.&rtp
|
||||
source ftdetect/polyglot.vim
|
||||
source scripts/test_extensions.vim
|
||||
source scripts/test_filetypes.vim
|
||||
exec ':q!'
|
||||
"
|
||||
|
||||
14
scripts/test_extensions.vim
Normal file
14
scripts/test_extensions.vim
Normal file
@@ -0,0 +1,14 @@
|
||||
function! TestExtension(filetype, filename, content)
|
||||
try
|
||||
exec "e " . a:filename
|
||||
exec "if &filetype != '" . a:filetype . "' \nthrow &filetype\nendif"
|
||||
catch
|
||||
echo 'Filename "' . a:filename . '" does not resolve to extension "' . a:filetype . '"'
|
||||
echo ' instead received: "' . v:exception . '"'
|
||||
exec ':cq!'
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
call TestExtension('blade', 'test.blade.php', '')
|
||||
call TestExtension('yaml.ansible', 'playbook.yml', '')
|
||||
call TestExtension('yaml.ansible', 'host_vars/foobar', '')
|
||||
Reference in New Issue
Block a user