blob: aea52f944e30c7c6a6833a57985b3977127f3dcf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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', '')
|