diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-01-12 05:08:19 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-01-13 01:17:12 +0100 |
commit | 82edcb593b19755187371635d7b5aabdf024bd1f (patch) | |
tree | efada372ffe9974c969faab3c0ff6b6555bc27e5 | |
parent | cc7f1aba46716cf509ca784840d6e77f7bfb2318 (diff) | |
download | rneovim-82edcb593b19755187371635d7b5aabdf024bd1f.tar.gz rneovim-82edcb593b19755187371635d7b5aabdf024bd1f.tar.bz2 rneovim-82edcb593b19755187371635d7b5aabdf024bd1f.zip |
Windows: enable more tests
-rw-r--r-- | test/functional/api/server_requests_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/autocmd/tabnew_spec.lua | 9 | ||||
-rw-r--r-- | test/functional/autocmd/tabnewentered_spec.lua | 8 | ||||
-rw-r--r-- | test/functional/core/job_partial_spec.lua | 13 | ||||
-rw-r--r-- | test/functional/eval/server_spec.lua | 17 | ||||
-rw-r--r-- | test/functional/helpers.lua | 9 |
6 files changed, 33 insertions, 27 deletions
diff --git a/test/functional/api/server_requests_spec.lua b/test/functional/api/server_requests_spec.lua index 3245e1b52d..aa91cd1396 100644 --- a/test/functional/api/server_requests_spec.lua +++ b/test/functional/api/server_requests_spec.lua @@ -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") diff --git a/test/functional/autocmd/tabnew_spec.lua b/test/functional/autocmd/tabnew_spec.lua index 2148b21832..ad40954f76 100644 --- a/test/functional/autocmd/tabnew_spec.lua +++ b/test/functional/autocmd/tabnew_spec.lua @@ -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) diff --git a/test/functional/autocmd/tabnewentered_spec.lua b/test/functional/autocmd/tabnewentered_spec.lua index f033bd5fe4..bdbe677132 100644 --- a/test/functional/autocmd/tabnewentered_spec.lua +++ b/test/functional/autocmd/tabnewentered_spec.lua @@ -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() diff --git a/test/functional/core/job_partial_spec.lua b/test/functional/core/job_partial_spec.lua index b60f239db9..7643b283c4 100644 --- a/test/functional/core/job_partial_spec.lua +++ b/test/functional/core/job_partial_spec.lua @@ -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) diff --git a/test/functional/eval/server_spec.lua b/test/functional/eval/server_spec.lua index d2c985e894..420aea04aa 100644 --- a/test/functional/eval/server_spec.lua +++ b/test/functional/eval/server_spec.lua @@ -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) diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 5eec3afe65..2939184d2c 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -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, } |