From 378dcb387823e840c13722d4b514086c8dfa3527 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 22 Sep 2020 21:47:21 +0200 Subject: Update tests location --- Makefile | 4 +- ftdetect/polyglot.vim | 4 + scripts/Gemfile | 3 - scripts/test | 4 +- scripts/test_extensions.vim | 356 -------------------------------------------- syntax/unison.vim | 3 + tests/extensions.vim | 356 ++++++++++++++++++++++++++++++++++++++++++++ tests/filetypes.vim | 242 ++++++++++++++++++++++++++++++ 8 files changed, 609 insertions(+), 363 deletions(-) delete mode 100644 scripts/Gemfile delete mode 100644 scripts/test_extensions.vim create mode 100644 tests/extensions.vim create mode 100644 tests/filetypes.vim diff --git a/Makefile b/Makefile index 9e9ec579..1ec9bf79 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -.PHONY: all test dev +.PHONY: build test dev -all: +build: @ scripts/build test: diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index cdb96b50..ba187f91 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -366,6 +366,10 @@ if !has_key(s:disabled_packages, 'protobuf') au! BufRead,BufNewFile *.proto endif +if !has_key(s:disabled_packages, 'puppet') + au! BufRead,BufNewFile *.pp +endif + if !has_key(s:disabled_packages, 'python') au! BufRead,BufNewFile *.py,*.pyi,*.pyw,*.spec,SConstruct endif diff --git a/scripts/Gemfile b/scripts/Gemfile deleted file mode 100644 index fc8e5745..00000000 --- a/scripts/Gemfile +++ /dev/null @@ -1,3 +0,0 @@ -source "https://rubygems.org" - -gem "jasherai-oniguruma" diff --git a/scripts/test b/scripts/test index 9e023bb9..227174d7 100755 --- a/scripts/test +++ b/scripts/test @@ -5,8 +5,8 @@ set -e vim --clean -N -u <(echo " let &rtp='$PWD,'.&rtp let g:polyglot_test = 1 - source scripts/test_extensions.vim - source scripts/test_filetypes.vim + source tests/extensions.vim + source tests/filetypes.vim qa! ") diff --git a/scripts/test_extensions.vim b/scripts/test_extensions.vim deleted file mode 100644 index 467ac86a..00000000 --- a/scripts/test_extensions.vim +++ /dev/null @@ -1,356 +0,0 @@ -function! TestExtension(filetype, filename, content) - try - let g:message = "" - exec "noautocmd n " . a:filename - put =a:content - 1delete _ - filetype detect - exec "if &filetype != '" . a:filetype . "' \nthrow &filetype\nendif" - exec ":bw!" - catch - echo g:message - echo "Filename '" . a:filename . "' does not resolve to extension '" . a:filetype . "'" - echo " instead received: '" . v:exception . "'" - exec ":cq!" - endtry -endfunction - -" make sure native vim scripts.vim is respected -call TestExtension("rib", "renderman", "##RenderMan") - -" make sure case of file does matter when recognizing file -call TestExtension("ruby", "scripts/build", "#!/usr/bin/env ruby") - -call TestExtension("sh", "bash1", "#!/bin/bash") -call TestExtension("sh", "bash2", "#! /bin/bash") -call TestExtension("sh", "bash3", "#! /bin/bash2.3") -call TestExtension("sh", "bash4", "#!/usr/bin/env bash") -call TestExtension("sh", "bash6", "#!/usr/bin/env -i -=split-string foo=bar bash -l foo") -call TestExtension("sh", "bash1", "#!/bin/bash") - -" Vim help file -call TestExtension("help", $VIMRUNTIME . "/doc/foobar.txt", "") - -" Abaqus or Trasys -call TestExtension("abaqus", "foobar.inp", "*HEADING\nFoobar") -call TestExtension("trasys", "foobar.inp", "MSC PATRAN\n* foobar\nHEADER SURFACE DATA\nBSC ENCLO1") - -" 8th (Firth-derivative) -call TestExtension("8th", "foobar.8th", "") -call TestExtension("8th", "foobar.8th", "") - -" A-A-P recipe -call TestExtension("aap", "foobar.aap", "") - - -" A2ps printing utility -call TestExtension("a2ps", "/etc/a2ps.cfg", "") -call TestExtension("a2ps", "/usr/local/etc/a2ps.cfg", "") -call TestExtension("a2ps", "/etc/a2ps/foobar.cfg", "") -call TestExtension("a2ps", "/usr/local/etc/a2ps/foobar.cfg", "") -call TestExtension("a2ps", "/tmp/a2psrc", "") -call TestExtension("a2ps", "/tmp/.a2psrc", "") - -" ABAB/4 -call TestExtension("abap", "foobar.abap", "") - -" ABC music notation -call TestExtension("abc", "foobar.abc", "") - -" ABEL -call TestExtension("abel", "foobar.abl", "") - -" AceDB -call TestExtension("acedb", "foobar.wrm", "") - -" Ada (83, 9X, 95) -call TestExtension("ada", "foobar.adb", "") -call TestExtension("ada", "foobar.ads", "") -call TestExtension("ada", "foobar.ada", "") -call TestExtension("ada", "foobar.gpr", "") - -" AHDL -call TestExtension("ahdl", "foobar.tdf", "") - -" AIDL -call TestExtension("aidl", "foobar.aidl", "") - -" AMPL -call TestExtension("ampl", "foobar.run", "") - -" Ant -call TestExtension("ant", "build.xml", "") - -" Arduino -call TestExtension("arduino", "foobar.ino", "") -call TestExtension("arduino", "foobar.pde", "") - -" Apache config file -call TestExtension("apache", ".htaccess", "") -call TestExtension("apache", "/etc/httpd/foobar.conf", "") -call TestExtension("apache", "/etc/apache2/sites-foobar/foobar.com", "") -call TestExtension("apache", "/usr/local/etc/httpd/foobar.conf", "") -call TestExtension("apache", "/usr/local/etc/apache2/sites-foobar/foobar.com", "") - -" XA65 MOS6510 cross assembler -call TestExtension("a65", "foobar.a65", "") - -" Applescript -call TestExtension("applescript", "foobar.scpt", "") - -" Applix ELF -call TestExtension("elf", "foobar.am", "") -call TestExtension("automake", "Makefile.am", "") -call TestExtension("automake", "makefile.am", "") - -" ALSA configuration -call TestExtension("alsaconf", ".asoundrc", "") -call TestExtension("alsaconf", "/usr/share/alsa/alsa.conf", "") -call TestExtension("alsaconf", "/media/foo/usr/share/alsa/alsa.conf", "") -call TestExtension("alsaconf", "/etc/asound.conf", "") -call TestExtension("alsaconf", "/media/foo/etc/asound.conf", "") - -" Arc Macro Language -call TestExtension("aml", "foobar.aml", "") - -" APT config file -call TestExtension("aptconf", "apt.conf", "") -call TestExtension("aptconf", "/root/.aptitude/config", "") -call TestExtension("aptconf", "/etc/apt/apt.conf.d/foo_bar-12", "") -call TestExtension("aptconf", "/etc/apt/apt.conf.d/foo_bar-12.conf", "") -call TestExtension("", "/etc/apt/apt.conf.d/.gsdf", "") - -" Arch Inventory file -call TestExtension("arch", ".arch-inventory", "") -call TestExtension("arch", "=tagging-method", "") - -" ART*Enterprise (formerly ART-IM) -call TestExtension("art", "foobar.art", "") - -" AsciiDoc -call TestExtension("asciidoc", "foobar.asciidoc", "") -call TestExtension("asciidoc", "foobar.adoc", "") - -" ASN.1 -call TestExtension("asn", "foobar.asn", "") -call TestExtension("asn", "foobar.asn1", "") - -" Active Server Pages (with Visual Basic Script) -call TestExtension("aspvbs", "foobar.asa", "") -let g:filetype_asa = "fizfuz" -call TestExtension("fizfuz", "foobar.asa", "") - -" Active Server Pages (with Perl or Visual Basic Script) -call TestExtension("aspvbs", "vbs.asp", "") -call TestExtension("aspperl", "perl.asp", "\n\n") -let g:filetype_asp = "fizfuz" -call TestExtension("fizfuz", "fizfuz.asp", "") - - -" Grub (must be before catch *.lst) -call TestExtension("grub", "/boot/grub/menu.lst", "") -call TestExtension("grub", "/media/foobar/boot/grub/menu.lst", "") -call TestExtension("grub", "/boot/grub/grub.conf", "") -call TestExtension("grub", "/media/foobar/boot/grub/grub.conf", "") -call TestExtension("grub", "/etc/grub.conf", "") -call TestExtension("grub", "/media/foobar/etc/grub.conf", "") - -" Assembly (all kinds) -" *.lst is not pure assembly, it has two extra columns (address, byte codes) - -au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.mac,*.lst call dist#ft#FTasm() - -" Macro (VAX) -call TestExtension("vmasm", "foobar.mar", "") - -" Atlas -call TestExtension("atlas", "foobar.atl", "") -call TestExtension("atlas", "foobar.as", "") - -" Autoit v3 -call TestExtension("autoit", "foobar.au3", "") - -" Autohotkey -call TestExtension("autohotkey", "foobar.ahk", "") - -" Automake -call TestExtension("automake", "Makefile.am", "") -call TestExtension("automake", "makefile.am", "") -call TestExtension("automake", "GNUmakefile.am", "") - -" Autotest .at files are actually m4 -call TestExtension("m4", "foobar.at", "") - -" Avenue -call TestExtension("ave", "foobar.ave", "") - -" Awk -call TestExtension("awk", "foobar.awk", "") - -" C++ -call TestExtension("c", "foobar.c", "") -call TestExtension("cpp", "foobar.cxx", "") -call TestExtension("cpp", "foobar.c++", "") -call TestExtension("cpp", "foobar.hh", "") -call TestExtension("cpp", "foobar.hxx", "") -call TestExtension("cpp", "foobar.hpp", "") -call TestExtension("cpp", "foobar.ipp", "") -call TestExtension("cpp", "foobar.moc", "") -call TestExtension("cpp", "foobar.tcc", "") -call TestExtension("cpp", "foobar.inl", "") - -" vim-polyglot only -call TestExtension("blade", "test.blade.php", "") -call TestExtension("yaml.ansible", "playbook.yml", "") -call TestExtension("yaml.ansible", "host_vars/foobar", "") -call TestExtension("yaml.ansible", "handlers.foobar.yaml", "") -call TestExtension("yaml.ansible", "requirements.yaml", "") -call TestExtension("ps1xml", "foobar.ps1xml", "") -call TestExtension("terraform", "terraform.tf", "") - -call TestExtension("idris2", "foobar.idr", "") -call TestExtension("idris", "foobar.idr", "pkgs : List String\npkgs = [\"NCurses\", \"Readline\"]") -let g:filetype_idr = "fizfuz" -call TestExtension("fizfuz", "fizfuz.idr", "") - -" .m extension -call TestExtension("octave", "matlab.m", "") -call TestExtension("objc", "objc.m", "\n\n #import ") -call TestExtension("octave", "objc.m", "results_ub_times=zeros(2,2,M);\n%results pour la lower bound") -call TestExtension("mma", "mathematica.m", "newcase[ \"00003\" ];\n (* Hello world *)") -call TestExtension("murphi", "murphi.m", "type\n square: 1 .. 9") -call TestExtension("murphi", "murphi.m", "something\n--foobar") -call TestExtension("octave", "percentcomment.m", "hello world\n%foobar") -call TestExtension("objc", "comment.m", "\n/* Hello world */") -let g:filetype_m = "fizfuz" -call TestExtension("fizfuz", "fizfuz.m", "") - -" .fs extension -call TestExtension("forth", "empty.fs", "") -call TestExtension("fsharp", "fsharp.fs", "let myInt = 5") -call TestExtension("glsl", "glsl.fs", "//#version 120\nvoid main() {}") -let g:filetype_fs = "fizfuz" -call TestExtension("fizfuz", "fizfuz.fs", "") - -" .re extension -call TestExtension("reason", "empty.re", "") -call TestExtension("cpp", "cpp.re", "#include \"config.h\"") -call TestExtension("cpp", "cpp2.re", "#ifdef HAVE_CONFIG_H") -call TestExtension("cpp", "cpp3.re", "#define YYCTYPE unsigned char") -call TestExtension("reason", "react.re", "ReasonReact.Router.push('');") - -" .bas extension -call TestExtension("vbnet", "vb.vb", "") -call TestExtension("basic", "empty.bas", "") -call TestExtension("vb", "vb1.bas", "Attribute VB_Name = \"Class1\"") -call TestExtension("vb", "vb2.bas", "VERSION 5.00\nBegin VB.Form Form1") -call TestExtension("vb", "vb2.bas", "VERSION 5.00\nBegin VB.Form Form1") -call TestExtension("vb", "vb.sba", "") -call TestExtension("vb", "vb.vbs", "") -call TestExtension("vb", "vb.dsm", "") -call TestExtension("vb", "vb.dsm", "") -call TestExtension("vb", "vb.ctl", "") - -" .idr extension -call TestExtension("idris", "lowercase.idr", "--idris1") -call TestExtension("idris", "uppercase.idr", "--Idris1") -call TestExtension("idris", "start-space-l.idr", "-- idris1") -call TestExtension("idris", "start-space-u.idr", "-- Idris1") -call TestExtension("idris", "two-spaces-l.idr", "-- idris 1") -call TestExtension("idris", "two-spaces-u.idr", "-- Idris 1") -"call TestExtension("idris", "mypkg.ipkg", "package mypkg\n\npkgs = pruviloj, lightyear") -call TestExtension("idris", "use-type-prov.idr", "%language TypeProviders") -call TestExtension("idris", "use-elab-refl.idr", "%language ElabReflection") -call TestExtension("idris", "access-modifier.idr", "%access export\n\npublic export\nMyTest : Type-> Type\n\nfact : Nat -> Nat") -call TestExtension("idris2", "lowercase.idr", "--idris2") -call TestExtension("idris2", "uppercase.idr", "--Idris2") -call TestExtension("idris2", "start-space-l.idr", "-- idris2") -call TestExtension("idris2", "start-space-u.idr", "-- Idris2") -call TestExtension("idris2", "two-spaces-l.idr", "-- idris 2") -call TestExtension("idris2", "two-spaces-u.idr", "-- Idris 2") -call TestExtension("idris2", "mypkg.ipkg", "package mypkg\n\ndepends = effects") -call TestExtension("idris2", "use-post-proj.idr", "%language PostfixProjections") - -" .lidr extension -call TestExtension("lidris", "lidris-1.lidr", "Some test plaintext\n\n> --idris1\n> myfact : Nat -> Nat\n> myfact Z = 1\n> myfact (S k) = (S k) * myfact k\n\nMore plaintext") -call TestExtension("lidris2", "lidris-2.lidr", "Some test plaintext\n\n> --idris2\n> myfact : Nat -> Nat\n> myfact Z = 1\n> myfact (S k) = (S k) * myfact k\n\nMore plaintext") - - -" .h extension -call TestExtension("objcpp", "foo.h", "@interface MTNavigationController : UINavigationController") -call TestExtension("cpp", "foo.h", "") -let g:c_syntax_for_h = 1 -call TestExtension("objc", "foo.h", "@interface MTNavigationController : UINavigationController") -call TestExtension("c", "foo.h", "") -unlet g:c_syntax_for_h -let g:ch_syntax_for_h = 1 -call TestExtension("ch", "foo.h", "") - -" perl -call TestExtension("perl", "empty.plx", "") -call TestExtension("perl", "empty.al", "") -call TestExtension("perl", "empty.psgi", "") -call TestExtension("pod", "empty.pod", "") - -" raku -call TestExtension("raku", "empty.p6", "") -call TestExtension("raku", "empty.pm6", "") -call TestExtension("raku", "empty.pl6", "") -call TestExtension("raku", "empty.raku", "") -call TestExtension("raku", "empty.rakumod", "") -call TestExtension("raku", "empty.pod6", "") -call TestExtension("raku", "empty.rakudoc", "") -call TestExtension("raku", "empty.rakutest", "") -call TestExtension("raku", "empty.t6", "") - - -" .pm extension -call TestExtension("perl", "empty.pm", "") -call TestExtension("perl", "strict.pm", " use strict hello;") -call TestExtension("perl", "use5.pm", " use 5;") -call TestExtension("perl", "usev5.pm", " use v5;") -call TestExtension("raku", "script.pm", "#!/usr/bin/env perl6\nprint('Hello world')") -call TestExtension("raku", "class.pm", " class Class {}") -call TestExtension("raku", "module.pm", " module foobar") -call TestExtension("xpm", "xpm.pm", "/* XPM */") -call TestExtension("xpm2", "xpm2.pm", "/* XPM2 */") -let g:filetype_pm = "fizfuz" -call TestExtension("fizfuz", "fizfuz.pm", "") - -" .pl extension -call TestExtension("perl", "empty.pl", "") -call TestExtension("prolog", "comment.pl", "% hello world") -call TestExtension("prolog", "comment2.pl", "/* hello world */") -call TestExtension("prolog", "statement.pl", "happy(vincent). ") -call TestExtension("prolog", "statement2.pl", "nearbychk(X,Y) :- Y is X-1.") -call TestExtension("perl", "strict.pl", " use strict hello;") -call TestExtension("perl", "use5.pl", " use 5;") -call TestExtension("perl", "usev5.pl", " use v5;") -call TestExtension("raku", "script.pl", "#!/usr/bin/env perl6\nprint('Hello world')") -call TestExtension("raku", "class.pl", " class Class {}") -call TestExtension("raku", "module.pl", " module foobar") -let g:filetype_pl = "fizfuz" -call TestExtension("fizfuz", "fizfuz.pl", "") - -" .t extension -call TestExtension("perl", "empty.t", "") -call TestExtension("perl", "strict.t", " use strict hello;") -call TestExtension("perl", "use5.t", " use 5;") -call TestExtension("perl", "usev5.t", " use v5;") -call TestExtension("raku", "script.t", "#!/usr/bin/env perl6\nprint('Hello world')") -call TestExtension("raku", "class.t", " class Class {}") -call TestExtension("raku", "module.t", " module foobar") -call TestExtension("nroff", "module.t", ".nf\n101 Main Street") -let g:filetype_t = "fizfuz" -call TestExtension("fizfuz", "fizfuz.t", "") - -" .tt2 extension -call TestExtension("tt2", "empty.tt2", "") -call TestExtension("tt2html", "doctype.tt2", "") -call TestExtension("tt2html", "percent.tt2", "<%filter>") -call TestExtension("tt2html", "html.tt2", "") - -" .html extension -call TestExtension("html", "empty.html", "") -call TestExtension("mason", "mason1.html", "% my $planet = 42;") -call TestExtension("mason", "mason2.html", "<%filter>") diff --git a/syntax/unison.vim b/syntax/unison.vim index 8353dce9..2578add8 100644 --- a/syntax/unison.vim +++ b/syntax/unison.vim @@ -97,6 +97,7 @@ endif syn match uLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$" syn region uBlockComment start="{-" end="-}" contains=uBlockComment syn region uPragma start="{-#" end="#-}" +syn region uBelowFold start="^---" skip="." end="." contains=uBelowFold " Docs syn region uDocBlock start="\[:" end=":]" contains=uLink,uDocDirective @@ -134,6 +135,7 @@ if version >= 508 || !exists("did_u_syntax_inits") HiLink uBlockComment uComment HiLink uLineComment uComment HiLink uComment Comment + HiLink uBelowFold Comment HiLink uDocBlock String HiLink uLink uType HiLink uDocDirective uImport @@ -148,6 +150,7 @@ if version >= 508 || !exists("did_u_syntax_inits") delcommand HiLink endif + let b:current_syntax = "unison" " Options for vi: ts=8 sw=2 sts=2 nowrap noexpandtab ft=vim diff --git a/tests/extensions.vim b/tests/extensions.vim new file mode 100644 index 00000000..467ac86a --- /dev/null +++ b/tests/extensions.vim @@ -0,0 +1,356 @@ +function! TestExtension(filetype, filename, content) + try + let g:message = "" + exec "noautocmd n " . a:filename + put =a:content + 1delete _ + filetype detect + exec "if &filetype != '" . a:filetype . "' \nthrow &filetype\nendif" + exec ":bw!" + catch + echo g:message + echo "Filename '" . a:filename . "' does not resolve to extension '" . a:filetype . "'" + echo " instead received: '" . v:exception . "'" + exec ":cq!" + endtry +endfunction + +" make sure native vim scripts.vim is respected +call TestExtension("rib", "renderman", "##RenderMan") + +" make sure case of file does matter when recognizing file +call TestExtension("ruby", "scripts/build", "#!/usr/bin/env ruby") + +call TestExtension("sh", "bash1", "#!/bin/bash") +call TestExtension("sh", "bash2", "#! /bin/bash") +call TestExtension("sh", "bash3", "#! /bin/bash2.3") +call TestExtension("sh", "bash4", "#!/usr/bin/env bash") +call TestExtension("sh", "bash6", "#!/usr/bin/env -i -=split-string foo=bar bash -l foo") +call TestExtension("sh", "bash1", "#!/bin/bash") + +" Vim help file +call TestExtension("help", $VIMRUNTIME . "/doc/foobar.txt", "") + +" Abaqus or Trasys +call TestExtension("abaqus", "foobar.inp", "*HEADING\nFoobar") +call TestExtension("trasys", "foobar.inp", "MSC PATRAN\n* foobar\nHEADER SURFACE DATA\nBSC ENCLO1") + +" 8th (Firth-derivative) +call TestExtension("8th", "foobar.8th", "") +call TestExtension("8th", "foobar.8th", "") + +" A-A-P recipe +call TestExtension("aap", "foobar.aap", "") + + +" A2ps printing utility +call TestExtension("a2ps", "/etc/a2ps.cfg", "") +call TestExtension("a2ps", "/usr/local/etc/a2ps.cfg", "") +call TestExtension("a2ps", "/etc/a2ps/foobar.cfg", "") +call TestExtension("a2ps", "/usr/local/etc/a2ps/foobar.cfg", "") +call TestExtension("a2ps", "/tmp/a2psrc", "") +call TestExtension("a2ps", "/tmp/.a2psrc", "") + +" ABAB/4 +call TestExtension("abap", "foobar.abap", "") + +" ABC music notation +call TestExtension("abc", "foobar.abc", "") + +" ABEL +call TestExtension("abel", "foobar.abl", "") + +" AceDB +call TestExtension("acedb", "foobar.wrm", "") + +" Ada (83, 9X, 95) +call TestExtension("ada", "foobar.adb", "") +call TestExtension("ada", "foobar.ads", "") +call TestExtension("ada", "foobar.ada", "") +call TestExtension("ada", "foobar.gpr", "") + +" AHDL +call TestExtension("ahdl", "foobar.tdf", "") + +" AIDL +call TestExtension("aidl", "foobar.aidl", "") + +" AMPL +call TestExtension("ampl", "foobar.run", "") + +" Ant +call TestExtension("ant", "build.xml", "") + +" Arduino +call TestExtension("arduino", "foobar.ino", "") +call TestExtension("arduino", "foobar.pde", "") + +" Apache config file +call TestExtension("apache", ".htaccess", "") +call TestExtension("apache", "/etc/httpd/foobar.conf", "") +call TestExtension("apache", "/etc/apache2/sites-foobar/foobar.com", "") +call TestExtension("apache", "/usr/local/etc/httpd/foobar.conf", "") +call TestExtension("apache", "/usr/local/etc/apache2/sites-foobar/foobar.com", "") + +" XA65 MOS6510 cross assembler +call TestExtension("a65", "foobar.a65", "") + +" Applescript +call TestExtension("applescript", "foobar.scpt", "") + +" Applix ELF +call TestExtension("elf", "foobar.am", "") +call TestExtension("automake", "Makefile.am", "") +call TestExtension("automake", "makefile.am", "") + +" ALSA configuration +call TestExtension("alsaconf", ".asoundrc", "") +call TestExtension("alsaconf", "/usr/share/alsa/alsa.conf", "") +call TestExtension("alsaconf", "/media/foo/usr/share/alsa/alsa.conf", "") +call TestExtension("alsaconf", "/etc/asound.conf", "") +call TestExtension("alsaconf", "/media/foo/etc/asound.conf", "") + +" Arc Macro Language +call TestExtension("aml", "foobar.aml", "") + +" APT config file +call TestExtension("aptconf", "apt.conf", "") +call TestExtension("aptconf", "/root/.aptitude/config", "") +call TestExtension("aptconf", "/etc/apt/apt.conf.d/foo_bar-12", "") +call TestExtension("aptconf", "/etc/apt/apt.conf.d/foo_bar-12.conf", "") +call TestExtension("", "/etc/apt/apt.conf.d/.gsdf", "") + +" Arch Inventory file +call TestExtension("arch", ".arch-inventory", "") +call TestExtension("arch", "=tagging-method", "") + +" ART*Enterprise (formerly ART-IM) +call TestExtension("art", "foobar.art", "") + +" AsciiDoc +call TestExtension("asciidoc", "foobar.asciidoc", "") +call TestExtension("asciidoc", "foobar.adoc", "") + +" ASN.1 +call TestExtension("asn", "foobar.asn", "") +call TestExtension("asn", "foobar.asn1", "") + +" Active Server Pages (with Visual Basic Script) +call TestExtension("aspvbs", "foobar.asa", "") +let g:filetype_asa = "fizfuz" +call TestExtension("fizfuz", "foobar.asa", "") + +" Active Server Pages (with Perl or Visual Basic Script) +call TestExtension("aspvbs", "vbs.asp", "") +call TestExtension("aspperl", "perl.asp", "\n\n") +let g:filetype_asp = "fizfuz" +call TestExtension("fizfuz", "fizfuz.asp", "") + + +" Grub (must be before catch *.lst) +call TestExtension("grub", "/boot/grub/menu.lst", "") +call TestExtension("grub", "/media/foobar/boot/grub/menu.lst", "") +call TestExtension("grub", "/boot/grub/grub.conf", "") +call TestExtension("grub", "/media/foobar/boot/grub/grub.conf", "") +call TestExtension("grub", "/etc/grub.conf", "") +call TestExtension("grub", "/media/foobar/etc/grub.conf", "") + +" Assembly (all kinds) +" *.lst is not pure assembly, it has two extra columns (address, byte codes) + +au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.mac,*.lst call dist#ft#FTasm() + +" Macro (VAX) +call TestExtension("vmasm", "foobar.mar", "") + +" Atlas +call TestExtension("atlas", "foobar.atl", "") +call TestExtension("atlas", "foobar.as", "") + +" Autoit v3 +call TestExtension("autoit", "foobar.au3", "") + +" Autohotkey +call TestExtension("autohotkey", "foobar.ahk", "") + +" Automake +call TestExtension("automake", "Makefile.am", "") +call TestExtension("automake", "makefile.am", "") +call TestExtension("automake", "GNUmakefile.am", "") + +" Autotest .at files are actually m4 +call TestExtension("m4", "foobar.at", "") + +" Avenue +call TestExtension("ave", "foobar.ave", "") + +" Awk +call TestExtension("awk", "foobar.awk", "") + +" C++ +call TestExtension("c", "foobar.c", "") +call TestExtension("cpp", "foobar.cxx", "") +call TestExtension("cpp", "foobar.c++", "") +call TestExtension("cpp", "foobar.hh", "") +call TestExtension("cpp", "foobar.hxx", "") +call TestExtension("cpp", "foobar.hpp", "") +call TestExtension("cpp", "foobar.ipp", "") +call TestExtension("cpp", "foobar.moc", "") +call TestExtension("cpp", "foobar.tcc", "") +call TestExtension("cpp", "foobar.inl", "") + +" vim-polyglot only +call TestExtension("blade", "test.blade.php", "") +call TestExtension("yaml.ansible", "playbook.yml", "") +call TestExtension("yaml.ansible", "host_vars/foobar", "") +call TestExtension("yaml.ansible", "handlers.foobar.yaml", "") +call TestExtension("yaml.ansible", "requirements.yaml", "") +call TestExtension("ps1xml", "foobar.ps1xml", "") +call TestExtension("terraform", "terraform.tf", "") + +call TestExtension("idris2", "foobar.idr", "") +call TestExtension("idris", "foobar.idr", "pkgs : List String\npkgs = [\"NCurses\", \"Readline\"]") +let g:filetype_idr = "fizfuz" +call TestExtension("fizfuz", "fizfuz.idr", "") + +" .m extension +call TestExtension("octave", "matlab.m", "") +call TestExtension("objc", "objc.m", "\n\n #import ") +call TestExtension("octave", "objc.m", "results_ub_times=zeros(2,2,M);\n%results pour la lower bound") +call TestExtension("mma", "mathematica.m", "newcase[ \"00003\" ];\n (* Hello world *)") +call TestExtension("murphi", "murphi.m", "type\n square: 1 .. 9") +call TestExtension("murphi", "murphi.m", "something\n--foobar") +call TestExtension("octave", "percentcomment.m", "hello world\n%foobar") +call TestExtension("objc", "comment.m", "\n/* Hello world */") +let g:filetype_m = "fizfuz" +call TestExtension("fizfuz", "fizfuz.m", "") + +" .fs extension +call TestExtension("forth", "empty.fs", "") +call TestExtension("fsharp", "fsharp.fs", "let myInt = 5") +call TestExtension("glsl", "glsl.fs", "//#version 120\nvoid main() {}") +let g:filetype_fs = "fizfuz" +call TestExtension("fizfuz", "fizfuz.fs", "") + +" .re extension +call TestExtension("reason", "empty.re", "") +call TestExtension("cpp", "cpp.re", "#include \"config.h\"") +call TestExtension("cpp", "cpp2.re", "#ifdef HAVE_CONFIG_H") +call TestExtension("cpp", "cpp3.re", "#define YYCTYPE unsigned char") +call TestExtension("reason", "react.re", "ReasonReact.Router.push('');") + +" .bas extension +call TestExtension("vbnet", "vb.vb", "") +call TestExtension("basic", "empty.bas", "") +call TestExtension("vb", "vb1.bas", "Attribute VB_Name = \"Class1\"") +call TestExtension("vb", "vb2.bas", "VERSION 5.00\nBegin VB.Form Form1") +call TestExtension("vb", "vb2.bas", "VERSION 5.00\nBegin VB.Form Form1") +call TestExtension("vb", "vb.sba", "") +call TestExtension("vb", "vb.vbs", "") +call TestExtension("vb", "vb.dsm", "") +call TestExtension("vb", "vb.dsm", "") +call TestExtension("vb", "vb.ctl", "") + +" .idr extension +call TestExtension("idris", "lowercase.idr", "--idris1") +call TestExtension("idris", "uppercase.idr", "--Idris1") +call TestExtension("idris", "start-space-l.idr", "-- idris1") +call TestExtension("idris", "start-space-u.idr", "-- Idris1") +call TestExtension("idris", "two-spaces-l.idr", "-- idris 1") +call TestExtension("idris", "two-spaces-u.idr", "-- Idris 1") +"call TestExtension("idris", "mypkg.ipkg", "package mypkg\n\npkgs = pruviloj, lightyear") +call TestExtension("idris", "use-type-prov.idr", "%language TypeProviders") +call TestExtension("idris", "use-elab-refl.idr", "%language ElabReflection") +call TestExtension("idris", "access-modifier.idr", "%access export\n\npublic export\nMyTest : Type-> Type\n\nfact : Nat -> Nat") +call TestExtension("idris2", "lowercase.idr", "--idris2") +call TestExtension("idris2", "uppercase.idr", "--Idris2") +call TestExtension("idris2", "start-space-l.idr", "-- idris2") +call TestExtension("idris2", "start-space-u.idr", "-- Idris2") +call TestExtension("idris2", "two-spaces-l.idr", "-- idris 2") +call TestExtension("idris2", "two-spaces-u.idr", "-- Idris 2") +call TestExtension("idris2", "mypkg.ipkg", "package mypkg\n\ndepends = effects") +call TestExtension("idris2", "use-post-proj.idr", "%language PostfixProjections") + +" .lidr extension +call TestExtension("lidris", "lidris-1.lidr", "Some test plaintext\n\n> --idris1\n> myfact : Nat -> Nat\n> myfact Z = 1\n> myfact (S k) = (S k) * myfact k\n\nMore plaintext") +call TestExtension("lidris2", "lidris-2.lidr", "Some test plaintext\n\n> --idris2\n> myfact : Nat -> Nat\n> myfact Z = 1\n> myfact (S k) = (S k) * myfact k\n\nMore plaintext") + + +" .h extension +call TestExtension("objcpp", "foo.h", "@interface MTNavigationController : UINavigationController") +call TestExtension("cpp", "foo.h", "") +let g:c_syntax_for_h = 1 +call TestExtension("objc", "foo.h", "@interface MTNavigationController : UINavigationController") +call TestExtension("c", "foo.h", "") +unlet g:c_syntax_for_h +let g:ch_syntax_for_h = 1 +call TestExtension("ch", "foo.h", "") + +" perl +call TestExtension("perl", "empty.plx", "") +call TestExtension("perl", "empty.al", "") +call TestExtension("perl", "empty.psgi", "") +call TestExtension("pod", "empty.pod", "") + +" raku +call TestExtension("raku", "empty.p6", "") +call TestExtension("raku", "empty.pm6", "") +call TestExtension("raku", "empty.pl6", "") +call TestExtension("raku", "empty.raku", "") +call TestExtension("raku", "empty.rakumod", "") +call TestExtension("raku", "empty.pod6", "") +call TestExtension("raku", "empty.rakudoc", "") +call TestExtension("raku", "empty.rakutest", "") +call TestExtension("raku", "empty.t6", "") + + +" .pm extension +call TestExtension("perl", "empty.pm", "") +call TestExtension("perl", "strict.pm", " use strict hello;") +call TestExtension("perl", "use5.pm", " use 5;") +call TestExtension("perl", "usev5.pm", " use v5;") +call TestExtension("raku", "script.pm", "#!/usr/bin/env perl6\nprint('Hello world')") +call TestExtension("raku", "class.pm", " class Class {}") +call TestExtension("raku", "module.pm", " module foobar") +call TestExtension("xpm", "xpm.pm", "/* XPM */") +call TestExtension("xpm2", "xpm2.pm", "/* XPM2 */") +let g:filetype_pm = "fizfuz" +call TestExtension("fizfuz", "fizfuz.pm", "") + +" .pl extension +call TestExtension("perl", "empty.pl", "") +call TestExtension("prolog", "comment.pl", "% hello world") +call TestExtension("prolog", "comment2.pl", "/* hello world */") +call TestExtension("prolog", "statement.pl", "happy(vincent). ") +call TestExtension("prolog", "statement2.pl", "nearbychk(X,Y) :- Y is X-1.") +call TestExtension("perl", "strict.pl", " use strict hello;") +call TestExtension("perl", "use5.pl", " use 5;") +call TestExtension("perl", "usev5.pl", " use v5;") +call TestExtension("raku", "script.pl", "#!/usr/bin/env perl6\nprint('Hello world')") +call TestExtension("raku", "class.pl", " class Class {}") +call TestExtension("raku", "module.pl", " module foobar") +let g:filetype_pl = "fizfuz" +call TestExtension("fizfuz", "fizfuz.pl", "") + +" .t extension +call TestExtension("perl", "empty.t", "") +call TestExtension("perl", "strict.t", " use strict hello;") +call TestExtension("perl", "use5.t", " use 5;") +call TestExtension("perl", "usev5.t", " use v5;") +call TestExtension("raku", "script.t", "#!/usr/bin/env perl6\nprint('Hello world')") +call TestExtension("raku", "class.t", " class Class {}") +call TestExtension("raku", "module.t", " module foobar") +call TestExtension("nroff", "module.t", ".nf\n101 Main Street") +let g:filetype_t = "fizfuz" +call TestExtension("fizfuz", "fizfuz.t", "") + +" .tt2 extension +call TestExtension("tt2", "empty.tt2", "") +call TestExtension("tt2html", "doctype.tt2", "") +call TestExtension("tt2html", "percent.tt2", "<%filter>") +call TestExtension("tt2html", "html.tt2", "") + +" .html extension +call TestExtension("html", "empty.html", "") +call TestExtension("mason", "mason1.html", "% my $planet = 42;") +call TestExtension("mason", "mason2.html", "<%filter>") diff --git a/tests/filetypes.vim b/tests/filetypes.vim new file mode 100644 index 00000000..02d44ca4 --- /dev/null +++ b/tests/filetypes.vim @@ -0,0 +1,242 @@ +function! TestFiletype(filetype) + try + enew + exec 'set ft=' . a:filetype + catch + echo 'Error loading filetype ' . a:filetype . ':' + echo v:exception + echo v:throwpoint + exec ':cq!' + endtry +endfunction + +call TestFiletype('8th') +call TestFiletype('haproxy') +call TestFiletype('a2ps') +call TestFiletype('a65') +call TestFiletype('aap') +call TestFiletype('abap') +call TestFiletype('abaqus') +call TestFiletype('abc') +call TestFiletype('abel') +call TestFiletype('acedb') +call TestFiletype('asl') +call TestFiletype('ada') +call TestFiletype('ahdl') +call TestFiletype('aidl') +call TestFiletype('alsaconf') +call TestFiletype('aml') +call TestFiletype('ampl') +call TestFiletype('xml') +call TestFiletype('ant') +call TestFiletype('apache') +call TestFiletype('apiblueprint') +call TestFiletype('applescript') +call TestFiletype('aptconf') +call TestFiletype('arch') +call TestFiletype('cpp') +call TestFiletype('c') +call TestFiletype('arduino') +call TestFiletype('art') +call TestFiletype('asciidoc') +call TestFiletype('autohotkey') +call TestFiletype('elf') +call TestFiletype('automake') +call TestFiletype('asn') +call TestFiletype('aspvbs') +call TestFiletype('aspperl') +call TestFiletype('atlas') +call TestFiletype('autoit') +call TestFiletype('ave') +call TestFiletype('awk') +call TestFiletype('caddyfile') +call TestFiletype('carp') +call TestFiletype('clojure') +call TestFiletype('cmake') +call TestFiletype('coffee') +call TestFiletype('litcoffee') +call TestFiletype('cryptol') +call TestFiletype('crystal') +call TestFiletype('ecrystal') +call TestFiletype('csv') +call TestFiletype('cucumber') +call TestFiletype('cuesheet') +call TestFiletype('dart') +call TestFiletype('dhall') +call TestFiletype('d') +call TestFiletype('dcov') +call TestFiletype('dd') +call TestFiletype('ddoc') +call TestFiletype('dsdl') +call TestFiletype('Dockerfile') +call TestFiletype('yaml.docker-compose') +call TestFiletype('elixir') +call TestFiletype('eelixir') +call TestFiletype('elm') +call TestFiletype('ember-script') +call TestFiletype('emblem') +call TestFiletype('erlang') +call TestFiletype('fennel') +call TestFiletype('ferm') +call TestFiletype('fish') +call TestFiletype('fbs') +call TestFiletype('forth') +call TestFiletype('glsl') +call TestFiletype('fsharp') +call TestFiletype('gdscript3') +call TestFiletype('gitconfig') +call TestFiletype('gitrebase') +call TestFiletype('gitsendemail') +call TestFiletype('gitcommit') +call TestFiletype('gmpl') +call TestFiletype('gnuplot') +call TestFiletype('go') +call TestFiletype('gomod') +call TestFiletype('gohtmltmpl') +call TestFiletype('javascript') +call TestFiletype('flow') +call TestFiletype('javascriptreact') +call TestFiletype('graphql') +call TestFiletype('groovy') +call TestFiletype('grub') +call TestFiletype('haml') +call TestFiletype('mustache') +call TestFiletype('haskell') +call TestFiletype('haxe') +call TestFiletype('hcl') +call TestFiletype('hive') +call TestFiletype('html') +call TestFiletype('i3config') +call TestFiletype('icalendar') +call TestFiletype('idris') +call TestFiletype('idris2') +call TestFiletype('lidris2') +call TestFiletype('ion') +call TestFiletype('Jenkinsfile') +call TestFiletype('jinja.html') +call TestFiletype('jq') +call TestFiletype('json5') +call TestFiletype('json') +call TestFiletype('jsonnet') +call TestFiletype('jst') +call TestFiletype('julia') +call TestFiletype('kotlin') +call TestFiletype('ledger') +call TestFiletype('less') +call TestFiletype('lilypond') +call TestFiletype('livescript') +call TestFiletype('llvm') +call TestFiletype('tablegen') +call TestFiletype('log') +call TestFiletype('lua') +call TestFiletype('m4') +call TestFiletype('mako') +call TestFiletype('mma') +call TestFiletype('markdown') +call TestFiletype('markdown.mdx') +call TestFiletype('meson') +call TestFiletype('dosini') +call TestFiletype('moon') +call TestFiletype('murphi') +call TestFiletype('nginx') +call TestFiletype('nim') +call TestFiletype('nix') +call TestFiletype('objc') +call TestFiletype('ocaml') +call TestFiletype('omake') +call TestFiletype('opam') +call TestFiletype('oasis') +call TestFiletype('dune') +call TestFiletype('ocamlbuild_tags') +call TestFiletype('ocpbuild') +call TestFiletype('ocpbuildroot') +call TestFiletype('sexplib') +call TestFiletype('octave') +call TestFiletype('opencl') +call TestFiletype('perl') +call TestFiletype('pod') +call TestFiletype('mason') +call TestFiletype('tt2') +call TestFiletype('tt2html') +call TestFiletype('xs') +call TestFiletype('sql') +call TestFiletype('cql') +call TestFiletype('php') +call TestFiletype('blade') +call TestFiletype('plantuml') +call TestFiletype('pony') +call TestFiletype('ps1') +call TestFiletype('ps1xml') +call TestFiletype('proto') +call TestFiletype('pug') +call TestFiletype('puppet') +call TestFiletype('embeddedpuppet') +call TestFiletype('purescript') +call TestFiletype('python') +call TestFiletype('requirements') +call TestFiletype('qmake') +call TestFiletype('qml') +call TestFiletype('r') +call TestFiletype('rhelp') +call TestFiletype('racket') +call TestFiletype('ragel') +call TestFiletype('raku') +call TestFiletype('raml') +call TestFiletype('razor') +call TestFiletype('reason') +call TestFiletype('rst') +call TestFiletype('ruby') +call TestFiletype('eruby') +call TestFiletype('ruby') +call TestFiletype('brewfile') +call TestFiletype('rust') +call TestFiletype('scala') +call TestFiletype('sbt.scala') +call TestFiletype('scss') +call TestFiletype('sh') +call TestFiletype('zsh') +call TestFiletype('slim') +call TestFiletype('slime') +call TestFiletype('smt2') +call TestFiletype('solidity') +call TestFiletype('stylus') +call TestFiletype('svelte') +call TestFiletype('svg') +call TestFiletype('swift') +call TestFiletype('sxhkdrc') +call TestFiletype('systemd') +call TestFiletype('terraform') +call TestFiletype('textile') +call TestFiletype('thrift') +call TestFiletype('tmux') +call TestFiletype('toml') +call TestFiletype('tptp') +call TestFiletype('html.twig') +call TestFiletype('xml.twig') +call TestFiletype('typescript') +call TestFiletype('typescriptreact') +call TestFiletype('unison') +call TestFiletype('v') +call TestFiletype('vala') +call TestFiletype('vbnet') +call TestFiletype('vcl') +call TestFiletype('velocity') +call TestFiletype('vmasm') +call TestFiletype('vue') +call TestFiletype('xdc') +call TestFiletype('xsl') +call TestFiletype('yaml') +call TestFiletype('yaml.ansible') +call TestFiletype('helm') +call TestFiletype('help') +call TestFiletype('zephir') +call TestFiletype('zir') +call TestFiletype('zig') +call TestFiletype('trasys') +call TestFiletype('basic') +call TestFiletype('vb') +call TestFiletype('dosini') +call TestFiletype('odin') +call TestFiletype('bzl') +call TestFiletype('prolog') +call TestFiletype('tads') -- cgit v1.2.3