robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

master
685 B25 linesraw
1local t = require('test.testutil')
2local n = require('test.functional.testnvim')()
3
4local describe, it, before_each = t.describe, t.it, t.before_each
5local eq = t.eq
6local ok = t.ok
7local call = n.call
8local clear = n.clear
9local is_os = t.is_os
10
11describe('hostname()', function()
12  before_each(clear)
13
14  it('returns hostname string', function()
15    local actual = call('hostname')
16    ok(string.len(actual) > 0)
17    if call('executable', 'hostname') == 1 then
18      local expected = string.gsub(call('system', 'hostname'), '[\n\r]', '')
19      eq(
20        (is_os('win') and expected:upper() or expected),
21        (is_os('win') and actual:upper() or actual)
22      )
23    end
24  end)
25end)