annotate src/testdir/test_checkpath.vim @ 29970:d891115c0aea v9.0.0323

patch 9.0.0323: using common name in tests leads to flaky tests Commit: https://github.com/vim/vim/commit/3b0d70f4ff436cb144683dafd956e8a3ee485a90 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 29 22:31:20 2022 +0100 patch 9.0.0323: using common name in tests leads to flaky tests Problem: Using common name in tests leads to flaky tests. Solution: Rename files and directories to be more specific.
author Bram Moolenaar <Bram@vim.org>
date Mon, 29 Aug 2022 23:45:04 +0200
parents 595ea7f099cd
children f7a2de8a4ddc
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()
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
5 call mkdir("Xcheckdir1/dir2", "p")
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
6 call writefile(['#include "bar.a"'], 'Xcheckdir1/dir2/foo.a')
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
7 call writefile(['#include "baz.a"'], 'Xcheckdir1/dir2/bar.a')
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
8 call writefile(['#include "foo.a"'], 'Xcheckdir1/dir2/baz.a')
16564
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
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
12 set path=Xcheckdir1/dir2
16564
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 ---',
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
16 \ 'Xcheckdir1/dir2/foo.a',
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
17 \ 'Xcheckdir1/dir2/foo.a -->',
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
18 \ ' Xcheckdir1/dir2/bar.a',
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
19 \ ' Xcheckdir1/dir2/bar.a -->',
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
20 \ ' Xcheckdir1/dir2/baz.a',
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
21 \ ' Xcheckdir1/dir2/baz.a -->',
16564
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")
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
26 call delete("Xcheckdir1", "rf")
16564
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()
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
36 call mkdir("Xcheckdir2/dir2", "p")
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
37 call writefile(['%inc /bar/'], 'Xcheckdir2/dir2/foo.b')
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
38 call writefile(['%inc /baz/'], 'Xcheckdir2/dir2/bar.b')
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
39 call writefile(['%inc /foo/'], 'Xcheckdir2/dir2/baz.b')
16564
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
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
46 set path=Xcheckdir2/dir2
16564
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 ---',
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
50 \ 'Xcheckdir2/dir2/foo.b',
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
51 \ 'Xcheckdir2/dir2/foo.b -->',
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
52 \ ' Xcheckdir2/dir2/bar.b',
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
53 \ ' Xcheckdir2/dir2/bar.b -->',
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
54 \ ' Xcheckdir2/dir2/baz.b',
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
55 \ ' Xcheckdir2/dir2/baz.b -->',
16564
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")
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
60 call delete("Xcheckdir2", "rf")
16564
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()
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
75 call mkdir("Xcheckdir3/dir2", "p")
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
76 call writefile(['%inc bar.c'], 'Xcheckdir3/dir2/foo.c')
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
77 call writefile(['%inc baz.c'], 'Xcheckdir3/dir2/bar.c')
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
78 call writefile(['%inc foo.c'], 'Xcheckdir3/dir2/baz.c')
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
79 call writefile(['%inc foo.c'], 'Xcheckdir3/dir2/FALSE.c')
16564
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
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
86 set path=Xcheckdir3/dir2
16564
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 ---',
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
90 \ 'Xcheckdir3/dir2/foo.c',
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
91 \ 'Xcheckdir3/dir2/foo.c -->',
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
92 \ ' Xcheckdir3/dir2/bar.c',
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
93 \ ' Xcheckdir3/dir2/bar.c -->',
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
94 \ ' Xcheckdir3/dir2/baz.c',
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
95 \ ' Xcheckdir3/dir2/baz.c -->',
16564
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")
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
100 call delete("Xcheckdir3", "rf")
16564
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