Mercurial > vim
diff src/testdir/test_fnamemodify.vim @ 19299:8b710057093c v8.2.0208
patch 8.2.0208: fnamemodify() does not apply ":~" when followed by ":."
Commit: https://github.com/vim/vim/commit/d816cd94d87afb73c505bf1e5cd5e07522482113
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 4 22:23:09 2020 +0100
patch 8.2.0208: fnamemodify() does not apply ":~" when followed by ":."
Problem: Fnamemodify() does not apply ":~" when followed by ":.".
Solution: Don't let a failing ":." cause the ":~" to be skipped. (Yasuhiro
Matsumoto, closes #5577)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 04 Feb 2020 22:30:03 +0100 |
parents | 8d09b7f53c71 |
children | 782f410c5df3 |
line wrap: on
line diff
--- a/src/testdir/test_fnamemodify.vim +++ b/src/testdir/test_fnamemodify.vim @@ -3,8 +3,10 @@ func Test_fnamemodify() let save_home = $HOME let save_shell = &shell + let save_shellslash = &shellslash let $HOME = fnamemodify('.', ':p:h:h') set shell=sh + set shellslash call assert_equal('/', fnamemodify('.', ':p')[-1:]) call assert_equal('r', fnamemodify('.', ':p:h')[-1:]) @@ -28,6 +30,15 @@ func Test_fnamemodify() call assert_equal('fb2.tar.gz', fnamemodify('abc.fb2.tar.gz', ':e:e:e:e')) call assert_equal('tar', fnamemodify('abc.fb2.tar.gz', ':e:e:r')) + let cwd = getcwd() + call mkdir($HOME . '/XXXXXXXX/a', 'p') + call mkdir($HOME . '/XXXXXXXX/b', 'p') + call chdir($HOME . '/XXXXXXXX/a/') + call assert_equal('foo', fnamemodify($HOME . '/XXXXXXXX/a/foo', ':p:~:.')) + call assert_equal('~/XXXXXXXX/b/foo', fnamemodify($HOME . '/XXXXXXXX/b/foo', ':p:~:.')) + call chdir(cwd) + call delete($HOME . '/XXXXXXXX', 'rf') + call assert_equal('''abc def''', fnamemodify('abc def', ':S')) call assert_equal('''abc" "def''', fnamemodify('abc" "def', ':S')) call assert_equal('''abc"%"def''', fnamemodify('abc"%"def', ':S')) @@ -44,6 +55,7 @@ func Test_fnamemodify() let $HOME = save_home let &shell = save_shell + let &shellslash = save_shellslash endfunc func Test_fnamemodify_er()