Mercurial > vim
annotate src/testdir/test_findfile.vim @ 32313:6761c71f4b25 v9.0.1488
patch 9.0.1488: xchacha20v2 crypt header is platform dependent
Commit: https://github.com/vim/vim/commit/35a2ec18d6560251e8164636bac6e21ea504648e
Author: ichizok <gclient.gaap@gmail.com>
Date: Tue Apr 25 15:27:27 2023 +0100
patch 9.0.1488: xchacha20v2 crypt header is platform dependent
Problem: xchacha20v2 crypt header is platform dependent.
Solution: Avoid using "size_t". (Ozaki Kiichi, closses https://github.com/vim/vim/issues/12296)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 25 Apr 2023 16:30:03 +0200 |
parents | a7a9e8b9af89 |
children | f55b953f59bd |
rev | line source |
---|---|
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
1 " Test findfile() and finddir() |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
2 |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
3 let s:files = [ 'Xfinddir1/foo', |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
4 \ 'Xfinddir1/bar', |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
5 \ 'Xfinddir1/Xdir2/foo', |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
6 \ 'Xfinddir1/Xdir2/foobar', |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
7 \ 'Xfinddir1/Xdir2/Xdir3/bar', |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
8 \ 'Xfinddir1/Xdir2/Xdir3/barfoo' ] |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
9 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
10 func CreateFiles() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
11 call mkdir('Xfinddir1/Xdir2/Xdir3/Xdir2', 'p') |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
12 for f in s:files |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
13 call writefile([], f) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
14 endfor |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
15 endfunc |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
16 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
17 func CleanFiles() |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
18 " Safer to delete each file even if it's more verbose |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
19 " than doing a recursive delete('Xfinddir1', 'rf'). |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
20 for f in s:files |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
21 call delete(f) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
22 endfor |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
23 |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
24 call delete('Xfinddir1/Xdir2/Xdir3/Xdir2', 'd') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
25 call delete('Xfinddir1/Xdir2/Xdir3', 'd') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
26 call delete('Xfinddir1/Xdir2', 'd') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
27 call delete('Xfinddir1', 'd') |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
28 endfunc |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
29 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
30 " Test findfile({name} [, {path} [, {count}]]) |
10940
a479b7064550
patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 func Test_findfile() |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
32 let save_path = &path |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
33 let save_shellslash = &shellslash |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
34 let save_dir = getcwd() |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
35 set shellslash |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
36 call CreateFiles() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
37 cd Xfinddir1 |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
38 e Xdir2/foo |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
39 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
40 " With ,, in path, findfile() searches in current directory. |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
41 set path=,, |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
42 call assert_equal('foo', findfile('foo')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
43 call assert_equal('bar', findfile('bar')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
44 call assert_equal('', findfile('foobar')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
45 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
46 " Directories should not be found (finddir() finds them). |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
47 call assert_equal('', findfile('Xdir2')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
48 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
49 " With . in 'path', findfile() searches relatively to current file. |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
50 set path=. |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
51 call assert_equal('Xdir2/foo', findfile('foo')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
52 call assert_equal('', findfile('bar')) |
17849
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
15736
diff
changeset
|
53 call assert_equal('Xdir2/foobar', 'foobar'->findfile()) |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
54 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
55 " Empty {path} 2nd argument is the same as no 2nd argument. |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
56 call assert_equal('Xdir2/foo', findfile('foo', '')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
57 call assert_equal('', findfile('bar', '')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
58 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
59 " Test with * |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
60 call assert_equal('Xdir2/foo', findfile('foo', '*')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
61 call assert_equal('', findfile('bar', '*')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
62 call assert_equal('Xdir2/Xdir3/bar', findfile('bar', '*/*')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
63 call assert_equal('Xdir2/Xdir3/bar', findfile('bar', 'Xdir2/*')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
64 call assert_equal('Xdir2/Xdir3/bar', findfile('bar', 'Xdir*/Xdir3')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
65 call assert_equal('Xdir2/Xdir3/bar', findfile('bar', '*2/*3')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
66 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
67 " Test with ** |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
68 call assert_equal('bar', findfile('bar', '**')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
69 call assert_equal('Xdir2/Xdir3/bar', findfile('bar', '**/Xdir3')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
70 call assert_equal('Xdir2/Xdir3/bar', findfile('bar', 'Xdir2/**')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
71 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
72 call assert_equal('Xdir2/Xdir3/barfoo', findfile('barfoo', '**2')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
73 call assert_equal('', findfile('barfoo', '**1')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
74 call assert_equal('Xdir2/foobar', findfile('foobar', '**1')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
75 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
76 " Test with {count} 3rd argument. |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
77 call assert_equal('bar', findfile('bar', '**', 0)) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
78 call assert_equal('bar', findfile('bar', '**', 1)) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
79 call assert_equal('Xdir2/Xdir3/bar', findfile('bar', '**', 2)) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
80 call assert_equal('', findfile('bar', '**', 3)) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
81 call assert_equal(['bar', 'Xdir2/Xdir3/bar'], findfile('bar', '**', -1)) |
10940
a479b7064550
patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
83 " Test upwards search. |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
84 cd Xdir2/Xdir3 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
85 call assert_equal('bar', findfile('bar', ';')) |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
86 call assert_match('.*/Xfinddir1/Xdir2/foo', findfile('foo', ';')) |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
87 call assert_match('.*/Xfinddir1/Xdir2/foo', findfile('foo', ';', 1)) |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
88 call assert_match('.*/Xfinddir1/foo', findfile('foo', ';', 2)) |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
89 call assert_match('.*/Xfinddir1/foo', findfile('foo', ';', 2)) |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
90 call assert_match('.*/Xfinddir1/Xdir2/foo', findfile('foo', 'Xdir2;', 1)) |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
91 call assert_equal('', findfile('foo', 'Xdir2;', 2)) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
92 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
93 " List l should have at least 2 values (possibly more if foo file |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
94 " happens to be found upwards above Xfinddir1). |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
95 let l = findfile('foo', ';', -1) |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
96 call assert_match('.*/Xfinddir1/Xdir2/foo', l[0]) |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
97 call assert_match('.*/Xfinddir1/foo', l[1]) |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
98 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
99 " Test upwards search with stop-directory. |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
100 cd Xdir2 |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
101 let l = findfile('bar', ';' . save_dir . '/Xfinddir1/Xdir2/', -1) |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
102 call assert_equal(1, len(l)) |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
103 call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
104 |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
105 let l = findfile('bar', ';' . save_dir . '/Xfinddir1/', -1) |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
106 call assert_equal(2, len(l)) |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
107 call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
108 call assert_match('.*/Xfinddir1/bar', l[1]) |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
109 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
110 " Test combined downwards and upwards search from Xdir2/. |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
111 cd ../.. |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
112 call assert_equal('Xdir3/bar', findfile('bar', '**;', 1)) |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
113 call assert_match('.*/Xfinddir1/bar', findfile('bar', '**;', 2)) |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
114 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
115 bwipe! |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
116 call chdir(save_dir) |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
117 call CleanFiles() |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
118 let &path = save_path |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
119 let &shellslash = save_shellslash |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
120 endfunc |
10940
a479b7064550
patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
121 |
15736
6839f99d2269
patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents:
15689
diff
changeset
|
122 func Test_findfile_error() |
6839f99d2269
patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents:
15689
diff
changeset
|
123 call assert_fails('call findfile([])', 'E730:') |
6839f99d2269
patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents:
15689
diff
changeset
|
124 call assert_fails('call findfile("x", [])', 'E730:') |
6839f99d2269
patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents:
15689
diff
changeset
|
125 call assert_fails('call findfile("x", "", [])', 'E745:') |
6839f99d2269
patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents:
15689
diff
changeset
|
126 call assert_fails('call findfile("x", "**x")', 'E343:') |
6839f99d2269
patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents:
15689
diff
changeset
|
127 call assert_fails('call findfile("x", repeat("x", 5000))', 'E854:') |
6839f99d2269
patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents:
15689
diff
changeset
|
128 endfunc |
6839f99d2269
patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents:
15689
diff
changeset
|
129 |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
130 " Test finddir({name} [, {path} [, {count}]]) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
131 func Test_finddir() |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
132 let save_path = &path |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
133 let save_shellslash = &shellslash |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
134 let save_dir = getcwd() |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
135 set path=,, |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
136 call CreateFiles() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
137 cd Xfinddir1 |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
138 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
139 call assert_equal('Xdir2', finddir('Xdir2')) |
17849
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
15736
diff
changeset
|
140 call assert_equal('', 'Xdir3'->finddir()) |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
141 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
142 " Files should not be found (findfile() finds them). |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
143 call assert_equal('', finddir('foo')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
144 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
145 call assert_equal('Xdir2', finddir('Xdir2', '**')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
146 call assert_equal('Xdir2/Xdir3', finddir('Xdir3', '**')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
147 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
148 call assert_equal('Xdir2', finddir('Xdir2', '**', 1)) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
149 call assert_equal('Xdir2/Xdir3/Xdir2', finddir('Xdir2', '**', 2)) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
150 call assert_equal(['Xdir2', |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
151 \ 'Xdir2/Xdir3/Xdir2'], finddir('Xdir2', '**', -1)) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
152 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
153 call assert_equal('Xdir2', finddir('Xdir2', '**1')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
154 call assert_equal('Xdir2', finddir('Xdir2', '**0')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
155 call assert_equal('Xdir2/Xdir3', finddir('Xdir3', '**1')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
156 call assert_equal('', finddir('Xdir3', '**0')) |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
157 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
158 " Test upwards dir search. |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
159 cd Xdir2/Xdir3 |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
160 call assert_match('.*/Xfinddir1', finddir('Xfinddir1', ';')) |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
161 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
162 " Test upwards search with stop-directory. |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
163 call assert_match('.*/Xfinddir1', finddir('Xfinddir1', ';' . save_dir . '/')) |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
164 call assert_equal('', finddir('Xfinddir1', ';' . save_dir . '/Xfinddir1/')) |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
165 |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
166 " Test combined downwards and upwards dir search from Xdir2/. |
10940
a479b7064550
patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 cd .. |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
168 call assert_match('.*/Xfinddir1', finddir('Xfinddir1', '**;', 1)) |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
169 call assert_equal('Xdir3/Xdir2', finddir('Xdir2', '**;', 1)) |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
170 call assert_match('.*/Xfinddir1/Xdir2', finddir('Xdir2', '**;', 2)) |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
171 call assert_equal('Xdir3', finddir('Xdir3', '**;', 1)) |
10940
a479b7064550
patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
172 |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
173 call chdir(save_dir) |
15689
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
174 call CleanFiles() |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
175 let &path = save_path |
977a05589b65
patch 8.1.0852: findfile() and finddir() are not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
10940
diff
changeset
|
176 let &shellslash = save_shellslash |
10940
a479b7064550
patch 8.0.0359: 'number' and 'relativenumber' are not properly tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 endfunc |
15736
6839f99d2269
patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents:
15689
diff
changeset
|
178 |
6839f99d2269
patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents:
15689
diff
changeset
|
179 func Test_finddir_error() |
6839f99d2269
patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents:
15689
diff
changeset
|
180 call assert_fails('call finddir([])', 'E730:') |
6839f99d2269
patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents:
15689
diff
changeset
|
181 call assert_fails('call finddir("x", [])', 'E730:') |
6839f99d2269
patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents:
15689
diff
changeset
|
182 call assert_fails('call finddir("x", "", [])', 'E745:') |
6839f99d2269
patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents:
15689
diff
changeset
|
183 call assert_fails('call finddir("x", "**x")', 'E343:') |
6839f99d2269
patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents:
15689
diff
changeset
|
184 call assert_fails('call finddir("x", repeat("x", 5000))', 'E854:') |
6839f99d2269
patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents:
15689
diff
changeset
|
185 endfunc |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
186 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
187 " Test for the :find, :sfind and :tabfind commands |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
188 func Test_find_cmd() |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
189 new |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
190 let save_path = &path |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
191 let save_dir = getcwd() |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
192 set path=.,./**/* |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
193 call CreateFiles() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
25364
diff
changeset
|
194 cd Xfinddir1 |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
195 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
196 " Test for :find |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
197 find foo |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
198 call assert_equal('foo', expand('%:.')) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
199 2find foo |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
200 call assert_equal('Xdir2/foo', expand('%:.')) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
201 call assert_fails('3find foo', 'E347:') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
202 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
203 " Test for :sfind |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
204 enew |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
205 sfind barfoo |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
206 call assert_equal('Xdir2/Xdir3/barfoo', expand('%:.')) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
207 call assert_equal(3, winnr('$')) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
208 close |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
209 call assert_fails('sfind baz', 'E345:') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
210 call assert_equal(2, winnr('$')) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
211 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
212 " Test for :tabfind |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
213 enew |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
214 tabfind foobar |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
215 call assert_equal('Xdir2/foobar', expand('%:.')) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
216 call assert_equal(2, tabpagenr('$')) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
217 tabclose |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
218 call assert_fails('tabfind baz', 'E345:') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
219 call assert_equal(1, tabpagenr('$')) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
220 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
221 call chdir(save_dir) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
222 call CleanFiles() |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
223 let &path = save_path |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
224 close |
19701
9412cc889072
patch 8.2.0407: no early check if :find and :sfind have an argument
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
225 |
9412cc889072
patch 8.2.0407: no early check if :find and :sfind have an argument
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
226 call assert_fails('find', 'E471:') |
9412cc889072
patch 8.2.0407: no early check if :find and :sfind have an argument
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
227 call assert_fails('sfind', 'E471:') |
9412cc889072
patch 8.2.0407: no early check if :find and :sfind have an argument
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
228 call assert_fails('tabfind', 'E471:') |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
229 endfunc |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
19701
diff
changeset
|
230 |
25364
af5c4fabcf40
patch 8.2.3219: :find searches non-existing directories
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
231 func Test_find_non_existing_path() |
af5c4fabcf40
patch 8.2.3219: :find searches non-existing directories
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
232 new |
af5c4fabcf40
patch 8.2.3219: :find searches non-existing directories
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
233 let save_path = &path |
af5c4fabcf40
patch 8.2.3219: :find searches non-existing directories
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
234 let save_dir = getcwd() |
30552
a7a9e8b9af89
patch 9.0.0611: tests delete files with a separate delete() call
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
235 call mkdir('dir1/dir2', 'pR') |
25364
af5c4fabcf40
patch 8.2.3219: :find searches non-existing directories
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
236 call writefile([], 'dir1/file.txt') |
af5c4fabcf40
patch 8.2.3219: :find searches non-existing directories
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
237 call writefile([], 'dir1/dir2/base.txt') |
af5c4fabcf40
patch 8.2.3219: :find searches non-existing directories
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
238 call chdir('dir1/dir2') |
af5c4fabcf40
patch 8.2.3219: :find searches non-existing directories
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
239 e base.txt |
af5c4fabcf40
patch 8.2.3219: :find searches non-existing directories
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
240 set path=../include |
af5c4fabcf40
patch 8.2.3219: :find searches non-existing directories
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
241 |
af5c4fabcf40
patch 8.2.3219: :find searches non-existing directories
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
242 call assert_fails(':find file.txt', 'E345:') |
af5c4fabcf40
patch 8.2.3219: :find searches non-existing directories
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
243 |
af5c4fabcf40
patch 8.2.3219: :find searches non-existing directories
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
244 call chdir(save_dir) |
af5c4fabcf40
patch 8.2.3219: :find searches non-existing directories
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
245 bw! |
af5c4fabcf40
patch 8.2.3219: :find searches non-existing directories
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
246 let &path = save_path |
af5c4fabcf40
patch 8.2.3219: :find searches non-existing directories
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
247 endfunc |
af5c4fabcf40
patch 8.2.3219: :find searches non-existing directories
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
248 |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
19701
diff
changeset
|
249 " vim: shiftwidth=2 sts=2 expandtab |