2024-04-20 08:44:13 -07:00
|
|
|
local t = require('test.testutil')
|
|
|
|
local n = require('test.functional.testnvim')()
|
|
|
|
|
2024-04-08 02:03:20 -07:00
|
|
|
local eq = t.eq
|
|
|
|
local ok = t.ok
|
2024-04-20 08:44:13 -07:00
|
|
|
local call = n.call
|
|
|
|
local clear = n.clear
|
2024-04-08 02:03:20 -07:00
|
|
|
local is_os = t.is_os
|
2017-04-07 10:46:33 -07:00
|
|
|
|
|
|
|
describe('hostname()', function()
|
|
|
|
before_each(clear)
|
|
|
|
|
|
|
|
it('returns hostname string', function()
|
|
|
|
local actual = call('hostname')
|
2017-07-01 09:48:17 -07:00
|
|
|
ok(string.len(actual) > 0)
|
2017-04-07 10:46:33 -07:00
|
|
|
if call('executable', 'hostname') == 1 then
|
|
|
|
local expected = string.gsub(call('system', 'hostname'), '[\n\r]', '')
|
2022-11-21 17:13:30 -07:00
|
|
|
eq(
|
|
|
|
(is_os('win') and expected:upper() or expected),
|
|
|
|
(is_os('win') and actual:upper() or actual)
|
2024-01-02 18:09:18 -07:00
|
|
|
)
|
2017-04-07 10:46:33 -07:00
|
|
|
end
|
|
|
|
end)
|
|
|
|
end)
|