Mercurial > vim
annotate src/testdir/test_shortpathname.vim @ 32190:73489b6c4a02 v9.0.1426
patch 9.0.1426: indent wrong after "export namespace" in C++
Commit: https://github.com/vim/vim/commit/99e4ab2a1e577ddb29030c09c308b67e16fd51c4
Author: Virginia Senioria <91khr@users.noreply.github.com>
Date: Fri Mar 24 19:25:06 2023 +0000
patch 9.0.1426: indent wrong after "export namespace" in C++
Problem: Indent wrong after "export namespace" in C++.
Solution: Skip over "inline" and "export" in any order. (Virginia Senioria,
closes #12134, closes #12133)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 24 Mar 2023 20:30:04 +0100 |
parents | ae10b91ac6b3 |
children | cbd54806cb2c |
rev | line source |
---|---|
13146
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test for shortpathname ':8' extension. |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 " Only for use on Win32 systems! |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 |
18479
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
4 set encoding=utf-8 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
5 scriptencoding utf-8 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
6 |
17663
403ac78df9a0
patch 8.1.1829: difference in screenshots
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
7 source check.vim |
403ac78df9a0
patch 8.1.1829: difference in screenshots
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
8 CheckMSWindows |
13146
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 func TestIt(file, bits, expected) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 let res = fnamemodify(a:file, a:bits) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 if a:expected != '' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 call assert_equal(substitute(a:expected, '/', '\\', 'g'), |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 \ substitute(res, '/', '\\', 'g'), |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 \ "'" . a:file . "'->(" . a:bits . ")->'" . res . "'") |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 endif |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 endfunc |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 func Test_ColonEight() |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 let save_dir = getcwd() |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 |
29542
61b400b5e1a8
patch 9.0.0112: MS-Windows: test fails because file already exists
Bram Moolenaar <Bram@vim.org>
parents:
28021
diff
changeset
|
22 " This could change for CygWin to //cygdrive/c . |
13146
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 let dir1 = 'c:/x.x.y' |
29542
61b400b5e1a8
patch 9.0.0112: MS-Windows: test fails because file already exists
Bram Moolenaar <Bram@vim.org>
parents:
28021
diff
changeset
|
24 let trycount = 5 |
61b400b5e1a8
patch 9.0.0112: MS-Windows: test fails because file already exists
Bram Moolenaar <Bram@vim.org>
parents:
28021
diff
changeset
|
25 while 1 |
61b400b5e1a8
patch 9.0.0112: MS-Windows: test fails because file already exists
Bram Moolenaar <Bram@vim.org>
parents:
28021
diff
changeset
|
26 if !filereadable(dir1) && !isdirectory(dir1) |
61b400b5e1a8
patch 9.0.0112: MS-Windows: test fails because file already exists
Bram Moolenaar <Bram@vim.org>
parents:
28021
diff
changeset
|
27 break |
61b400b5e1a8
patch 9.0.0112: MS-Windows: test fails because file already exists
Bram Moolenaar <Bram@vim.org>
parents:
28021
diff
changeset
|
28 endif |
61b400b5e1a8
patch 9.0.0112: MS-Windows: test fails because file already exists
Bram Moolenaar <Bram@vim.org>
parents:
28021
diff
changeset
|
29 if trycount == 1 |
61b400b5e1a8
patch 9.0.0112: MS-Windows: test fails because file already exists
Bram Moolenaar <Bram@vim.org>
parents:
28021
diff
changeset
|
30 call assert_report("Fatal: '" . dir1 . "' exists, cannot run this test") |
61b400b5e1a8
patch 9.0.0112: MS-Windows: test fails because file already exists
Bram Moolenaar <Bram@vim.org>
parents:
28021
diff
changeset
|
31 return |
61b400b5e1a8
patch 9.0.0112: MS-Windows: test fails because file already exists
Bram Moolenaar <Bram@vim.org>
parents:
28021
diff
changeset
|
32 endif |
61b400b5e1a8
patch 9.0.0112: MS-Windows: test fails because file already exists
Bram Moolenaar <Bram@vim.org>
parents:
28021
diff
changeset
|
33 " When tests run in parallel the directory may exist, wait a bit until it |
61b400b5e1a8
patch 9.0.0112: MS-Windows: test fails because file already exists
Bram Moolenaar <Bram@vim.org>
parents:
28021
diff
changeset
|
34 " is gone. |
61b400b5e1a8
patch 9.0.0112: MS-Windows: test fails because file already exists
Bram Moolenaar <Bram@vim.org>
parents:
28021
diff
changeset
|
35 sleep 5 |
61b400b5e1a8
patch 9.0.0112: MS-Windows: test fails because file already exists
Bram Moolenaar <Bram@vim.org>
parents:
28021
diff
changeset
|
36 let trycount -= 1 |
61b400b5e1a8
patch 9.0.0112: MS-Windows: test fails because file already exists
Bram Moolenaar <Bram@vim.org>
parents:
28021
diff
changeset
|
37 endwhile |
13146
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 let file1 = dir1 . '/zz.y.txt' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 let nofile1 = dir1 . '/z.y.txt' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 let dir2 = dir1 . '/VimIsTheGreatestSinceSlicedBread' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 let file2 = dir2 . '/z.txt' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 let nofile2 = dir2 . '/zz.txt' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
29542
diff
changeset
|
45 call mkdir(dir1, 'D') |
13146
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 let resdir1 = substitute(fnamemodify(dir1, ':p:8'), '/$', '', '') |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 call assert_match('\V\^c:/XX\x\x\x\x~1.Y\$', resdir1) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 let resfile1 = resdir1 . '/ZZY~1.TXT' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 let resnofile1 = resdir1 . '/z.y.txt' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 let resdir2 = resdir1 . '/VIMIST~1' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 let resfile2 = resdir2 . '/z.txt' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 let resnofile2 = resdir2 . '/zz.txt' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
29542
diff
changeset
|
55 call mkdir(dir2, 'D') |
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
29542
diff
changeset
|
56 call writefile([], file1, 'D') |
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
29542
diff
changeset
|
57 call writefile([], file2, 'D') |
13146
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 call TestIt(file1, ':p:8', resfile1) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 call TestIt(nofile1, ':p:8', resnofile1) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 call TestIt(file2, ':p:8', resfile2) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 call TestIt(nofile2, ':p:8', resnofile2) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 call TestIt(nofile2, ':p:8:h', fnamemodify(resnofile2, ':h')) |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
18479
diff
changeset
|
64 call chdir(dir1) |
13146
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 call TestIt(file1, ':.:8', strpart(resfile1, strlen(resdir1)+1)) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 call TestIt(nofile1, ':.:8', strpart(resnofile1, strlen(resdir1)+1)) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 call TestIt(file2, ':.:8', strpart(resfile2, strlen(resdir1)+1)) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 call TestIt(nofile2, ':.:8', strpart(resnofile2, strlen(resdir1)+1)) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 let $HOME=dir1 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 call TestIt(file1, ':~:8', '~' . strpart(resfile1, strlen(resdir1))) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 call TestIt(nofile1, ':~:8', '~' . strpart(resnofile1, strlen(resdir1))) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 call TestIt(file2, ':~:8', '~' . strpart(resfile2, strlen(resdir1))) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 call TestIt(nofile2, ':~:8', '~' . strpart(resnofile2, strlen(resdir1))) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 cd c:/ |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
18479
diff
changeset
|
77 call chdir(save_dir) |
13146
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 endfunc |
18479
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
79 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
80 func Test_ColonEight_MultiByte() |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
81 let dir = 'Xtest' |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
82 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
83 let file = dir . '/日本語のファイル.txt' |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
84 |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
29542
diff
changeset
|
85 call mkdir(dir, 'D') |
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
29542
diff
changeset
|
86 call writefile([], file, 'D') |
18479
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
87 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
88 let sfile = fnamemodify(file, ':8') |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
89 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
90 call assert_notequal(file, sfile) |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
91 call assert_match('\~', sfile) |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
92 endfunc |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
93 |
28021
d4b549180a07
patch 8.2.4535: filename modifer ":8" removes the filename
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
94 func Test_ColonEight_notexists() |
d4b549180a07
patch 8.2.4535: filename modifer ":8" removes the filename
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
95 let non_exists='C:\windows\newfile.txt' |
d4b549180a07
patch 8.2.4535: filename modifer ":8" removes the filename
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
96 call assert_equal(non_exists, fnamemodify(non_exists, ':p:8')) |
d4b549180a07
patch 8.2.4535: filename modifer ":8" removes the filename
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
97 endfunc |
d4b549180a07
patch 8.2.4535: filename modifer ":8" removes the filename
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
98 |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
99 " vim: shiftwidth=2 sts=2 expandtab |