Bram Moolenaar | 058bdcf | 2012-07-25 13:46:30 +0200 | [diff] [blame^] | 1 | Tests for: |
| 2 | - "gf" on ${VAR}, |
| 3 | - ":checkpath!" with various 'include' settings. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4 | |
| 5 | STARTTEST |
| 6 | :so small.vim |
| 7 | :if has("ebcdic") |
| 8 | : set isfname=@,240-249,/,.,-,_,+,,,$,:,~,{,} |
| 9 | :else |
| 10 | : set isfname=@,48-57,/,.,-,_,+,,,$,:,~,{,} |
| 11 | :endif |
| 12 | :if has("unix") |
| 13 | :let $CDIR = "." |
| 14 | /CDIR |
| 15 | :else |
| 16 | :if has("amiga") |
| 17 | :let $TDIR = "/testdir" |
| 18 | :else |
| 19 | :let $TDIR = "." |
| 20 | :endif |
| 21 | /TDIR |
| 22 | :endif |
| 23 | gf |
| 24 | :w! test.out |
Bram Moolenaar | 058bdcf | 2012-07-25 13:46:30 +0200 | [diff] [blame^] | 25 | :brewind |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 26 | ENDTEST |
| 27 | |
| 28 | ${CDIR}/test17a.in |
| 29 | $TDIR/test17a.in |
Bram Moolenaar | 058bdcf | 2012-07-25 13:46:30 +0200 | [diff] [blame^] | 30 | |
| 31 | STARTTEST |
| 32 | :" check for 'include' without \zs or \ze |
| 33 | :lang C |
| 34 | :!rm -f ./Xbase.a |
| 35 | :!rm -rf ./Xdir1 |
| 36 | :!mkdir -p Xdir1/dir2 |
| 37 | :e Xdir1/dir2/foo.a |
| 38 | i#include "bar.a" |
| 39 | :w |
| 40 | :e Xdir1/dir2/bar.a |
| 41 | i#include "baz.a" |
| 42 | :w |
| 43 | :e Xdir1/dir2/baz.a |
| 44 | i#include "foo.a" |
| 45 | :w |
| 46 | :e Xbase.a |
| 47 | :set path=Xdir1/dir2 |
| 48 | i#include <foo.a> |
| 49 | :w |
| 50 | :redir! >>test.out |
| 51 | :checkpath! |
| 52 | :redir END |
| 53 | :brewind |
| 54 | ENDTEST |
| 55 | |
| 56 | STARTTEST |
| 57 | :" check for 'include' with \zs and \ze |
| 58 | :!rm -f ./Xbase.b |
| 59 | :!rm -rf ./Xdir1 |
| 60 | :!mkdir -p Xdir1/dir2 |
| 61 | :let &include='^\s*%inc\s*/\zs[^/]\+\ze' |
| 62 | :function! DotsToSlashes() |
| 63 | : return substitute(v:fname, '\.', '/', 'g') . '.b' |
| 64 | :endfunction |
| 65 | :let &includeexpr='DotsToSlashes()' |
| 66 | :e Xdir1/dir2/foo.b |
| 67 | i%inc /bar/ |
| 68 | :w |
| 69 | :e Xdir1/dir2/bar.b |
| 70 | i%inc /baz/ |
| 71 | :w |
| 72 | :e Xdir1/dir2/baz.b |
| 73 | i%inc /foo/ |
| 74 | :w |
| 75 | :e Xbase.b |
| 76 | :set path=Xdir1/dir2 |
| 77 | i%inc /foo/ |
| 78 | :w |
| 79 | :redir! >>test.out |
| 80 | :checkpath! |
| 81 | :redir END |
| 82 | :brewind |
| 83 | ENDTEST |
| 84 | |
| 85 | STARTTEST |
| 86 | :" check for 'include' with \zs and no \ze |
| 87 | :!rm -f ./Xbase.c |
| 88 | :!rm -rf ./Xdir1 |
| 89 | :!mkdir -p Xdir1/dir2 |
| 90 | :let &include='^\s*%inc\s*\%([[:upper:]][^[:space:]]*\s\+\)\?\zs\S\+\ze' |
| 91 | :function! StripNewlineChar() |
| 92 | : if v:fname =~ '\n$' |
| 93 | : return v:fname[:-2] |
| 94 | : endif |
| 95 | : return v:fname |
| 96 | :endfunction |
| 97 | :let &includeexpr='StripNewlineChar()' |
| 98 | :e Xdir1/dir2/foo.c |
| 99 | i%inc bar.c |
| 100 | :w |
| 101 | :e Xdir1/dir2/bar.c |
| 102 | i%inc baz.c |
| 103 | :w |
| 104 | :e Xdir1/dir2/baz.c |
| 105 | i%inc foo.c |
| 106 | :w |
| 107 | :e Xdir1/dir2/FALSE.c |
| 108 | i%inc foo.c |
| 109 | :w |
| 110 | :e Xbase.c |
| 111 | :set path=Xdir1/dir2 |
| 112 | i%inc FALSE.c foo.c |
| 113 | :w |
| 114 | :redir! >>test.out |
| 115 | :checkpath! |
| 116 | :redir END |
| 117 | :brewind |
| 118 | :q |
| 119 | ENDTEST |
| 120 | |