annotate src/testdir/test_checkpath.vim @ 32681:5a989f229d9b v9.0.1671

patch 9.0.1671: Termdebug: error with more than 99 breakpoints Commit: https://github.com/vim/vim/commit/e7d9ca2b3bf99b0b759be8952e02c77110a354c1 Author: skywind3000 <skywind3000@163.com> Date: Wed Jun 28 23:27:28 2023 +0100 patch 9.0.1671: Termdebug: error with more than 99 breakpoints Problem: Termdebug: error with more than 99 breakpoints. Solution: Use a different sign for breakpoint 100 and over. (closes https://github.com/vim/vim/issues/12589, closes #12588)
author Bram Moolenaar <Bram@vim.org>
date Thu, 29 Jun 2023 00:30:03 +0200
parents f7a2de8a4ddc
children
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()
30164
f7a2de8a4ddc patch 9.0.0418: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29970
diff changeset
5 call mkdir("Xcheckdir1/dir2", "pR")
29970
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")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 set path&
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 endfunc
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 func DotsToSlashes()
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 return substitute(v:fname, '\.', '/', 'g') . '.b'
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 endfunc
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 " Test for 'include' with \zs and \ze
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 func Test_checkpath2()
30164
f7a2de8a4ddc patch 9.0.0418: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29970
diff changeset
35 call mkdir("Xcheckdir2/dir2", "pR")
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 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
37 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
38 call writefile(['%inc /foo/'], 'Xcheckdir2/dir2/baz.b')
30164
f7a2de8a4ddc patch 9.0.0418: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29970
diff changeset
39 call writefile(['%inc /foo/'], 'Xbase.b', 'D')
16564
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 let &include='^\s*%inc\s*/\zs[^/]\+\ze'
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 let &includeexpr='DotsToSlashes()'
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 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
45 set path=Xcheckdir2/dir2
16564
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 let res = split(execute("checkpath!"), "\n")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 call assert_equal([
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 \ '--- 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
49 \ '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
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/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
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/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
54 \ ' Xcheckdir2/dir2/baz.b -->',
16564
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 \ ' foo (Already listed)'], res)
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 enew
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 set path&
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 set include&
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 set includeexpr&
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 endfunc
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 func StripNewlineChar()
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 if v:fname =~ '\n$'
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 return v:fname[:-2]
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 endif
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 return v:fname
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 endfunc
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 " 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
71 func Test_checkpath3()
30164
f7a2de8a4ddc patch 9.0.0418: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29970
diff changeset
72 call mkdir("Xcheckdir3/dir2", "pR")
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
73 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
74 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
75 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
76 call writefile(['%inc foo.c'], 'Xcheckdir3/dir2/FALSE.c')
30164
f7a2de8a4ddc patch 9.0.0418: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29970
diff changeset
77 call writefile(['%inc FALSE.c foo.c'], 'Xbase.c', 'D')
16564
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 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
80 let &includeexpr='StripNewlineChar()'
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 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
83 set path=Xcheckdir3/dir2
16564
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 let res = split(execute("checkpath!"), "\n")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 call assert_equal([
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 \ '--- 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
87 \ '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
88 \ '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
89 \ ' 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
90 \ ' 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
91 \ ' 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
92 \ ' Xcheckdir3/dir2/baz.c -->',
16564
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 \ ' foo.c (Already listed)'], res)
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 enew
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 set path&
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 set include&
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 set includeexpr&
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 endfunc
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
100
22375
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
101 " 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
102 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
103 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
104 set include=\\%(
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
105 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
106 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
107
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_define = &define
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
109 set define=\\%(
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('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
111 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
112
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
113 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
114 endfunc
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
115
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
116 " vim: shiftwidth=2 sts=2 expandtab