test: is_os() #10933

- Move os_name() up to "global helpers".
- Rename it to is_os().
- Make it depend on uname() instead of a running Nvim instance.
This commit is contained in:
Justin M. Keyes
2019-09-04 06:58:04 -07:00
committed by GitHub
parent 9cc8064864
commit 540360a775
7 changed files with 20 additions and 26 deletions

View File

@@ -190,6 +190,15 @@ module.uname = (function()
end)
end)()
function module.is_os(s)
if not (s == 'win' or s == 'mac' or s == 'unix') then
error('unknown platform: '..tostring(s))
end
return ((s == 'win' and module.iswin())
or (s == 'mac' and module.uname() == 'darwin')
or (s == 'unix'))
end
local function tmpdir_get()
return os.getenv('TMPDIR') and os.getenv('TMPDIR') or os.getenv('TEMP')
end