Files
vim-polyglot/scripts/test_extensions.vim
Adam Stankiewicz 080b8cdc60 Fix ansible ftdetect
2020-08-25 14:26:38 +02:00

15 lines
515 B
VimL

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', '')