diff options
| author | Adam Stankiewicz <sheerun@sher.pl> | 2020-08-25 14:26:38 +0200 | 
|---|---|---|
| committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-08-25 14:26:38 +0200 | 
| commit | 080b8cdc603b059db2d9e6f56e3f724418f9366a (patch) | |
| tree | 5543d38bca963ee1597c619b70ff7d7f87a751d0 /scripts | |
| parent | e47af23f64e4c02ab85080e94c23e57b3f66ecda (diff) | |
| download | vim-polyglot-080b8cdc603b059db2d9e6f56e3f724418f9366a.tar.gz vim-polyglot-080b8cdc603b059db2d9e6f56e3f724418f9366a.zip | |
Fix ansible ftdetect
Diffstat (limited to '')
| -rwxr-xr-x | scripts/test | 16 | ||||
| -rw-r--r-- | scripts/test_extensions.vim | 14 | 
2 files changed, 23 insertions, 7 deletions
| diff --git a/scripts/test b/scripts/test index 084d084a..88a2e973 100755 --- a/scripts/test +++ b/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!' +" diff --git a/scripts/test_extensions.vim b/scripts/test_extensions.vim new file mode 100644 index 00000000..aea52f94 --- /dev/null +++ b/scripts/test_extensions.vim @@ -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', '') | 
