annotate src/testdir/test_checkpath.vim @ 24735:e5beb841778d v8.2.2906

patch 8.2.2906: ASAN reports errors for test_startup Commit: https://github.com/vim/vim/commit/a5787c3742b43a8e662045a4e38c7a6ba957acbf Author: Bram Moolenaar <Bram@vim.org> Date: Sat May 29 22:25:17 2021 +0200 patch 8.2.2906: ASAN reports errors for test_startup Problem: ASAN reports errors for test_startup for unknown reasons. Solution: Temporarily disable the new test.
author Bram Moolenaar <Bram@vim.org>
date Sat, 29 May 2021 22:30:04 +0200
parents 595ea7f099cd
children d891115c0aea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16564
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Tests for the :checkpath command
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Test for 'include' without \zs or \ze
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 func Test_checkpath1()
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 call mkdir("Xdir1/dir2", "p")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 call writefile(['#include "bar.a"'], 'Xdir1/dir2/foo.a')
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 call writefile(['#include "baz.a"'], 'Xdir1/dir2/bar.a')
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 call writefile(['#include "foo.a"'], 'Xdir1/dir2/baz.a')
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 call writefile(['#include <foo.a>'], 'Xbase.a')
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 edit Xbase.a
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 set path=Xdir1/dir2
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 let res = split(execute("checkpath!"), "\n")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 call assert_equal([
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 \ '--- Included files in path ---',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 \ 'Xdir1/dir2/foo.a',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 \ 'Xdir1/dir2/foo.a -->',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 \ ' Xdir1/dir2/bar.a',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 \ ' Xdir1/dir2/bar.a -->',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 \ ' Xdir1/dir2/baz.a',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 \ ' Xdir1/dir2/baz.a -->',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 \ ' "foo.a" (Already listed)'], res)
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 enew
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 call delete("./Xbase.a")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 call delete("Xdir1", "rf")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 set path&
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 endfunc
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 func DotsToSlashes()
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 return substitute(v:fname, '\.', '/', 'g') . '.b'
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 endfunc
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 " Test for 'include' with \zs and \ze
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 func Test_checkpath2()
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 call mkdir("Xdir1/dir2", "p")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 call writefile(['%inc /bar/'], 'Xdir1/dir2/foo.b')
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 call writefile(['%inc /baz/'], 'Xdir1/dir2/bar.b')
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 call writefile(['%inc /foo/'], 'Xdir1/dir2/baz.b')
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 call writefile(['%inc /foo/'], 'Xbase.b')
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 let &include='^\s*%inc\s*/\zs[^/]\+\ze'
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 let &includeexpr='DotsToSlashes()'
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 edit Xbase.b
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 set path=Xdir1/dir2
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 let res = split(execute("checkpath!"), "\n")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 call assert_equal([
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 \ '--- Included files in path ---',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 \ 'Xdir1/dir2/foo.b',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 \ 'Xdir1/dir2/foo.b -->',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 \ ' Xdir1/dir2/bar.b',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 \ ' Xdir1/dir2/bar.b -->',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 \ ' Xdir1/dir2/baz.b',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 \ ' Xdir1/dir2/baz.b -->',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 \ ' foo (Already listed)'], res)
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 enew
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 call delete("./Xbase.b")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 call delete("Xdir1", "rf")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 set path&
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 set include&
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 set includeexpr&
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 endfunc
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 func StripNewlineChar()
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 if v:fname =~ '\n$'
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 return v:fname[:-2]
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 endif
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 return v:fname
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 endfunc
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 " Test for 'include' with \zs and no \ze
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 func Test_checkpath3()
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 call mkdir("Xdir1/dir2", "p")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 call writefile(['%inc bar.c'], 'Xdir1/dir2/foo.c')
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 call writefile(['%inc baz.c'], 'Xdir1/dir2/bar.c')
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 call writefile(['%inc foo.c'], 'Xdir1/dir2/baz.c')
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 call writefile(['%inc foo.c'], 'Xdir1/dir2/FALSE.c')
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 call writefile(['%inc FALSE.c foo.c'], 'Xbase.c')
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 let &include='^\s*%inc\s*\%([[:upper:]][^[:space:]]*\s\+\)\?\zs\S\+\ze'
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 let &includeexpr='StripNewlineChar()'
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 edit Xbase.c
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 set path=Xdir1/dir2
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 let res = split(execute("checkpath!"), "\n")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 call assert_equal([
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 \ '--- Included files in path ---',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 \ 'Xdir1/dir2/foo.c',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 \ 'Xdir1/dir2/foo.c -->',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 \ ' Xdir1/dir2/bar.c',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 \ ' Xdir1/dir2/bar.c -->',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 \ ' Xdir1/dir2/baz.c',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 \ ' Xdir1/dir2/baz.c -->',
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 \ ' foo.c (Already listed)'], res)
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 enew
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 call delete("./Xbase.c")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 call delete("Xdir1", "rf")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 set path&
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 set include&
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 set includeexpr&
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 endfunc
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
105
22375
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
106 " Test for invalid regex in 'include' and 'define' options
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
107 func Test_checkpath_errors()
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
108 let save_include = &include
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
109 set include=\\%(
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
110 call assert_fails('checkpath', 'E53:')
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
111 let &include = save_include
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
112
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
113 let save_define = &define
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
114 set define=\\%(
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
115 call assert_fails('dsearch abc', 'E53:')
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
116 let &define = save_define
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
117
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
118 call assert_fails('psearch \%(', 'E53:')
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
119 endfunc
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
120
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
121 " vim: shiftwidth=2 sts=2 expandtab