diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-10-10 22:13:23 -0700 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-10-10 22:33:42 -0700 |
commit | 401398bc4b07301e8f7ad6c288dbc799624b1a2d (patch) | |
tree | ed4728aec19f6976401791ace19c828f8b6234bf | |
parent | 5f60861f5a7c7c588e1d638f734897bc5dc291cc (diff) | |
download | rneovim-401398bc4b07301e8f7ad6c288dbc799624b1a2d.tar.gz rneovim-401398bc4b07301e8f7ad6c288dbc799624b1a2d.tar.bz2 rneovim-401398bc4b07301e8f7ad6c288dbc799624b1a2d.zip |
vim-patch:8.1.2125: fnamemodify() fails when repeating :e
Problem: Fnamemodify() fails when repeating :e.
Solution: Do not go before the tail. (Rob Pilling, closes vim/vim#5024)
https://github.com/vim/vim/commit/b189295b72030f00c45c30d3daecf85d457221f8
-rw-r--r-- | src/nvim/testdir/test_fnamemodify.vim | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_fnamemodify.vim b/src/nvim/testdir/test_fnamemodify.vim index 63f273677d..116d23ba88 100644 --- a/src/nvim/testdir/test_fnamemodify.vim +++ b/src/nvim/testdir/test_fnamemodify.vim @@ -45,3 +45,31 @@ func Test_fnamemodify() let $HOME = save_home let &shell = save_shell endfunc + +func Test_fnamemodify_er() + call assert_equal("with", fnamemodify("path/to/file.with.extensions", ':e:e:r:r')) + + call assert_equal('c', fnamemodify('a.c', ':e')) + call assert_equal('c', fnamemodify('a.c', ':e:e')) + call assert_equal('c', fnamemodify('a.c', ':e:e:r')) + call assert_equal('c', fnamemodify('a.c', ':e:e:r:r')) + + call assert_equal('rb', fnamemodify('a.spec.rb', ':e:r')) + call assert_equal('rb', fnamemodify('a.spec.rb', ':e:r')) + call assert_equal('spec.rb', fnamemodify('a.spec.rb', ':e:e')) + call assert_equal('spec', fnamemodify('a.spec.rb', ':e:e:r')) + call assert_equal('spec', fnamemodify('a.spec.rb', ':e:e:r:r')) + call assert_equal('spec', fnamemodify('a.b.spec.rb', ':e:e:r')) + call assert_equal('b.spec', fnamemodify('a.b.spec.rb', ':e:e:e:r')) + call assert_equal('b', fnamemodify('a.b.spec.rb', ':e:e:e:r:r')) + + call assert_equal('spec', fnamemodify('a.b.spec.rb', ':r:e')) + call assert_equal('b', fnamemodify('a.b.spec.rb', ':r:r:e')) + + call assert_equal('c', fnamemodify('a.b.c.d.e', ':r:r:e')) + call assert_equal('b.c', fnamemodify('a.b.c.d.e', ':r:r:e:e')) + + " :e never includes the whole filename, so "a.b":e:e:e --> "b" + call assert_equal('b.c', fnamemodify('a.b.c.d.e', ':r:r:e:e:e')) + call assert_equal('b.c', fnamemodify('a.b.c.d.e', ':r:r:e:e:e:e')) +endfunc |