annotate src/testdir/test_shortpathname.vim @ 17437:5f71f12bdb8c

Added tag v8.1.1716 for changeset e1b5c15f5fee70aaa68aa8286030cf713a403aee
author Bram Moolenaar <Bram@vim.org>
date Fri, 19 Jul 2019 23:30:05 +0200
parents 8e9e9124c7a2
children 403ac78df9a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 if !has('win32')
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
5 throw 'Skipped: not on MS-Windows'
13146
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 endif
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 func TestIt(file, bits, expected)
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 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
10 if a:expected != ''
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 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
12 \ substitute(res, '/', '\\', 'g'),
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 \ "'" . a:file . "'->(" . a:bits . ")->'" . res . "'")
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 endif
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 endfunc
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 func Test_ColonEight()
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 let save_dir = getcwd()
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 " 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
21 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
22 if filereadable(dir1) || isdirectory(dir1)
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 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
24 return
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 endif
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 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
28 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
29 let dir2 = dir1 . '/VimIsTheGreatestSinceSlicedBread'
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 let file2 = dir2 . '/z.txt'
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 let nofile2 = dir2 . '/zz.txt'
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 call mkdir(dir1)
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 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
35 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
36
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 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
38 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
39 let resdir2 = resdir1 . '/VIMIST~1'
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 let resfile2 = resdir2 . '/z.txt'
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 let resnofile2 = resdir2 . '/zz.txt'
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 call mkdir(dir2)
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 call writefile([], file1)
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 call writefile([], file2)
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 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
48 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
49 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
50 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
51 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
52 exe 'cd ' . dir1
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 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
54 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
55 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
56 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
57 let $HOME=dir1
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 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
59 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
60 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
61 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
62
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 cd c:/
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 call delete(file2)
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 call delete(file1)
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 call delete(dir2, 'd')
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 call delete(dir1, 'd')
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 exe "cd " . save_dir
d9a94be389b5 patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 endfunc