Mercurial > vim
annotate src/testdir/test_shortpathname.vim @ 29828:6b7020f3d856 v9.0.0253
patch 9.0.0253: a symlink to an autoload script results in two entries
Commit: https://github.com/vim/vim/commit/753885b6c5b9021184daa94d32fd8bf025f1b488
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Aug 24 16:30:36 2022 +0100
patch 9.0.0253: a symlink to an autoload script results in two entries
Problem: A symlink to an autoload script results in two entries in the list
of scripts, items expected in one are actually in the other.
Solution: Have one script item refer to the actually sourced one.
(closes #10960)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 24 Aug 2022 17:45:03 +0200 |
parents | 61b400b5e1a8 |
children | ae10b91ac6b3 |
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 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 call mkdir(dir1) |
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 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 call mkdir(dir2) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 call writefile([], file1) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 call writefile([], file2) |
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 call delete(file2) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 call delete(file1) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 call delete(dir2, 'd') |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 call delete(dir1, 'd') |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
18479
diff
changeset
|
81 call chdir(save_dir) |
13146
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 endfunc |
18479
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
83 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
84 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
|
85 let dir = 'Xtest' |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
86 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
87 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
|
88 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
89 call mkdir(dir) |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
90 call writefile([], file) |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
91 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
92 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
|
93 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
94 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
|
95 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
|
96 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
97 call delete(file) |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
98 call delete(dir, 'd') |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
99 endfunc |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
100 |
28021
d4b549180a07
patch 8.2.4535: filename modifer ":8" removes the filename
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
101 func Test_ColonEight_notexists() |
d4b549180a07
patch 8.2.4535: filename modifer ":8" removes the filename
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
102 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
|
103 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
|
104 endfunc |
d4b549180a07
patch 8.2.4535: filename modifer ":8" removes the filename
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
105 |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
106 " vim: shiftwidth=2 sts=2 expandtab |