aboutsummaryrefslogtreecommitdiff
path: root/test/testutil.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-09-23 06:05:58 -0700
committerGitHub <noreply@github.com>2024-09-23 06:05:58 -0700
commit47e6b2233feffc6e9d94f6086fb904eb5688fa25 (patch)
treef3c3e062ecd7aafef95ac0c77d038eb143aab074 /test/testutil.lua
parent5acdc4499e2036c90172b2b085f207ee4d5cfee4 (diff)
downloadrneovim-47e6b2233feffc6e9d94f6086fb904eb5688fa25.tar.gz
rneovim-47e6b2233feffc6e9d94f6086fb904eb5688fa25.tar.bz2
rneovim-47e6b2233feffc6e9d94f6086fb904eb5688fa25.zip
fix(vim.fs): dirname() returns "." on mingw/msys2 #30480
Problem: `vim.fs.dirname([[C:\User\XXX\AppData\Local]])` returns "." on mingw/msys2. Solution: - Check for "mingw" when deciding `iswin`. - Use `has("win32")` where possible, it works in "fast" contexts since b02eeb6a7281df0561a021d7ae595c84be9a01be.
Diffstat (limited to 'test/testutil.lua')
-rw-r--r--test/testutil.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/testutil.lua b/test/testutil.lua
index 02f343891d..a920f658a1 100644
--- a/test/testutil.lua
+++ b/test/testutil.lua
@@ -392,7 +392,7 @@ function M.check_logs()
)
end
-function M.sysname()
+local function sysname()
return uv.os_uname().sysname:lower()
end
@@ -403,11 +403,11 @@ function M.is_os(s)
error('unknown platform: ' .. tostring(s))
end
return not not (
- (s == 'win' and (M.sysname():find('windows') or M.sysname():find('mingw')))
- or (s == 'mac' and M.sysname() == 'darwin')
- or (s == 'freebsd' and M.sysname() == 'freebsd')
- or (s == 'openbsd' and M.sysname() == 'openbsd')
- or (s == 'bsd' and M.sysname():find('bsd'))
+ (s == 'win' and (sysname():find('windows') or sysname():find('mingw')))
+ or (s == 'mac' and sysname() == 'darwin')
+ or (s == 'freebsd' and sysname() == 'freebsd')
+ or (s == 'openbsd' and sysname() == 'openbsd')
+ or (s == 'bsd' and sysname():find('bsd'))
)
end