From 08aa9b00237ab45dadeffdf381e0e3c228337e53 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 25 May 2019 17:22:19 -0400 Subject: vim-patch:8.1.0211: expanding a file name "~" results in $HOME Problem: Expanding a file name "~" results in $HOME. (Aidan Shafran) Solution: Change "~" to "./~" before expanding. (closes vim/vim#3072) https://github.com/vim/vim/commit/00136dc321586800986e8f743c2f108f5eecbf92 --- test/functional/legacy/expand_spec.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/functional/legacy') diff --git a/test/functional/legacy/expand_spec.lua b/test/functional/legacy/expand_spec.lua index 7bf6fb67dc..1b735080f4 100644 --- a/test/functional/legacy/expand_spec.lua +++ b/test/functional/legacy/expand_spec.lua @@ -62,6 +62,14 @@ describe('expand file name', function() call delete('Xdir ~ dir', 'd') call assert_false(isdirectory('Xdir ~ dir')) endfunc + + func Test_expand_tilde_filename() + split ~ + call assert_equal('~', expand('%')) + call assert_notequal(expand('%:p'), expand('~/')) + call assert_match('\~', expand('%:p')) + bwipe! + endfunc ]]) end) @@ -74,4 +82,9 @@ describe('expand file name', function() call('Test_with_tilde') expected_empty() end) + + it('does not expand tilde if it is a filename', function() + call('Test_expand_tilde_filename') + expected_empty() + end) end) -- cgit