mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
Windows: enable more tests
This commit is contained in:
@@ -8,8 +8,6 @@ local nvim_prog, command, funcs = helpers.nvim_prog, helpers.command, helpers.fu
|
||||
local source, next_message = helpers.source, helpers.next_message
|
||||
local meths = helpers.meths
|
||||
|
||||
if helpers.pending_win32(pending) then return end
|
||||
|
||||
describe('server -> client', function()
|
||||
local cid
|
||||
|
||||
@@ -212,6 +210,8 @@ describe('server -> client', function()
|
||||
funcs.jobstop(jobid)
|
||||
end)
|
||||
|
||||
if helpers.pending_win32(pending) then return end
|
||||
|
||||
it('rpc and text stderr can be combined', function()
|
||||
eq("ok",funcs.rpcrequest(jobid, "poll"))
|
||||
funcs.rpcnotify(jobid, "ping")
|
||||
|
@@ -5,8 +5,6 @@ local command = helpers.command
|
||||
local eq = helpers.eq
|
||||
local eval = helpers.eval
|
||||
|
||||
if helpers.pending_win32(pending) then return end
|
||||
|
||||
describe('autocmd TabNew', function()
|
||||
before_each(clear)
|
||||
|
||||
@@ -19,12 +17,11 @@ describe('autocmd TabNew', function()
|
||||
end)
|
||||
|
||||
it('matches when opening a new tab for FILE', function()
|
||||
local tmp_path = helpers.funcs.tempname()
|
||||
command('let g:test = "foo"')
|
||||
command('autocmd! TabNew ' .. tmp_path .. ' let g:test = "bar"')
|
||||
command('tabnew ' .. tmp_path ..'X')
|
||||
command('autocmd! TabNew Xtest-tabnew let g:test = "bar"')
|
||||
command('tabnew Xtest-tabnewX')
|
||||
eq('foo', eval('g:test'))
|
||||
command('tabnew ' .. tmp_path)
|
||||
command('tabnew Xtest-tabnew')
|
||||
eq('bar', eval('g:test'))
|
||||
end)
|
||||
end)
|
||||
|
@@ -1,8 +1,6 @@
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local clear, nvim, eq = helpers.clear, helpers.nvim, helpers.eq
|
||||
|
||||
if helpers.pending_win32(pending) then return end
|
||||
|
||||
describe('TabNewEntered', function()
|
||||
describe('au TabNewEntered', function()
|
||||
describe('with * as <afile>', function()
|
||||
@@ -15,9 +13,9 @@ describe('TabNewEntered', function()
|
||||
end)
|
||||
describe('with FILE as <afile>', function()
|
||||
it('matches when opening a new tab for FILE', function()
|
||||
local tmp_path = nvim('eval', 'tempname()')
|
||||
nvim('command', 'au! TabNewEntered '..tmp_path..' echom "tabnewentered:match"')
|
||||
eq("\n\""..tmp_path.."\" [New File]\ntabnewentered:4:4\ntabnewentered:match", nvim('command_output', 'tabnew '..tmp_path))
|
||||
nvim('command', 'au! TabNewEntered Xtest-tabnewentered echom "tabnewentered:match"')
|
||||
eq('\n"Xtest-tabnewentered" [New File]\ntabnewentered:4:4\ntabnewentered:match',
|
||||
nvim('command_output', 'tabnew Xtest-tabnewentered'))
|
||||
end)
|
||||
end)
|
||||
describe('with CTRL-W T', function()
|
||||
|
@@ -2,13 +2,14 @@ local helpers = require('test.functional.helpers')(after_each)
|
||||
local clear, eq, next_msg, nvim, source = helpers.clear, helpers.eq,
|
||||
helpers.next_message, helpers.nvim, helpers.source
|
||||
|
||||
if helpers.pending_win32(pending) then return end
|
||||
|
||||
describe('jobs with partials', function()
|
||||
local channel
|
||||
|
||||
before_each(function()
|
||||
clear()
|
||||
if helpers.os_name() == 'windows' then
|
||||
helpers.set_shell_powershell()
|
||||
end
|
||||
channel = nvim('get_api_info')[1]
|
||||
nvim('set_var', 'channel', channel)
|
||||
end)
|
||||
@@ -16,12 +17,14 @@ describe('jobs with partials', function()
|
||||
it('works correctly', function()
|
||||
source([[
|
||||
function PrintArgs(a1, a2, id, data, event)
|
||||
call rpcnotify(g:channel, '1', a:a1, a:a2, a:data, a:event)
|
||||
" Windows: Remove ^M char.
|
||||
let normalized = map(a:data, 'substitute(v:val, "\r", "", "g")')
|
||||
call rpcnotify(g:channel, '1', a:a1, a:a2, normalized, a:event)
|
||||
endfunction
|
||||
let Callback = function('PrintArgs', ["foo", "bar"])
|
||||
let g:job_opts = {'on_stdout': Callback}
|
||||
call jobstart(['echo'], g:job_opts)
|
||||
call jobstart('echo "some text"', g:job_opts)
|
||||
]])
|
||||
eq({'notification', '1', {'foo', 'bar', {'', ''}, 'stdout'}}, next_msg())
|
||||
eq({'notification', '1', {'foo', 'bar', {'some text', ''}, 'stdout'}}, next_msg())
|
||||
end)
|
||||
end)
|
||||
|
@@ -4,8 +4,6 @@ local nvim, eq, neq, eval = helpers.nvim, helpers.eq, helpers.neq, helpers.eval
|
||||
local clear, funcs, meths = helpers.clear, helpers.funcs, helpers.meths
|
||||
local os_name = helpers.os_name
|
||||
|
||||
if helpers.pending_win32(pending) then return end
|
||||
|
||||
describe('serverstart(), serverstop()', function()
|
||||
before_each(clear)
|
||||
|
||||
@@ -42,8 +40,8 @@ describe('serverstart(), serverstop()', function()
|
||||
|
||||
-- v:servername will take the next available server.
|
||||
local servername = (os_name() == 'windows'
|
||||
and [[\\.\pipe\Xtest-functional-server-server-pipe]]
|
||||
or 'Xtest-functional-server-server-socket')
|
||||
and [[\\.\pipe\Xtest-functional-server-pipe]]
|
||||
or 'Xtest-functional-server-socket')
|
||||
funcs.serverstart(servername)
|
||||
eq(servername, meths.get_vvar('servername'))
|
||||
end)
|
||||
@@ -63,9 +61,11 @@ describe('serverlist()', function()
|
||||
local n = eval('len(serverlist())')
|
||||
|
||||
-- Add a few
|
||||
local servs = {'should-not-exist', 'another-one-that-shouldnt'}
|
||||
local servs = (os_name() == 'windows'
|
||||
and { [[\\.\pipe\Xtest-pipe0934]], [[\\.\pipe\Xtest-pipe4324]] }
|
||||
or { [[Xtest-pipe0934]], [[Xtest-pipe4324]] })
|
||||
for _, s in ipairs(servs) do
|
||||
eq(s, eval('serverstart("'..s..'")'))
|
||||
eq(s, eval("serverstart('"..s.."')"))
|
||||
end
|
||||
|
||||
local new_servs = eval('serverlist()')
|
||||
@@ -75,10 +75,9 @@ describe('serverlist()', function()
|
||||
-- The new servers should be at the end of the list.
|
||||
for i = 1, #servs do
|
||||
eq(servs[i], new_servs[i + n])
|
||||
nvim('command', 'call serverstop("'..servs[i]..'")')
|
||||
nvim('command', "call serverstop('"..servs[i].."')")
|
||||
end
|
||||
-- After calling serverstop() on the new servers, they should no longer be
|
||||
-- in the list.
|
||||
-- After serverstop() the servers should NOT be in the list.
|
||||
eq(n, eval('len(serverlist())'))
|
||||
end)
|
||||
end)
|
||||
|
@@ -346,6 +346,14 @@ local function source(code)
|
||||
return fname
|
||||
end
|
||||
|
||||
local function set_shell_powershell()
|
||||
source([[
|
||||
set shell=powershell shellquote=\" shellpipe=\| shellredir=>
|
||||
set shellcmdflag=\ -ExecutionPolicy\ RemoteSigned\ -Command
|
||||
let &shellxquote=' '
|
||||
]])
|
||||
end
|
||||
|
||||
local function nvim(method, ...)
|
||||
return request('nvim_'..method, ...)
|
||||
end
|
||||
@@ -590,6 +598,7 @@ return function(after_each)
|
||||
curtabmeths = curtabmeths,
|
||||
pending_win32 = pending_win32,
|
||||
skip_fragile = skip_fragile,
|
||||
set_shell_powershell = set_shell_powershell,
|
||||
tmpname = tmpname,
|
||||
NIL = mpack.NIL,
|
||||
}
|
||||
|
Reference in New Issue
Block a user