Mercurial > vim
comparison src/testdir/test_expand.vim @ 7617:80bc36419c21 v7.4.1108
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 16 21:50:51 2016 +0100
patch 7.4.1108
Problem: Expanding "~" halfway a file name.
Solution: Handle the file name as one name. (Marco Hinz) Add a test.
Closes https://github.com/vim/vim/issues/564.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 16 Jan 2016 22:00:05 +0100 |
parents | |
children | 2720952e9acb |
comparison
equal
deleted
inserted
replaced
7616:054887dabb63 | 7617:80bc36419c21 |
---|---|
1 " Test for expanding file names | |
2 | |
3 func Test_with_directories() | |
4 call mkdir('Xdir1') | |
5 call mkdir('Xdir2') | |
6 call mkdir('Xdir3') | |
7 cd Xdir3 | |
8 call mkdir('Xdir4') | |
9 cd .. | |
10 | |
11 split Xdir1/file | |
12 call setline(1, ['a', 'b']) | |
13 w | |
14 w Xdir3/Xdir4/file | |
15 close | |
16 | |
17 next Xdir?/*/file | |
18 call assert_equal('Xdir3/Xdir4/file', expand('%')) | |
19 next! Xdir?/*/nofile | |
20 call assert_equal('Xdir?/*/nofile', expand('%')) | |
21 | |
22 call delete('Xdir1', 'rf') | |
23 call delete('Xdir2', 'rf') | |
24 call delete('Xdir3', 'rf') | |
25 endfunc | |
26 | |
27 func Test_with_tilde() | |
28 let dir = getcwd() | |
29 call mkdir('Xdir ~ dir') | |
30 call assert_true(isdirectory('Xdir ~ dir')) | |
31 cd Xdir\ ~\ dir | |
32 call assert_true(getcwd() =~ 'Xdir \~ dir') | |
33 exe 'cd ' . fnameescape(dir) | |
34 call delete('Xdir ~ dir', 'd') | |
35 call assert_false(isdirectory('Xdir ~ dir')) | |
36 endfunc |