File: hostname_spec.lua

package info (click to toggle)
neovim 0.11.4-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 64,136 kB
  • sloc: ansic: 263,156; python: 1,472; lisp: 1,237; sh: 1,138; makefile: 378; xml: 83; ruby: 6
file content (24 lines) | stat: -rw-r--r-- 619 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
local t = require('test.testutil')
local n = require('test.functional.testnvim')()

local eq = t.eq
local ok = t.ok
local call = n.call
local clear = n.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)