aboutsummaryrefslogtreecommitdiff
path: root/test/helpers.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-09-04 06:58:04 -0700
committerGitHub <noreply@github.com>2019-09-04 06:58:04 -0700
commit540360a775a62db5c2722bfd89b6aa91b577d945 (patch)
tree9c0d0f5a95da8151468a26964dc2a36b586aa7bc /test/helpers.lua
parent9cc8064864374cf85c4273299d42094e3c687941 (diff)
downloadrneovim-540360a775a62db5c2722bfd89b6aa91b577d945.tar.gz
rneovim-540360a775a62db5c2722bfd89b6aa91b577d945.tar.bz2
rneovim-540360a775a62db5c2722bfd89b6aa91b577d945.zip
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.
Diffstat (limited to 'test/helpers.lua')
-rw-r--r--test/helpers.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/helpers.lua b/test/helpers.lua
index 779d33e3b1..c2a708197f 100644
--- a/test/helpers.lua
+++ b/test/helpers.lua
@@ -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