Windows: enable more tests

This commit is contained in:
Justin M. Keyes
2017-01-12 05:08:19 +01:00
parent cc7f1aba46
commit 82edcb593b
6 changed files with 33 additions and 27 deletions

View File

@@ -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 source, next_message = helpers.source, helpers.next_message
local meths = helpers.meths local meths = helpers.meths
if helpers.pending_win32(pending) then return end
describe('server -> client', function() describe('server -> client', function()
local cid local cid
@@ -212,6 +210,8 @@ describe('server -> client', function()
funcs.jobstop(jobid) funcs.jobstop(jobid)
end) end)
if helpers.pending_win32(pending) then return end
it('rpc and text stderr can be combined', function() it('rpc and text stderr can be combined', function()
eq("ok",funcs.rpcrequest(jobid, "poll")) eq("ok",funcs.rpcrequest(jobid, "poll"))
funcs.rpcnotify(jobid, "ping") funcs.rpcnotify(jobid, "ping")

View File

@@ -5,8 +5,6 @@ local command = helpers.command
local eq = helpers.eq local eq = helpers.eq
local eval = helpers.eval local eval = helpers.eval
if helpers.pending_win32(pending) then return end
describe('autocmd TabNew', function() describe('autocmd TabNew', function()
before_each(clear) before_each(clear)
@@ -19,12 +17,11 @@ describe('autocmd TabNew', function()
end) end)
it('matches when opening a new tab for FILE', function() it('matches when opening a new tab for FILE', function()
local tmp_path = helpers.funcs.tempname()
command('let g:test = "foo"') command('let g:test = "foo"')
command('autocmd! TabNew ' .. tmp_path .. ' let g:test = "bar"') command('autocmd! TabNew Xtest-tabnew let g:test = "bar"')
command('tabnew ' .. tmp_path ..'X') command('tabnew Xtest-tabnewX')
eq('foo', eval('g:test')) eq('foo', eval('g:test'))
command('tabnew ' .. tmp_path) command('tabnew Xtest-tabnew')
eq('bar', eval('g:test')) eq('bar', eval('g:test'))
end) end)
end) end)

View File

@@ -1,8 +1,6 @@
local helpers = require('test.functional.helpers')(after_each) local helpers = require('test.functional.helpers')(after_each)
local clear, nvim, eq = helpers.clear, helpers.nvim, helpers.eq local clear, nvim, eq = helpers.clear, helpers.nvim, helpers.eq
if helpers.pending_win32(pending) then return end
describe('TabNewEntered', function() describe('TabNewEntered', function()
describe('au TabNewEntered', function() describe('au TabNewEntered', function()
describe('with * as <afile>', function() describe('with * as <afile>', function()
@@ -15,9 +13,9 @@ describe('TabNewEntered', function()
end) end)
describe('with FILE as <afile>', function() describe('with FILE as <afile>', function()
it('matches when opening a new tab for FILE', function() it('matches when opening a new tab for FILE', function()
local tmp_path = nvim('eval', 'tempname()') nvim('command', 'au! TabNewEntered Xtest-tabnewentered echom "tabnewentered:match"')
nvim('command', 'au! TabNewEntered '..tmp_path..' echom "tabnewentered:match"') eq('\n"Xtest-tabnewentered" [New File]\ntabnewentered:4:4\ntabnewentered:match',
eq("\n\""..tmp_path.."\" [New File]\ntabnewentered:4:4\ntabnewentered:match", nvim('command_output', 'tabnew '..tmp_path)) nvim('command_output', 'tabnew Xtest-tabnewentered'))
end) end)
end) end)
describe('with CTRL-W T', function() describe('with CTRL-W T', function()

View File

@@ -2,13 +2,14 @@ local helpers = require('test.functional.helpers')(after_each)
local clear, eq, next_msg, nvim, source = helpers.clear, helpers.eq, local clear, eq, next_msg, nvim, source = helpers.clear, helpers.eq,
helpers.next_message, helpers.nvim, helpers.source helpers.next_message, helpers.nvim, helpers.source
if helpers.pending_win32(pending) then return end
describe('jobs with partials', function() describe('jobs with partials', function()
local channel local channel
before_each(function() before_each(function()
clear() clear()
if helpers.os_name() == 'windows' then
helpers.set_shell_powershell()
end
channel = nvim('get_api_info')[1] channel = nvim('get_api_info')[1]
nvim('set_var', 'channel', channel) nvim('set_var', 'channel', channel)
end) end)
@@ -16,12 +17,14 @@ describe('jobs with partials', function()
it('works correctly', function() it('works correctly', function()
source([[ source([[
function PrintArgs(a1, a2, id, data, event) 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 endfunction
let Callback = function('PrintArgs', ["foo", "bar"]) let Callback = function('PrintArgs', ["foo", "bar"])
let g:job_opts = {'on_stdout': Callback} 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)
end) end)

View File

@@ -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 clear, funcs, meths = helpers.clear, helpers.funcs, helpers.meths
local os_name = helpers.os_name local os_name = helpers.os_name
if helpers.pending_win32(pending) then return end
describe('serverstart(), serverstop()', function() describe('serverstart(), serverstop()', function()
before_each(clear) before_each(clear)
@@ -42,8 +40,8 @@ describe('serverstart(), serverstop()', function()
-- v:servername will take the next available server. -- v:servername will take the next available server.
local servername = (os_name() == 'windows' local servername = (os_name() == 'windows'
and [[\\.\pipe\Xtest-functional-server-server-pipe]] and [[\\.\pipe\Xtest-functional-server-pipe]]
or 'Xtest-functional-server-server-socket') or 'Xtest-functional-server-socket')
funcs.serverstart(servername) funcs.serverstart(servername)
eq(servername, meths.get_vvar('servername')) eq(servername, meths.get_vvar('servername'))
end) end)
@@ -63,9 +61,11 @@ describe('serverlist()', function()
local n = eval('len(serverlist())') local n = eval('len(serverlist())')
-- Add a few -- 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 for _, s in ipairs(servs) do
eq(s, eval('serverstart("'..s..'")')) eq(s, eval("serverstart('"..s.."')"))
end end
local new_servs = eval('serverlist()') local new_servs = eval('serverlist()')
@@ -75,10 +75,9 @@ describe('serverlist()', function()
-- The new servers should be at the end of the list. -- The new servers should be at the end of the list.
for i = 1, #servs do for i = 1, #servs do
eq(servs[i], new_servs[i + n]) eq(servs[i], new_servs[i + n])
nvim('command', 'call serverstop("'..servs[i]..'")') nvim('command', "call serverstop('"..servs[i].."')")
end end
-- After calling serverstop() on the new servers, they should no longer be -- After serverstop() the servers should NOT be in the list.
-- in the list.
eq(n, eval('len(serverlist())')) eq(n, eval('len(serverlist())'))
end) end)
end) end)

View File

@@ -346,6 +346,14 @@ local function source(code)
return fname return fname
end 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, ...) local function nvim(method, ...)
return request('nvim_'..method, ...) return request('nvim_'..method, ...)
end end
@@ -590,6 +598,7 @@ return function(after_each)
curtabmeths = curtabmeths, curtabmeths = curtabmeths,
pending_win32 = pending_win32, pending_win32 = pending_win32,
skip_fragile = skip_fragile, skip_fragile = skip_fragile,
set_shell_powershell = set_shell_powershell,
tmpname = tmpname, tmpname = tmpname,
NIL = mpack.NIL, NIL = mpack.NIL,
} }