aboutsummaryrefslogtreecommitdiff
path: root/test/functional/vimscript/hostname_spec.lua
blob: 024997f6b0cf35d73b7316b4bb677da74a233670 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
local t = require('test.functional.testutil')(after_each)
local eq = t.eq
local ok = t.ok
local call = t.call
local clear = t.clear
local is_os = t.is_os

describe('hostname()', function()
  before_each(clear)

  it('returns hostname string', function()
    local actual = call('hostname')
    ok(string.len(actual) > 0)
    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)
      )
    end
  end)
end)