|
1 | 1 | let s:V = vital#vital#new()
|
2 | 2 | let s:is_windows = has('win32')
|
| 3 | +let s:is_mac = has('mac') |
3 | 4 |
|
4 | 5 | Describe System.Filepath
|
5 | 6 | Before all
|
@@ -121,6 +122,53 @@ Describe System.Filepath
|
121 | 122 | End
|
122 | 123 | End
|
123 | 124 |
|
| 125 | + Describe .expand_home() |
| 126 | + if s:is_windows |
| 127 | + It [windows] non home path arre no expanded, there are same. |
| 128 | + let path = 'C:/Hoge' |
| 129 | + let ret = FP.expand_home(path) |
| 130 | + Assert Equals(ret, path) |
| 131 | + End |
| 132 | + else |
| 133 | + It [unix] non home path arre no expanded, there are same. |
| 134 | + let path = '/Hoge' |
| 135 | + let ret = FP.expand_home(path) |
| 136 | + Assert Equals(ret, path) |
| 137 | + End |
| 138 | + endif |
| 139 | + It expand head ~ home path |
| 140 | + let path = '~/Hoge' |
| 141 | + let ret = FP.expand_home(path) |
| 142 | + Assert Equals(ret, $HOME . FP.separator() . 'Hoge') |
| 143 | + End |
| 144 | + It include .. in path no-expand, but head ~ home expanded. |
| 145 | + if s:is_windows |
| 146 | + " base shellslash not set need |
| 147 | + let target = '~\Hoge\..\Fuga' |
| 148 | + else |
| 149 | + let target = '~/Hoge/../Fuga' |
| 150 | + endif |
| 151 | + let path = '~' . FP.separator() . target |
| 152 | + let ret = FP.expand_home(path) |
| 153 | + Assert Equals(ret, $HOME . FP.separator() . target) |
| 154 | + End |
| 155 | + if s:is_windows |
| 156 | + " need completeslash test |
| 157 | + else |
| 158 | + " need ~user test |
| 159 | + It [unix] ~user expand check |
| 160 | + let path = '~root/Hoge' |
| 161 | + let ret = FP.expand_home(path) |
| 162 | + if s:is_mac |
| 163 | + let expect = '/var/root/Hoge' |
| 164 | + else |
| 165 | + let expect = '/root/Hoge' |
| 166 | + endif |
| 167 | + Assert Equals(ret, expect) |
| 168 | + End |
| 169 | + endif |
| 170 | + End |
| 171 | + |
124 | 172 | Describe .winpath()
|
125 | 173 | It should substitute slashes in {path} to backslashes
|
126 | 174 | let path = '/Foo/Bar/Hoge.txt'
|
|
0 commit comments