aboutsummaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-10-30 07:10:04 +0800
committerGitHub <noreply@github.com>2022-10-30 07:10:04 +0800
commitf2d9c330fc56d1e589d33c82d372532e1695ce40 (patch)
treefbbb2007fab138820b2443916fd11b8c61c2ebd9 /test/unit
parenta7d100f052b45a106d1385ed419509c047c12431 (diff)
downloadrneovim-f2d9c330fc56d1e589d33c82d372532e1695ce40.tar.gz
rneovim-f2d9c330fc56d1e589d33c82d372532e1695ce40.tar.bz2
rneovim-f2d9c330fc56d1e589d33c82d372532e1695ce40.zip
fix(path): don't remove trailing slash when getting absolute path (#20853)
Before Vim patch 8.2.3468 relative_directory is never used in the resulting path name, so whether it has a trailing slash didn't matter. Now path_full_dir_name() appends a non-existing relative directory to the current directory name, so the trailing slash needs to be kept.
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/path_spec.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/unit/path_spec.lua b/test/unit/path_spec.lua
index eb23a3cff1..3ed3a4aec9 100644
--- a/test/unit/path_spec.lua
+++ b/test/unit/path_spec.lua
@@ -504,6 +504,16 @@ describe('path.c', function()
eq(OK, result)
end)
+ itp('does not remove trailing slash from non-existing relative directory #20847', function()
+ local expected = lfs.currentdir() .. '/non_existing_dir/'
+ local filename = 'non_existing_dir/'
+ local buflen = get_buf_len(expected, filename)
+ local do_expand = 1
+ local buf, result = vim_FullName(filename, buflen, do_expand)
+ eq(expected, ffi.string(buf))
+ eq(OK, result)
+ end)
+
itp('expands "./" to the current directory #7117', function()
local expected = lfs.currentdir() .. '/unit-test-directory/test.file'
local filename = './unit-test-directory/test.file'