aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-03-10 06:47:09 +0800
committerGitHub <noreply@github.com>2024-03-10 06:47:09 +0800
commit241c16129919e169b71ef1e788420224b358fbb3 (patch)
tree7f75baccff8e2b4ea96f4d1a033e7d3b628f4575 /test
parentb596732831b5e947ce83c1153f0df10a0553c88d (diff)
downloadrneovim-241c16129919e169b71ef1e788420224b358fbb3.tar.gz
rneovim-241c16129919e169b71ef1e788420224b358fbb3.tar.bz2
rneovim-241c16129919e169b71ef1e788420224b358fbb3.zip
vim-patch:9.1.0161: expand() removes slash after env variable that ends with colon (#27791)
Problem: expand() removes a slash after an environment variable that ends with a colon on Windows. Solution: Check the correct char for a colon (zeertzjq) closes: vim/vim#14161 Note: Vim still removes the path-separator at the end, if another path separator follows directly after it, e.g. on: ``` echo $FOO='/usr/' echo expand('$FOO/bar') == '/usr/bar' ``` see: ,----[ misc1.c:1630 ] | // if var[] ends in a path separator and tail[] starts | // with it, skip a character | if (after_pathsep(dst, dst + c) | #if defined(BACKSLASH_IN_FILENAME) || defined(AMIGA) | && (dst == save_dst || dst[-1] != ':') | #endif | && vim_ispathsep(*tail)) | ++tail; `---- https://github.com/vim/vim/commit/13a014452a7a020a119ac555a690c65b41f3126d Cherry-pick test_expand.vim change from patch 9.0.1257.
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_expand.vim17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/old/testdir/test_expand.vim b/test/old/testdir/test_expand.vim
index cd537f4ea1..24df156386 100644
--- a/test/old/testdir/test_expand.vim
+++ b/test/old/testdir/test_expand.vim
@@ -45,12 +45,25 @@ endfunc
func Test_expand_tilde_filename()
split ~
- call assert_equal('~', expand('%'))
+ call assert_equal('~', expand('%'))
call assert_notequal(expand('%:p'), expand('~/'))
- call assert_match('\~', expand('%:p'))
+ call assert_match('\~', expand('%:p'))
bwipe!
endfunc
+func Test_expand_env_pathsep()
+ let $FOO = './foo'
+ call assert_equal('./foo/bar', expand('$FOO/bar'))
+ let $FOO = './foo/'
+ call assert_equal('./foo/bar', expand('$FOO/bar'))
+ let $FOO = 'C:'
+ call assert_equal('C:/bar', expand('$FOO/bar'))
+ let $FOO = 'C:/'
+ call assert_equal('C:/bar', expand('$FOO/bar'))
+
+ unlet $FOO
+endfunc
+
func Test_expandcmd()
let $FOO = 'Test'
call assert_equal('e x/Test/y', expandcmd('e x/$FOO/y'))