2012-07-25 13:46:30 +02:00
|
|
|
|
Tests for:
|
|
|
|
|
|
- "gf" on ${VAR},
|
|
|
|
|
|
- ":checkpath!" with various 'include' settings.
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
|
|
|
STARTTEST
|
|
|
|
|
|
:so small.vim
|
|
|
|
|
|
:if has("ebcdic")
|
|
|
|
|
|
: set isfname=@,240-249,/,.,-,_,+,,,$,:,~,{,}
|
|
|
|
|
|
:else
|
|
|
|
|
|
: set isfname=@,48-57,/,.,-,_,+,,,$,:,~,{,}
|
|
|
|
|
|
:endif
|
2016-06-08 21:48:50 +02:00
|
|
|
|
:"
|
2004-06-13 20:20:40 +00:00
|
|
|
|
:if has("unix")
|
|
|
|
|
|
:let $CDIR = "."
|
|
|
|
|
|
/CDIR
|
|
|
|
|
|
:else
|
|
|
|
|
|
:if has("amiga")
|
|
|
|
|
|
:let $TDIR = "/testdir"
|
|
|
|
|
|
:else
|
|
|
|
|
|
:let $TDIR = "."
|
|
|
|
|
|
:endif
|
|
|
|
|
|
/TDIR
|
|
|
|
|
|
:endif
|
2013-06-19 21:17:31 +02:00
|
|
|
|
:" 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
|
2004-06-13 20:20:40 +00:00
|
|
|
|
gf
|
2013-07-03 22:28:36 +02:00
|
|
|
|
:set ff=unix
|
2004-06-13 20:20:40 +00:00
|
|
|
|
:w! test.out
|
2012-07-25 13:46:30 +02:00
|
|
|
|
:brewind
|
2004-06-13 20:20:40 +00:00
|
|
|
|
ENDTEST
|
|
|
|
|
|
|
|
|
|
|
|
${CDIR}/test17a.in
|
|
|
|
|
|
$TDIR/test17a.in
|
2012-07-25 13:46:30 +02:00
|
|
|
|
|
|
|
|
|
|
STARTTEST
|
|
|
|
|
|
:" check for 'include' without \zs or \ze
|
|
|
|
|
|
:lang C
|
2013-06-19 21:17:31 +02:00
|
|
|
|
:call delete("./Xbase.a")
|
2016-06-08 21:48:50 +02:00
|
|
|
|
:call delete("Xdir1", "rf")
|
2013-06-19 21:17:31 +02:00
|
|
|
|
:!mkdir Xdir1
|
|
|
|
|
|
:!mkdir "Xdir1/dir2"
|
|
|
|
|
|
:e! Xdir1/dir2/foo.a
|
2015-08-11 18:33:48 +02:00
|
|
|
|
i#include "bar.a":
|
2012-07-25 13:46:30 +02:00
|
|
|
|
:w
|
|
|
|
|
|
:e Xdir1/dir2/bar.a
|
2015-08-11 18:33:48 +02:00
|
|
|
|
i#include "baz.a":
|
2012-07-25 13:46:30 +02:00
|
|
|
|
:w
|
|
|
|
|
|
:e Xdir1/dir2/baz.a
|
2015-08-11 18:33:48 +02:00
|
|
|
|
i#include "foo.a":
|
2012-07-25 13:46:30 +02:00
|
|
|
|
:w
|
|
|
|
|
|
:e Xbase.a
|
|
|
|
|
|
:set path=Xdir1/dir2
|
2015-08-11 18:33:48 +02:00
|
|
|
|
i#include <foo.a>:
|
2012-07-25 13:46:30 +02:00
|
|
|
|
:w
|
|
|
|
|
|
:redir! >>test.out
|
|
|
|
|
|
:checkpath!
|
|
|
|
|
|
:redir END
|
|
|
|
|
|
:brewind
|
|
|
|
|
|
ENDTEST
|
|
|
|
|
|
|
|
|
|
|
|
STARTTEST
|
|
|
|
|
|
:" check for 'include' with \zs and \ze
|
2013-06-19 21:17:31 +02:00
|
|
|
|
:call delete("./Xbase.b")
|
2016-06-08 21:48:50 +02:00
|
|
|
|
:call delete("Xdir1", "rf")
|
2013-06-19 21:17:31 +02:00
|
|
|
|
:!mkdir Xdir1
|
|
|
|
|
|
:!mkdir "Xdir1/dir2"
|
2012-07-25 13:46:30 +02:00
|
|
|
|
:let &include='^\s*%inc\s*/\zs[^/]\+\ze'
|
|
|
|
|
|
:function! DotsToSlashes()
|
|
|
|
|
|
: return substitute(v:fname, '\.', '/', 'g') . '.b'
|
|
|
|
|
|
:endfunction
|
|
|
|
|
|
:let &includeexpr='DotsToSlashes()'
|
2013-06-19 21:17:31 +02:00
|
|
|
|
:e! Xdir1/dir2/foo.b
|
2015-08-11 18:33:48 +02:00
|
|
|
|
i%inc /bar/:
|
2012-07-25 13:46:30 +02:00
|
|
|
|
:w
|
|
|
|
|
|
:e Xdir1/dir2/bar.b
|
2015-08-11 18:33:48 +02:00
|
|
|
|
i%inc /baz/:
|
2012-07-25 13:46:30 +02:00
|
|
|
|
:w
|
|
|
|
|
|
:e Xdir1/dir2/baz.b
|
2015-08-11 18:33:48 +02:00
|
|
|
|
i%inc /foo/:
|
2012-07-25 13:46:30 +02:00
|
|
|
|
:w
|
|
|
|
|
|
:e Xbase.b
|
|
|
|
|
|
:set path=Xdir1/dir2
|
2015-08-11 18:33:48 +02:00
|
|
|
|
i%inc /foo/:
|
2012-07-25 13:46:30 +02:00
|
|
|
|
:w
|
|
|
|
|
|
:redir! >>test.out
|
|
|
|
|
|
:checkpath!
|
|
|
|
|
|
:redir END
|
|
|
|
|
|
:brewind
|
|
|
|
|
|
ENDTEST
|
|
|
|
|
|
|
|
|
|
|
|
STARTTEST
|
|
|
|
|
|
:" check for 'include' with \zs and no \ze
|
2013-06-19 21:17:31 +02:00
|
|
|
|
:call delete("./Xbase.c")
|
2016-06-08 21:48:50 +02:00
|
|
|
|
:call delete("Xdir1", "rf")
|
2013-06-19 21:17:31 +02:00
|
|
|
|
:!mkdir Xdir1
|
|
|
|
|
|
:!mkdir "Xdir1/dir2"
|
2012-07-25 13:46:30 +02:00
|
|
|
|
: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()'
|
2013-06-19 21:17:31 +02:00
|
|
|
|
:e! Xdir1/dir2/foo.c
|
2015-08-11 18:33:48 +02:00
|
|
|
|
i%inc bar.c:
|
2012-07-25 13:46:30 +02:00
|
|
|
|
:w
|
|
|
|
|
|
:e Xdir1/dir2/bar.c
|
2015-08-11 18:33:48 +02:00
|
|
|
|
i%inc baz.c:
|
2012-07-25 13:46:30 +02:00
|
|
|
|
:w
|
|
|
|
|
|
:e Xdir1/dir2/baz.c
|
2015-08-11 18:33:48 +02:00
|
|
|
|
i%inc foo.c:
|
2012-07-25 13:46:30 +02:00
|
|
|
|
:w
|
|
|
|
|
|
:e Xdir1/dir2/FALSE.c
|
2015-08-11 18:33:48 +02:00
|
|
|
|
i%inc foo.c:
|
2012-07-25 13:46:30 +02:00
|
|
|
|
:w
|
|
|
|
|
|
:e Xbase.c
|
|
|
|
|
|
:set path=Xdir1/dir2
|
2015-08-11 18:33:48 +02:00
|
|
|
|
i%inc FALSE.c foo.c:
|
2012-07-25 13:46:30 +02:00
|
|
|
|
:w
|
|
|
|
|
|
:redir! >>test.out
|
|
|
|
|
|
:checkpath!
|
|
|
|
|
|
:redir END
|
|
|
|
|
|
:brewind
|
2013-07-03 22:28:36 +02:00
|
|
|
|
:" change "\" to "/" for Windows and fix 'fileformat'
|
2013-06-19 21:17:31 +02:00
|
|
|
|
:e test.out
|
|
|
|
|
|
:%s#\\#/#g
|
2013-07-03 22:28:36 +02:00
|
|
|
|
:set ff&
|
2013-06-19 21:17:31 +02:00
|
|
|
|
:w
|
2012-07-25 13:46:30 +02:00
|
|
|
|
:q
|
|
|
|
|
|
ENDTEST
|
|
|
|
|
|
|