diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-01-16 21:50:51 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-01-16 21:50:51 +0100 |
commit | 58adb14739fa240ca6020cede9ab1f1cb07bd90a (patch) | |
tree | 659dac4baa05f277c760ffe5f73f128c4ee20536 /src/testdir/test_expand.vim | |
parent | da440d21a6b94d7f525fa7be9b1417c78dd9aa4c (diff) | |
download | vim-git-58adb14739fa240ca6020cede9ab1f1cb07bd90a.tar.gz |
patch 7.4.1108v7.4.1108
Problem: Expanding "~" halfway a file name.
Solution: Handle the file name as one name. (Marco Hinz) Add a test.
Closes #564.
Diffstat (limited to 'src/testdir/test_expand.vim')
-rw-r--r-- | src/testdir/test_expand.vim | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/testdir/test_expand.vim b/src/testdir/test_expand.vim new file mode 100644 index 000000000..fd999db1b --- /dev/null +++ b/src/testdir/test_expand.vim @@ -0,0 +1,36 @@ +" Test for expanding file names + +func Test_with_directories() + call mkdir('Xdir1') + call mkdir('Xdir2') + call mkdir('Xdir3') + cd Xdir3 + call mkdir('Xdir4') + cd .. + + split Xdir1/file + call setline(1, ['a', 'b']) + w + w Xdir3/Xdir4/file + close + + next Xdir?/*/file + call assert_equal('Xdir3/Xdir4/file', expand('%')) + next! Xdir?/*/nofile + call assert_equal('Xdir?/*/nofile', expand('%')) + + call delete('Xdir1', 'rf') + call delete('Xdir2', 'rf') + call delete('Xdir3', 'rf') +endfunc + +func Test_with_tilde() + let dir = getcwd() + call mkdir('Xdir ~ dir') + call assert_true(isdirectory('Xdir ~ dir')) + cd Xdir\ ~\ dir + call assert_true(getcwd() =~ 'Xdir \~ dir') + exe 'cd ' . fnameescape(dir) + call delete('Xdir ~ dir', 'd') + call assert_false(isdirectory('Xdir ~ dir')) +endfunc |