Mercurial > vim
annotate src/testdir/test_shortpathname.vim @ 18283:0cb608fc9c60 v8.1.2136
patch 8.1.2136: using freed memory with autocmd from fuzzer
Commit: https://github.com/vim/vim/commit/ec66c41d84e574baf8009dbc0bd088d2bc5b2421
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Oct 11 21:19:13 2019 +0200
patch 8.1.2136: using freed memory with autocmd from fuzzer
Problem: using freed memory with autocmd from fuzzer. (Dhiraj Mishra,
Dominique Pelle)
Solution: Avoid using "wp" after autocommands. (closes #5041)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 11 Oct 2019 21:30:04 +0200 |
parents | 403ac78df9a0 |
children | cbea1392c393 |
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 |
17663
403ac78df9a0
patch 8.1.1829: difference in screenshots
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
4 source check.vim |
403ac78df9a0
patch 8.1.1829: difference in screenshots
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
5 CheckMSWindows |
13146
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 func TestIt(file, bits, expected) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 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
|
9 if a:expected != '' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 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
|
11 \ substitute(res, '/', '\\', 'g'), |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 \ "'" . a:file . "'->(" . a:bits . ")->'" . res . "'") |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 endif |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 endfunc |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 func Test_ColonEight() |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 let save_dir = getcwd() |
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 " This could change for CygWin to //cygdrive/c |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 let dir1 = 'c:/x.x.y' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 if filereadable(dir1) || isdirectory(dir1) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call assert_report("Fatal: '" . dir1 . "' exists, cannot run test") |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 return |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 endif |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 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
|
27 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
|
28 let dir2 = dir1 . '/VimIsTheGreatestSinceSlicedBread' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 let file2 = dir2 . '/z.txt' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 let nofile2 = dir2 . '/zz.txt' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 call mkdir(dir1) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 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
|
34 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
|
35 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 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
|
37 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
|
38 let resdir2 = resdir1 . '/VIMIST~1' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 let resfile2 = resdir2 . '/z.txt' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 let resnofile2 = resdir2 . '/zz.txt' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 call mkdir(dir2) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 call writefile([], file1) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 call writefile([], file2) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 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
|
47 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
|
48 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
|
49 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
|
50 call TestIt(nofile2, ':p:8:h', fnamemodify(resnofile2, ':h')) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 exe 'cd ' . dir1 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 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
|
53 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
|
54 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
|
55 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
|
56 let $HOME=dir1 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 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
|
58 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
|
59 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
|
60 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
|
61 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 cd c:/ |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 call delete(file2) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 call delete(file1) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 call delete(dir2, 'd') |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 call delete(dir1, 'd') |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 exe "cd " . save_dir |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 endfunc |