Skip to content

Commit

Permalink
fixup: quick update, squash later
Browse files Browse the repository at this point in the history
  • Loading branch information
dundargoc committed Nov 12, 2022
1 parent 2e9ff99 commit 5098ce8
Show file tree
Hide file tree
Showing 59 changed files with 256 additions and 265 deletions.
4 changes: 2 additions & 2 deletions test/functional/api/proc_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ local nvim_argv = helpers.nvim_argv
local request = helpers.request
local retry = helpers.retry
local NIL = helpers.NIL
local is = helpers.is
local is_os = helpers.is_os

describe('API', function()
before_each(clear)
Expand Down Expand Up @@ -62,7 +62,7 @@ describe('API', function()
it('returns process info', function()
local pid = funcs.getpid()
local pinfo = request('nvim_get_proc', pid)
eq((is.os.win and 'nvim.exe' or 'nvim'), pinfo.name)
eq((is_os('win') and 'nvim.exe' or 'nvim'), pinfo.name)
eq(pid, pinfo.pid)
eq('number', type(pinfo.ppid))
neq(pid, pinfo.ppid)
Expand Down
4 changes: 2 additions & 2 deletions test/functional/api/server_notifications_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local eq, clear, eval, command, nvim, next_msg =
local meths = helpers.meths
local exec_lua = helpers.exec_lua
local retry = helpers.retry
local is = helpers.is
local is_ci = helpers.is_ci
local assert_alive = helpers.assert_alive

describe('notify', function()
Expand Down Expand Up @@ -78,7 +78,7 @@ describe('notify', function()
end)

it('cancels stale events on channel close', function()
if is.ci.any then
if is_ci() then
pending('hangs on CI #14083 #15251')
return
elseif helpers.skip_fragile(pending) then
Expand Down
15 changes: 8 additions & 7 deletions test/functional/api/vim_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ local matches = helpers.matches
local pesc = helpers.pesc
local mkdir_p = helpers.mkdir_p
local ok, nvim_async, feed = helpers.ok, helpers.nvim_async, helpers.feed
local is = helpers.is
local is_os = helpers.is_os
local is_ci = helpers.is_ci
local parse_context = helpers.parse_context
local request = helpers.request
local rmdir = helpers.rmdir
Expand Down Expand Up @@ -323,7 +324,7 @@ describe('API', function()
nvim('command', 'w')
local f = io.open(fname)
ok(f ~= nil)
if is.os.win then
if is_os('win') then
eq('testing\r\napi\r\n', f:read('*a'))
else
eq('testing\napi\n', f:read('*a'))
Expand Down Expand Up @@ -398,7 +399,7 @@ describe('API', function()
end)

it('returns shell |:!| output', function()
local win_lf = is.os.win and '\r' or ''
local win_lf = is_os('win') and '\r' or ''
eq(':!echo foo\r\n\nfoo'..win_lf..'\n', nvim('command_output', [[!echo foo]]))
end)

Expand Down Expand Up @@ -2123,7 +2124,7 @@ describe('API', function()
pty='?',
}
local event = meths.get_var("opened_event")
if not is.os.win then
if not is_os('win') then
info.pty = event.info.pty
neq(nil, string.match(info.pty, "^/dev/"))
end
Expand All @@ -2139,7 +2140,7 @@ describe('API', function()
stream = 'job',
id = 4,
argv = (
is.os.win and {
is_os('win') and {
eval('&shell'),
'/s',
'/c',
Expand All @@ -2161,7 +2162,7 @@ describe('API', function()
-- :terminal with args + stopped process.
eq(1, eval('jobstop(&channel)'))
eval('jobwait([&channel], 1000)') -- Wait.
expected2.pty = (is.os.win and '?' or '') -- pty stream was closed.
expected2.pty = (is_os('win') and '?' or '') -- pty stream was closed.
eq(expected2, eval('nvim_get_chan_info(&channel)'))
end)
end)
Expand Down Expand Up @@ -2323,7 +2324,7 @@ describe('API', function()
end)

local it_maybe_pending = it
if helpers.is.ci.any and os.getenv('CONFIGURATION') == 'MSVC_32' then
if helpers.is_ci() and os.getenv('CONFIGURATION') == 'MSVC_32' then
-- For "works with &opt" (flaky on MSVC_32), but not easy to skip alone. #10241
it_maybe_pending = pending
end
Expand Down
12 changes: 6 additions & 6 deletions test/functional/autocmd/dirchanged_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local command = helpers.command
local eq = helpers.eq
local eval = helpers.eval
local request = helpers.request
local is = helpers.is
local is_os = helpers.is_os

describe('autocmd DirChanged and DirChangedPre', function()
local curdir = string.gsub(lfs.currentdir(), '\\', '/')
Expand Down Expand Up @@ -159,7 +159,7 @@ describe('autocmd DirChanged and DirChangedPre', function()
eq(1, eval('g:cdprecount'))
eq(1, eval('g:cdcount'))

if is.os.win then
if is_os('win') then
command('lcd '..win_dirs[1])
eq({}, eval('g:evpre'))
eq({}, eval('g:ev'))
Expand All @@ -182,7 +182,7 @@ describe('autocmd DirChanged and DirChangedPre', function()
eq(2, eval('g:cdprecount'))
eq(2, eval('g:cdcount'))

if is.os.win then
if is_os('win') then
command('tcd '..win_dirs[2])
eq({}, eval('g:evpre'))
eq({}, eval('g:ev'))
Expand All @@ -204,7 +204,7 @@ describe('autocmd DirChanged and DirChangedPre', function()
eq(3, eval('g:cdprecount'))
eq(3, eval('g:cdcount'))

if is.os.win then
if is_os('win') then
command('cd '..win_dirs[3])
eq({}, eval('g:evpre'))
eq({}, eval('g:ev'))
Expand All @@ -229,7 +229,7 @@ describe('autocmd DirChanged and DirChangedPre', function()
eq(4, eval('g:cdprecount'))
eq(4, eval('g:cdcount'))

if is.os.win then
if is_os('win') then
command('split '..win_dirs[1]..'/baz')
eq({}, eval('g:evpre'))
eq({}, eval('g:ev'))
Expand Down Expand Up @@ -278,7 +278,7 @@ describe('autocmd DirChanged and DirChangedPre', function()
eq(9, eval('g:cdprecount')) -- same CWD, no DirChangedPre event
eq(9, eval('g:cdcount')) -- same CWD, no DirChanged event

if is.os.win then
if is_os('win') then
command('tabnew') -- tab 3
eq(9, eval('g:cdprecount')) -- same CWD, no DirChangedPre event
eq(9, eval('g:cdcount')) -- same CWD, no DirChanged event
Expand Down
8 changes: 4 additions & 4 deletions test/functional/autocmd/termxx_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local ok = helpers.ok
local feed = helpers.feed
local pcall_err = helpers.pcall_err
local assert_alive = helpers.assert_alive
local is = helpers.is
local is_os = helpers.is_os

describe('autocmd TermClose', function()
before_each(function()
Expand Down Expand Up @@ -47,15 +47,15 @@ describe('autocmd TermClose', function()
end)

it('triggers when long-running terminal job gets stopped', function()
nvim('set_option', 'shell', is.os.win and 'cmd.exe' or 'sh')
nvim('set_option', 'shell', is_os('win') and 'cmd.exe' or 'sh')
command('autocmd TermClose * let g:test_termclose = 23')
command('terminal')
command('call jobstop(b:terminal_job_id)')
retry(nil, nil, function() eq(23, eval('g:test_termclose')) end)
end)

it('kills job trapping SIGTERM', function()
if is.os.win then return end
if is_os('win') then return end
nvim('set_option', 'shell', 'sh')
nvim('set_option', 'shellcmdflag', '-c')
command([[ let g:test_job = jobstart('trap "" TERM && echo 1 && sleep 60', { ]]
Expand All @@ -75,7 +75,7 @@ describe('autocmd TermClose', function()
end)

it('kills PTY job trapping SIGHUP and SIGTERM', function()
if is.os.win then return end
if is_os('win') then return end
nvim('set_option', 'shell', 'sh')
nvim('set_option', 'shellcmdflag', '-c')
command([[ let g:test_job = jobstart('trap "" HUP TERM && echo 1 && sleep 60', { ]]
Expand Down
4 changes: 2 additions & 2 deletions test/functional/core/channels_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local sleep = helpers.sleep
local spawn, nvim_argv = helpers.spawn, helpers.nvim_argv
local set_session = helpers.set_session
local nvim_prog = helpers.nvim_prog
local is = helpers.is
local is_os = helpers.is_os
local retry = helpers.retry
local expect_twostreams = helpers.expect_twostreams
local assert_alive = helpers.assert_alive
Expand Down Expand Up @@ -177,7 +177,7 @@ describe('channels', function()

command("call chansend(id, 'incomplet\004')")

local bsdlike = is.os.bsd or is.os.mac
local bsdlike = is_os('bsd') or is_os('mac')
local extra = bsdlike and "^D\008\008" or ""
expect_twoline(id, "stdout",
"incomplet"..extra, "[1, ['incomplet'], 'stdin']", true)
Expand Down
15 changes: 8 additions & 7 deletions test/functional/core/fileio_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ local expect_exit = helpers.expect_exit
local write_file = helpers.write_file
local Screen = require('test.functional.ui.screen')
local feed_command = helpers.feed_command
local is = helpers.is
local is_os = helpers.is_os
local is_ci = helpers.is_ci

describe('fileio', function()
before_each(function()
Expand Down Expand Up @@ -88,7 +89,7 @@ describe('fileio', function()
end)

it('backup #9709', function()
if is.ci.cirrus then
if is_ci('cirrus') then
pending('FIXME: cirrus')
end
clear({ args={ '-i', 'Xtest_startup_shada',
Expand All @@ -110,7 +111,7 @@ describe('fileio', function()
end)

it('backup with full path #11214', function()
if is.ci.cirrus then
if is_ci('cirrus') then
pending('FIXME: cirrus')
end
clear()
Expand All @@ -125,7 +126,7 @@ describe('fileio', function()

-- Backup filename = fullpath, separators replaced with "%".
local backup_file_name = string.gsub(currentdir()..'/Xtest_startup_file1',
is.os.win and '[:/\\]' or '/', '%%') .. '~'
is_os('win') and '[:/\\]' or '/', '%%') .. '~'
local foo_contents = trim(read_file('Xtest_backupdir/'..backup_file_name))
local foobar_contents = trim(read_file('Xtest_startup_file1'))

Expand All @@ -134,7 +135,7 @@ describe('fileio', function()
end)

it('backup symlinked files #11349', function()
if is.ci.cirrus then
if is_ci('cirrus') then
pending('FIXME: cirrus')
end
clear()
Expand All @@ -158,7 +159,7 @@ describe('fileio', function()


it('backup symlinked files in first avialable backupdir #11349', function()
if is.ci.cirrus then
if is_ci('cirrus') then
pending('FIXME: cirrus')
end
clear()
Expand Down Expand Up @@ -305,7 +306,7 @@ describe('tmpdir', function()
end)

-- "…/nvim.<user>/" has wrong permissions:
if is.os.win then
if is_os('win') then
return -- TODO(justinmk): need setfperm/getfperm on Windows. #8244
end
os.remove(testlog)
Expand Down
Loading

0 comments on commit 5098ce8

Please sign in to comment.