1 Test for shortpathname ':8' extension.
2 Only for use on Win32 systems!
6 :fun! TestIt(file, bits, expected)
7 let res=fnamemodify(a:file,a:bits)
9 echo "'".a:file."'->(".a:bits.")->'".res."'"
11 if substitute(res,'/','\\', 'g') != substitute( a:expected, '/','\\', 'g')
12 echo "FAILED: '".a:file."'->(".a:bits.")->'".res."'"
13 echo "Expected: '".a:expected."'"
19 :fun! MakeDir( dirname )
20 "exe '!mkdir '.substitute(a:dirname,'/','\\','g')
21 call system('mkdir '.substitute(a:dirname,'/','\\','g'))
24 "exe '!rmdir '.substitute(a:dirname,'/','\\','g')
25 call system('rmdir '.substitute(a:dirname,'/','\\','g'))
27 :fun! MakeFile( filename)
28 "exe '!copy nul '.substitute(a:filename,'/','\\','g')
29 call system('copy nul '.substitute(a:filename,'/','\\','g'))
31 :fun! TestColonEight()
33 " This could change for CygWin to //cygdrive/c
35 if filereadable(dir1) || isdirectory(dir1)
36 call confirm( "'".dir1."' exists, cannot run test" )
39 let file1=dir1.'/zz.y.txt'
40 let nofile1=dir1.'/z.y.txt'
41 let dir2=dir1.'/VimIsTheGreatestSinceSlicedBread'
42 let file2=dir2.'/z.txt'
43 let nofile2=dir2.'/zz.txt'
44 let resdir1='c:/XX2235~1.Y'
45 let resfile1=resdir1.'/ZZY~1.TXT'
46 let resnofile1=resdir1.'/z.y.txt'
47 let resdir2=resdir1.'/VIMIST~1'
48 let resfile2=resdir2.'/z.txt'
49 let resnofile2=resdir2.'/zz.txt'
52 call MakeFile( file1 )
53 call MakeFile( file2 )
54 call TestIt(file1, ':p:8', resfile1)
55 call TestIt(nofile1, ':p:8', resnofile1)
56 call TestIt(file2, ':p:8', resfile2)
57 call TestIt(nofile2, ':p:8', resnofile2)
58 call TestIt(nofile2, ':p:8:h', fnamemodify(resnofile2,':h'))
60 call TestIt(file1, ':.:8', strpart(resfile1,strlen(resdir1)+1))
61 call TestIt(nofile1, ':.:8', strpart(resnofile1,strlen(resdir1)+1))
62 call TestIt(file2, ':.:8', strpart(resfile2,strlen(resdir1)+1))
63 call TestIt(nofile2, ':.:8', strpart(resnofile2,strlen(resdir1)+1))
65 call TestIt(file1, ':~:8', '~'.strpart(resfile1,strlen(resdir1)))
66 call TestIt(nofile1, ':~:8', '~'.strpart(resnofile1,strlen(resdir1)))
67 call TestIt(file2, ':~:8', '~'.strpart(resfile2,strlen(resdir1)))
68 call TestIt(nofile2, ':~:8', '~'.strpart(resnofile2,strlen(resdir1)))
78 :call TestColonEight()