summaryrefslogtreecommitdiffstats
path: root/scripts/test_extensions.vim
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/test_extensions.vim')
-rw-r--r--scripts/test_extensions.vim14
1 files changed, 14 insertions, 0 deletions
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', '')