diff options
-rw-r--r-- | runtime/filetype.vim | 4 | ||||
-rw-r--r-- | src/nvim/testdir/Makefile | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test17.in | 126 | ||||
-rw-r--r-- | src/nvim/testdir/test17.ok | 33 | ||||
-rw-r--r-- | src/nvim/testdir/test17a.in | 3 | ||||
-rw-r--r-- | src/nvim/testdir/test_checkpath.vim | 113 | ||||
-rw-r--r-- | src/nvim/testdir/test_filetype.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_gf.vim | 35 | ||||
-rw-r--r-- | src/nvim/testdir/test_quickfix.vim | 3 | ||||
-rw-r--r-- | src/nvim/testdir/test_tabpage.vim | 2 |
10 files changed, 155 insertions, 167 deletions
diff --git a/runtime/filetype.vim b/runtime/filetype.vim index fc6c575b99..a670f54898 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -707,8 +707,8 @@ au BufNewFile,BufRead *.erb,*.rhtml setf eruby " HTML with M4 au BufNewFile,BufRead *.html.m4 setf htmlm4 -" HTML Cheetah template -au BufNewFile,BufRead *.tmpl setf htmlcheetah +" Some template. Used to be HTML Cheetah. +au BufNewFile,BufRead *.tmpl setf template " Host config au BufNewFile,BufRead */etc/host.conf setf hostconf diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 2535a51b88..8ea2689939 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -22,7 +22,6 @@ SCRIPTS_DEFAULT = \ ifneq ($(OS),Windows_NT) SCRIPTS_DEFAULTS := $(SCRIPTS_DEFAULT) \ - test17.out \ test49.out \ endif diff --git a/src/nvim/testdir/test17.in b/src/nvim/testdir/test17.in deleted file mode 100644 index 1a4ac6b6d1..0000000000 --- a/src/nvim/testdir/test17.in +++ /dev/null @@ -1,126 +0,0 @@ -Tests for: -- "gf" on ${VAR}, -- ":checkpath!" with various 'include' settings. - -STARTTEST -:set isfname=@,48-57,/,.,-,_,+,,,$,:,~,{,} -:" -:if has("unix") -:let $CDIR = "." -/CDIR -:else -:let $TDIR = "." -/TDIR -:endif -:" Dummy writing for making that sure gf doesn't fail even if the current -:" file is modified. It can be occurred when executing the following command -:" directly on Windows without fixing the 'fileformat': -:" > nmake -f Make_dos.mak test17.out -:w! test.out -gf -:set ff=unix -:w! test.out -:brewind -ENDTEST - - ${CDIR}/test17a.in - $TDIR/test17a.in - -STARTTEST -:" check for 'include' without \zs or \ze -:lang C -:call delete("./Xbase.a") -:call delete("Xdir1", "rf") -:!mkdir Xdir1 -:!mkdir "Xdir1/dir2" -:e! Xdir1/dir2/foo.a -i#include "bar.a": -:w -:e Xdir1/dir2/bar.a -i#include "baz.a": -:w -:e Xdir1/dir2/baz.a -i#include "foo.a": -:w -:e Xbase.a -:set path=Xdir1/dir2 -i#include <foo.a>: -:w -:redir! >>test.out -:checkpath! -:redir END -:brewind -ENDTEST - -STARTTEST -:" check for 'include' with \zs and \ze -:call delete("./Xbase.b") -:call delete("Xdir1", "rf") -:!mkdir Xdir1 -:!mkdir "Xdir1/dir2" -:let &include='^\s*%inc\s*/\zs[^/]\+\ze' -:function! DotsToSlashes() -: return substitute(v:fname, '\.', '/', 'g') . '.b' -:endfunction -:let &includeexpr='DotsToSlashes()' -:e! Xdir1/dir2/foo.b -i%inc /bar/: -:w -:e Xdir1/dir2/bar.b -i%inc /baz/: -:w -:e Xdir1/dir2/baz.b -i%inc /foo/: -:w -:e Xbase.b -:set path=Xdir1/dir2 -i%inc /foo/: -:w -:redir! >>test.out -:checkpath! -:redir END -:brewind -ENDTEST - -STARTTEST -:" check for 'include' with \zs and no \ze -:call delete("./Xbase.c") -:call delete("Xdir1", "rf") -:!mkdir Xdir1 -:!mkdir "Xdir1/dir2" -:let &include='^\s*%inc\s*\%([[:upper:]][^[:space:]]*\s\+\)\?\zs\S\+\ze' -:function! StripNewlineChar() -: if v:fname =~ '\n$' -: return v:fname[:-2] -: endif -: return v:fname -:endfunction -:let &includeexpr='StripNewlineChar()' -:e! Xdir1/dir2/foo.c -i%inc bar.c: -:w -:e Xdir1/dir2/bar.c -i%inc baz.c: -:w -:e Xdir1/dir2/baz.c -i%inc foo.c: -:w -:e Xdir1/dir2/FALSE.c -i%inc foo.c: -:w -:e Xbase.c -:set path=Xdir1/dir2 -i%inc FALSE.c foo.c: -:w -:redir! >>test.out -:checkpath! -:redir END -:brewind -:" change "\" to "/" for Windows and fix 'fileformat' -:e test.out -:%s#\\#/#g -:set ff& -:w -:q -ENDTEST - diff --git a/src/nvim/testdir/test17.ok b/src/nvim/testdir/test17.ok deleted file mode 100644 index b2a66d5f85..0000000000 --- a/src/nvim/testdir/test17.ok +++ /dev/null @@ -1,33 +0,0 @@ -This file is just to test "gf" in test 17. -The contents is not important. -Just testing! - - ---- Included files in path --- -Xdir1/dir2/foo.a -Xdir1/dir2/foo.a --> - Xdir1/dir2/bar.a - Xdir1/dir2/bar.a --> - Xdir1/dir2/baz.a - Xdir1/dir2/baz.a --> - "foo.a" (Already listed) - - ---- Included files in path --- -Xdir1/dir2/foo.b -Xdir1/dir2/foo.b --> - Xdir1/dir2/bar.b - Xdir1/dir2/bar.b --> - Xdir1/dir2/baz.b - Xdir1/dir2/baz.b --> - foo (Already listed) - - ---- Included files in path --- -Xdir1/dir2/foo.c -Xdir1/dir2/foo.c --> - Xdir1/dir2/bar.c - Xdir1/dir2/bar.c --> - Xdir1/dir2/baz.c - Xdir1/dir2/baz.c --> - foo.c (Already listed) diff --git a/src/nvim/testdir/test17a.in b/src/nvim/testdir/test17a.in deleted file mode 100644 index 7e89364797..0000000000 --- a/src/nvim/testdir/test17a.in +++ /dev/null @@ -1,3 +0,0 @@ -This file is just to test "gf" in test 17. -The contents is not important. -Just testing! diff --git a/src/nvim/testdir/test_checkpath.vim b/src/nvim/testdir/test_checkpath.vim new file mode 100644 index 0000000000..a7557a107d --- /dev/null +++ b/src/nvim/testdir/test_checkpath.vim @@ -0,0 +1,113 @@ +" Tests for the :checkpath command + +" Test for 'include' without \zs or \ze +func Test_checkpath1() + let save_shellslash = &shellslash + set shellslash + call mkdir("Xdir1/dir2", "p") + call writefile(['#include "bar.a"'], 'Xdir1/dir2/foo.a') + call writefile(['#include "baz.a"'], 'Xdir1/dir2/bar.a') + call writefile(['#include "foo.a"'], 'Xdir1/dir2/baz.a') + call writefile(['#include <foo.a>'], 'Xbase.a') + + edit Xbase.a + set path=Xdir1/dir2 + let res = split(execute("checkpath!"), "\n") + call assert_equal([ + \ '--- Included files in path ---', + \ 'Xdir1/dir2/foo.a', + \ 'Xdir1/dir2/foo.a -->', + \ ' Xdir1/dir2/bar.a', + \ ' Xdir1/dir2/bar.a -->', + \ ' Xdir1/dir2/baz.a', + \ ' Xdir1/dir2/baz.a -->', + \ ' "foo.a" (Already listed)'], res) + + enew + call delete("./Xbase.a") + call delete("Xdir1", "rf") + set path& + let &shellslash = save_shellslash +endfunc + +func DotsToSlashes() + return substitute(v:fname, '\.', '/', 'g') . '.b' +endfunc + +" Test for 'include' with \zs and \ze +func Test_checkpath2() + let save_shellslash = &shellslash + set shellslash + call mkdir("Xdir1/dir2", "p") + call writefile(['%inc /bar/'], 'Xdir1/dir2/foo.b') + call writefile(['%inc /baz/'], 'Xdir1/dir2/bar.b') + call writefile(['%inc /foo/'], 'Xdir1/dir2/baz.b') + call writefile(['%inc /foo/'], 'Xbase.b') + + let &include='^\s*%inc\s*/\zs[^/]\+\ze' + let &includeexpr='DotsToSlashes()' + + edit Xbase.b + set path=Xdir1/dir2 + let res = split(execute("checkpath!"), "\n") + call assert_equal([ + \ '--- Included files in path ---', + \ 'Xdir1/dir2/foo.b', + \ 'Xdir1/dir2/foo.b -->', + \ ' Xdir1/dir2/bar.b', + \ ' Xdir1/dir2/bar.b -->', + \ ' Xdir1/dir2/baz.b', + \ ' Xdir1/dir2/baz.b -->', + \ ' foo (Already listed)'], res) + + enew + call delete("./Xbase.b") + call delete("Xdir1", "rf") + set path& + set include& + set includeexpr& + let &shellslash = save_shellslash +endfunc + +func StripNewlineChar() + if v:fname =~ '\n$' + return v:fname[:-2] + endif + return v:fname +endfunc + +" Test for 'include' with \zs and no \ze +func Test_checkpath3() + let save_shellslash = &shellslash + set shellslash + call mkdir("Xdir1/dir2", "p") + call writefile(['%inc bar.c'], 'Xdir1/dir2/foo.c') + call writefile(['%inc baz.c'], 'Xdir1/dir2/bar.c') + call writefile(['%inc foo.c'], 'Xdir1/dir2/baz.c') + call writefile(['%inc foo.c'], 'Xdir1/dir2/FALSE.c') + call writefile(['%inc FALSE.c foo.c'], 'Xbase.c') + + let &include='^\s*%inc\s*\%([[:upper:]][^[:space:]]*\s\+\)\?\zs\S\+\ze' + let &includeexpr='StripNewlineChar()' + + edit Xbase.c + set path=Xdir1/dir2 + let res = split(execute("checkpath!"), "\n") + call assert_equal([ + \ '--- Included files in path ---', + \ 'Xdir1/dir2/foo.c', + \ 'Xdir1/dir2/foo.c -->', + \ ' Xdir1/dir2/bar.c', + \ ' Xdir1/dir2/bar.c -->', + \ ' Xdir1/dir2/baz.c', + \ ' Xdir1/dir2/baz.c -->', + \ ' foo.c (Already listed)'], res) + + enew + call delete("./Xbase.c") + call delete("Xdir1", "rf") + set path& + set include& + set includeexpr& + let &shellslash = save_shellslash +endfunc diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index 95b05295ca..7a99a37be4 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -200,7 +200,7 @@ let s:filename_checks = { \ 'hog': ['file.hog', 'snort.conf', 'vision.conf'], \ 'hostconf': ['/etc/host.conf'], \ 'hostsaccess': ['/etc/hosts.allow', '/etc/hosts.deny'], - \ 'htmlcheetah': ['file.tmpl'], + \ 'template': ['file.tmpl'], \ 'htmlm4': ['file.html.m4'], \ 'httest': ['file.htt', 'file.htb'], \ 'ibasic': ['file.iba', 'file.ibi'], diff --git a/src/nvim/testdir/test_gf.vim b/src/nvim/testdir/test_gf.vim index d233046d2b..accd21e9a3 100644 --- a/src/nvim/testdir/test_gf.vim +++ b/src/nvim/testdir/test_gf.vim @@ -64,3 +64,38 @@ func Test_gF() bwipe Xfile bwipe Xfile2 endfunc + +" Test for invoking 'gf' on a ${VAR} variable +func Test_gf() + if has("ebcdic") + set isfname=@,240-249,/,.,-,_,+,,,$,:,~,{,} + else + set isfname=@,48-57,/,.,-,_,+,,,$,:,~,{,} + endif + + call writefile(["Test for gf command"], "Xtest1") + if has("unix") + call writefile([" ${CDIR}/Xtest1"], "Xtestgf") + else + call writefile([" $TDIR/Xtest1"], "Xtestgf") + endif + new Xtestgf + if has("unix") + let $CDIR = "." + /CDIR + else + if has("amiga") + let $TDIR = "/testdir" + else + let $TDIR = "." + endif + /TDIR + endif + + normal gf + call assert_equal('Xtest1', fnamemodify(bufname(''), ":t")) + close! + + call delete('Xtest1') + call delete('Xtestgf') +endfunc diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index a5845c5206..c6d083dfcc 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -137,6 +137,8 @@ func XlistTests(cchar) \ ' 5:50 col 25 55: one'], l) " Test for module names, one needs to explicitly set `'valid':v:true` so + let save_shellslash = &shellslash + set shellslash call g:Xsetlist([ \ {'lnum':10,'col':5,'type':'W','module':'Data.Text','text':'ModuleWarning','nr':11,'valid':v:true}, \ {'lnum':20,'col':10,'type':'W','module':'Data.Text','filename':'Data/Text.hs','text':'ModuleWarning','nr':22,'valid':v:true}, @@ -145,6 +147,7 @@ func XlistTests(cchar) call assert_equal([' 1 Data.Text:10 col 5 warning 11: ModuleWarning', \ ' 2 Data.Text:20 col 10 warning 22: ModuleWarning', \ ' 3 Data/Text.hs:30 col 15 warning 33: FileWarning'], l) + let &shellslash = save_shellslash " Error cases call assert_fails('Xlist abc', 'E488:') diff --git a/src/nvim/testdir/test_tabpage.vim b/src/nvim/testdir/test_tabpage.vim index 3c26717b96..8043d13433 100644 --- a/src/nvim/testdir/test_tabpage.vim +++ b/src/nvim/testdir/test_tabpage.vim @@ -576,7 +576,7 @@ func Test_tabpage_cmdheight() call VerifyScreenDump(buf, 'Test_tabpage_cmdheight', {}) call StopVimInTerminal(buf) - call delete('XTest_conceal') + call delete('XTest_tabpage_cmdheight') endfunc " vim: shiftwidth=2 sts=2 expandtab |