neovim/test/functional/vimscript/hostname_spec.lua

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
613 B
Lua
Raw Normal View History

2017-04-07 10:46:33 -07:00
local helpers = require('test.functional.helpers')(after_each)
local eq = helpers.eq
2017-04-07 10:46:33 -07:00
local ok = helpers.ok
local call = helpers.call
local clear = helpers.clear
local is_os = helpers.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')
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]', '')
eq((is_os('win') and expected:upper() or expected),
(is_os('win') and actual:upper() or actual))
2017-04-07 10:46:33 -07:00
end
end)
end)