diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-09-01 22:56:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-01 22:56:41 -0700 |
commit | 099445cc07b0154edc6ecd562a28e86c87c0096b (patch) | |
tree | bb539bd3877fc0545b1c7db13039b357477e5758 /test/helpers.lua | |
parent | 7bb029eeef65f57d94cef4e4b709e6c3ebefcf08 (diff) | |
parent | ead39d6ce6d1c5e5b6130c6823d071889c207bde (diff) | |
download | rneovim-099445cc07b0154edc6ecd562a28e86c87c0096b.tar.gz rneovim-099445cc07b0154edc6ecd562a28e86c87c0096b.tar.bz2 rneovim-099445cc07b0154edc6ecd562a28e86c87c0096b.zip |
Merge #10804 'CI/OpenBSD: functional tests'
Diffstat (limited to 'test/helpers.lua')
-rw-r--r-- | test/helpers.lua | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/test/helpers.lua b/test/helpers.lua index 08a7822b19..25fff55596 100644 --- a/test/helpers.lua +++ b/test/helpers.lua @@ -158,7 +158,11 @@ function module.check_logs() table.concat(runtime_errors, ', '))) end --- Tries to get platform name from $SYSTEM_NAME, uname; fallback is "Windows". +function module.iswin() + return package.config:sub(1,1) == '\\' +end + +-- Gets (lowercase) OS name from CMake, uname, or "win" if iswin(). module.uname = (function() local platform = nil return (function() @@ -166,17 +170,19 @@ module.uname = (function() return platform end - platform = os.getenv("SYSTEM_NAME") - if platform then + if os.getenv("SYSTEM_NAME") then -- From CMAKE_SYSTEM_NAME. + platform = string.lower(os.getenv("SYSTEM_NAME")) return platform end local status, f = pcall(module.popen_r, 'uname', '-s') if status then - platform = f:read("*l") + platform = string.lower(f:read("*l")) f:close() + elseif module.iswin() then + platform = 'windows' else - platform = 'Windows' + error('unknown platform') end return platform end) @@ -203,11 +209,11 @@ module.tmpname = (function() return fname else local fname = os.tmpname() - if module.uname() == 'Windows' and fname:sub(1, 2) == '\\s' then + if module.uname() == 'windows' and fname:sub(1, 2) == '\\s' then -- In Windows tmpname() returns a filename starting with -- special sequence \s, prepend $TEMP path return tmpdir..fname - elseif fname:match('^/tmp') and module.uname() == 'Darwin' then + elseif fname:match('^/tmp') and module.uname() == 'darwin' then -- In OS X /tmp links to /private/tmp return '/private'..fname else |