mirror of
https://github.com/neovim/neovim.git
synced 2025-12-15 19:05:40 +00:00
refactor(test): rename alter_slashes, invert its behavior
- `alter_slashes` belongs in `testutil.lua`, not `testnvim.lua`. - `alter_slashes` is an unusual name. Rename it to `fix_slashes`. - invert its behavior, to emphasize that `/` slashes are the preferred, pervasive convention, not `\` slashes.
This commit is contained in:
@@ -902,26 +902,6 @@ function M.missing_provider(provider)
|
||||
assert(false, 'Unknown provider: ' .. provider)
|
||||
end
|
||||
|
||||
--- @param obj string|table
|
||||
--- @return any
|
||||
function M.alter_slashes(obj)
|
||||
if not is_os('win') then
|
||||
return obj
|
||||
end
|
||||
if type(obj) == 'string' then
|
||||
local ret = obj:gsub('/', '\\')
|
||||
return ret
|
||||
elseif type(obj) == 'table' then
|
||||
--- @cast obj table<any,any>
|
||||
local ret = {} --- @type table<any,any>
|
||||
for k, v in pairs(obj) do
|
||||
ret[k] = M.alter_slashes(v)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
assert(false, 'expected string or table of strings, got ' .. type(obj))
|
||||
end
|
||||
|
||||
local load_factor = 1
|
||||
if t.is_ci() then
|
||||
-- Compute load factor only once (but outside of any tests).
|
||||
|
||||
Reference in New Issue
Block a user