Merge #7412 'win: enable more tests'

This commit is contained in:
Justin M. Keyes 2018-02-20 00:13:58 +01:00 committed by GitHub
commit e215b6cb85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 186 additions and 135 deletions

View File

@ -5,8 +5,8 @@ local clear, command, nvim, nvim_dir =
local eval, eq, retry = local eval, eq, retry =
helpers.eval, helpers.eq, helpers.retry helpers.eval, helpers.eq, helpers.retry
local ok = helpers.ok local ok = helpers.ok
local iswin = helpers.iswin
if helpers.pending_win32(pending) then return end
describe('TermClose event', function() describe('TermClose event', function()
before_each(function() before_each(function()
@ -23,7 +23,7 @@ describe('TermClose event', function()
end) end)
it('triggers when long-running terminal job gets stopped', function() it('triggers when long-running terminal job gets stopped', function()
nvim('set_option', 'shell', 'sh') nvim('set_option', 'shell', iswin() and 'cmd.exe' or 'sh')
command('autocmd TermClose * let g:test_termclose = 23') command('autocmd TermClose * let g:test_termclose = 23')
command('terminal') command('terminal')
command('call jobstop(b:terminal_job_id)') command('call jobstop(b:terminal_job_id)')
@ -31,6 +31,7 @@ describe('TermClose event', function()
end) end)
it('kills job trapping SIGTERM', function() it('kills job trapping SIGTERM', function()
if helpers.pending_win32(pending) then return end
nvim('set_option', 'shell', 'sh') nvim('set_option', 'shell', 'sh')
nvim('set_option', 'shellcmdflag', '-c') nvim('set_option', 'shellcmdflag', '-c')
command([[ let g:test_job = jobstart('trap "" TERM && echo 1 && sleep 60', { ]] command([[ let g:test_job = jobstart('trap "" TERM && echo 1 && sleep 60', { ]]
@ -48,6 +49,7 @@ describe('TermClose event', function()
end) end)
it('kills pty job trapping SIGHUP and SIGTERM', function() it('kills pty job trapping SIGHUP and SIGTERM', function()
if helpers.pending_win32(pending) then return end
nvim('set_option', 'shell', 'sh') nvim('set_option', 'shell', 'sh')
nvim('set_option', 'shellcmdflag', '-c') nvim('set_option', 'shellcmdflag', '-c')
command([[ let g:test_job = jobstart('trap "" HUP TERM && echo 1 && sleep 60', { ]] command([[ let g:test_job = jobstart('trap "" HUP TERM && echo 1 && sleep 60', { ]]

View File

@ -60,7 +60,7 @@ describe('jobs', function()
it('changes to given / directory', function() it('changes to given / directory', function()
nvim('command', "let g:job_opts.cwd = '/'") nvim('command', "let g:job_opts.cwd = '/'")
if iswin() then if iswin() then
nvim('command', "let j = jobstart('pwd|%{$_.Path}', g:job_opts)") nvim('command', "let j = jobstart('(Get-Location).Path', g:job_opts)")
else else
nvim('command', "let j = jobstart('pwd', g:job_opts)") nvim('command', "let j = jobstart('pwd', g:job_opts)")
end end
@ -75,7 +75,7 @@ describe('jobs', function()
mkdir(dir) mkdir(dir)
nvim('command', "let g:job_opts.cwd = '" .. dir .. "'") nvim('command', "let g:job_opts.cwd = '" .. dir .. "'")
if iswin() then if iswin() then
nvim('command', "let j = jobstart('pwd|%{$_.Path}', g:job_opts)") nvim('command', "let j = jobstart('(Get-Location).Path', g:job_opts)")
else else
nvim('command', "let j = jobstart('pwd', g:job_opts)") nvim('command', "let j = jobstart('pwd', g:job_opts)")
end end
@ -115,13 +115,13 @@ describe('jobs', function()
end) end)
it('returns -1 when target is not executable #5465', function() it('returns -1 when target is not executable #5465', function()
if helpers.pending_win32(pending) then return end
local function new_job() local function new_job()
return eval([[jobstart('')]]) return eval([[jobstart('')]])
end end
local executable_jobid = new_job() local executable_jobid = new_job()
local nonexecutable_jobid = eval( local nonexecutable_jobid = eval("jobstart(['"..(iswin()
"jobstart(['./test/functional/fixtures/non_executable.txt'])") and './test/functional/fixtures'
or './test/functional/fixtures/non_executable.txt').."'])")
eq(-1, nonexecutable_jobid) eq(-1, nonexecutable_jobid)
-- Should _not_ throw an error. -- Should _not_ throw an error.
eq("", eval("v:errmsg")) eq("", eval("v:errmsg"))
@ -133,11 +133,10 @@ describe('jobs', function()
-- TODO: hangs on Windows -- TODO: hangs on Windows
if helpers.pending_win32(pending) then return end if helpers.pending_win32(pending) then return end
nvim('command', "let g:job_opts.on_stderr = function('OnEvent')") nvim('command', "let g:job_opts.on_stderr = function('OnEvent')")
nvim('command', "call jobstart('echo', g:job_opts)") nvim('command', [[call jobstart('echo ""', g:job_opts)]])
expect_twostreams({{'notification', 'stdout', {0, {'', ''}}}, expect_twostreams({{'notification', 'stdout', {0, {'', ''}}},
{'notification', 'stdout', {0, {''}}}}, {'notification', 'stdout', {0, {''}}}},
{{'notification', 'stderr', {0, {''}}}}) {{'notification', 'stderr', {0, {''}}}})
eq({'notification', 'exit', {0, 0}}, next_msg()) eq({'notification', 'exit', {0, 0}}, next_msg())
end) end)
@ -253,7 +252,6 @@ describe('jobs', function()
end) end)
it('will not leak memory if we leave a job running', function() it('will not leak memory if we leave a job running', function()
if helpers.pending_win32(pending) then return end -- TODO: Need `cat`.
nvim('command', "call jobstart(['cat', '-'], g:job_opts)") nvim('command', "call jobstart(['cat', '-'], g:job_opts)")
end) end)
@ -299,14 +297,6 @@ describe('jobs', function()
eq({'notification', 'exit', {data, 0}}, next_msg()) eq({'notification', 'exit', {data, 0}}, next_msg())
end) end)
it('can omit options', function()
if helpers.pending_win32(pending) then return end
neq(0, nvim('eval', 'delete(".Xtestjob")'))
nvim('command', "call jobstart(['touch', '.Xtestjob'])")
nvim('command', "sleep 100m")
eq(0, nvim('eval', 'delete(".Xtestjob")'))
end)
it('can omit data callbacks', function() it('can omit data callbacks', function()
nvim('command', 'unlet g:job_opts.on_stdout') nvim('command', 'unlet g:job_opts.on_stdout')
nvim('command', 'let g:job_opts.user = 5') nvim('command', 'let g:job_opts.user = 5')
@ -348,7 +338,6 @@ describe('jobs', function()
end) end)
it('can redefine callbacks being used by a job', function() it('can redefine callbacks being used by a job', function()
if helpers.pending_win32(pending) then return end -- TODO: Need `cat`.
local screen = Screen.new() local screen = Screen.new()
screen:attach() screen:attach()
screen:set_default_attr_ids({ screen:set_default_attr_ids({
@ -363,7 +352,7 @@ describe('jobs', function()
\ 'on_stderr': function('g:JobHandler'), \ 'on_stderr': function('g:JobHandler'),
\ 'on_exit': function('g:JobHandler') \ 'on_exit': function('g:JobHandler')
\ } \ }
let job = jobstart('cat -', g:callbacks) let job = jobstart(['cat', '-'], g:callbacks)
]]) ]])
wait() wait()
source([[ source([[

View File

@ -188,8 +188,9 @@ describe('system()', function()
end) end)
it('`yes` and is interrupted with CTRL-C', function() it('`yes` and is interrupted with CTRL-C', function()
if helpers.pending_win32(pending) then return end feed(':call system("' .. (iswin()
feed(':call system("yes")<cr>') and 'for /L %I in (1,0,2) do @echo y'
or 'yes') .. '")<cr>')
screen:expect([[ screen:expect([[
| |
~ | ~ |
@ -204,8 +205,11 @@ describe('system()', function()
~ | ~ |
~ | ~ |
~ | ~ |
:call system("yes") | ]] .. (iswin()
]]) and [[
:call system("for /L %I in (1,0,2) do @echo y") |]]
or [[
:call system("yes") |]]))
feed('<c-c>') feed('<c-c>')
screen:expect([[ screen:expect([[
^ | ^ |

View File

@ -8,8 +8,7 @@ local call = helpers.call
local clear = helpers.clear local clear = helpers.clear
local command = helpers.command local command = helpers.command
local exc_exec = helpers.exc_exec local exc_exec = helpers.exc_exec
local pathsep = helpers.get_pathsep()
if helpers.pending_win32(pending) then return end
-- These directories will be created for testing -- These directories will be created for testing
local directories = { local directories = {
@ -75,8 +74,8 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(0, lwd(globalwin, tabnr)) eq(0, lwd(globalwin, tabnr))
-- Window with local dir reports as such -- Window with local dir reports as such
eq(globalDir .. '/' .. directories.window, cwd(localwin)) eq(globalDir .. pathsep .. directories.window, cwd(localwin))
eq(globalDir .. '/' .. directories.window, cwd(localwin, tabnr)) eq(globalDir .. pathsep .. directories.window, cwd(localwin, tabnr))
eq(1, lwd(localwin)) eq(1, lwd(localwin))
eq(1, lwd(localwin, tabnr)) eq(1, lwd(localwin, tabnr))
@ -86,7 +85,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(0, lwd(globalwin, tabnr)) eq(0, lwd(globalwin, tabnr))
-- From new tab page, local window reports as such -- From new tab page, local window reports as such
eq(globalDir .. '/' .. directories.window, cwd(localwin, tabnr)) eq(globalDir .. pathsep .. directories.window, cwd(localwin, tabnr))
eq(1, lwd(localwin, tabnr)) eq(1, lwd(localwin, tabnr))
end) end)
@ -109,14 +108,14 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(0, lwd(-1, globaltab)) eq(0, lwd(-1, globaltab))
-- new tab reports local -- new tab reports local
eq(globalDir .. '/' .. directories.tab, cwd(-1, 0)) eq(globalDir .. pathsep .. directories.tab, cwd(-1, 0))
eq(globalDir .. '/' .. directories.tab, cwd(-1, localtab)) eq(globalDir .. pathsep .. directories.tab, cwd(-1, localtab))
eq(1, lwd(-1, 0)) eq(1, lwd(-1, 0))
eq(1, lwd(-1, localtab)) eq(1, lwd(-1, localtab))
command('tabnext') command('tabnext')
-- From original tab page, local reports as such -- From original tab page, local reports as such
eq(globalDir .. '/' .. directories.tab, cwd(-1, localtab)) eq(globalDir .. pathsep .. directories.tab, cwd(-1, localtab))
eq(1, lwd(-1, localtab)) eq(1, lwd(-1, localtab))
end) end)
end) end)
@ -147,17 +146,17 @@ for _, cmd in ipairs {'cd', 'chdir'} do
-- Create a new tab and change directory -- Create a new tab and change directory
command('tabnew') command('tabnew')
command('silent t' .. cmd .. ' ' .. directories.tab) command('silent t' .. cmd .. ' ' .. directories.tab)
eq(globalDir .. '/' .. directories.tab, tcwd()) eq(globalDir .. pathsep .. directories.tab, tcwd())
-- Create a new tab and verify it has inherited the directory -- Create a new tab and verify it has inherited the directory
command('tabnew') command('tabnew')
eq(globalDir .. '/' .. directories.tab, tcwd()) eq(globalDir .. pathsep .. directories.tab, tcwd())
-- Change tab and change back, verify that directories are correct -- Change tab and change back, verify that directories are correct
command('tabnext') command('tabnext')
eq(globalDir, tcwd()) eq(globalDir, tcwd())
command('tabprevious') command('tabprevious')
eq(globalDir .. '/' .. directories.tab, tcwd()) eq(globalDir .. pathsep .. directories.tab, tcwd())
end) end)
end) end)
@ -173,7 +172,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
-- Change tab-local working directory and verify it is different -- Change tab-local working directory and verify it is different
command('silent t' .. cmd .. ' ' .. directories.tab) command('silent t' .. cmd .. ' ' .. directories.tab)
eq(globalDir .. '/' .. directories.tab, cwd()) eq(globalDir .. pathsep .. directories.tab, cwd())
eq(cwd(), tcwd()) -- working directory maches tab directory eq(cwd(), tcwd()) -- working directory maches tab directory
eq(1, tlwd()) eq(1, tlwd())
eq(cwd(), wcwd()) -- still no window-directory eq(cwd(), wcwd()) -- still no window-directory
@ -183,16 +182,16 @@ for _, cmd in ipairs {'cd', 'chdir'} do
command('new') command('new')
eq(1, tlwd()) -- Still tab-local working directory eq(1, tlwd()) -- Still tab-local working directory
eq(0, wlwd()) -- Still no window-local working directory eq(0, wlwd()) -- Still no window-local working directory
eq(globalDir .. '/' .. directories.tab, cwd()) eq(globalDir .. pathsep .. directories.tab, cwd())
command('silent l' .. cmd .. ' ../' .. directories.window) command('silent l' .. cmd .. ' ../' .. directories.window)
eq(globalDir .. '/' .. directories.window, cwd()) eq(globalDir .. pathsep .. directories.window, cwd())
eq(globalDir .. '/' .. directories.tab, tcwd()) eq(globalDir .. pathsep .. directories.tab, tcwd())
eq(1, wlwd()) eq(1, wlwd())
-- Verify the first window still has the tab local directory -- Verify the first window still has the tab local directory
command('wincmd w') command('wincmd w')
eq(globalDir .. '/' .. directories.tab, cwd()) eq(globalDir .. pathsep .. directories.tab, cwd())
eq(globalDir .. '/' .. directories.tab, tcwd()) eq(globalDir .. pathsep .. directories.tab, tcwd())
eq(0, wlwd()) -- No window-local directory eq(0, wlwd()) -- No window-local directory
-- Change back to initial tab and verify working directory has stayed -- Change back to initial tab and verify working directory has stayed
@ -203,10 +202,10 @@ for _, cmd in ipairs {'cd', 'chdir'} do
-- Verify global changes don't affect local ones -- Verify global changes don't affect local ones
command('silent ' .. cmd .. ' ' .. directories.global) command('silent ' .. cmd .. ' ' .. directories.global)
eq(globalDir .. '/' .. directories.global, cwd()) eq(globalDir .. pathsep .. directories.global, cwd())
command('tabnext') command('tabnext')
eq(globalDir .. '/' .. directories.tab, cwd()) eq(globalDir .. pathsep .. directories.tab, cwd())
eq(globalDir .. '/' .. directories.tab, tcwd()) eq(globalDir .. pathsep .. directories.tab, tcwd())
eq(0, wlwd()) -- Still no window-local directory in this window eq(0, wlwd()) -- Still no window-local directory in this window
-- Unless the global change happened in a tab with local directory -- Unless the global change happened in a tab with local directory
@ -220,9 +219,9 @@ for _, cmd in ipairs {'cd', 'chdir'} do
-- But not in a window with its own local directory -- But not in a window with its own local directory
command('tabnext | wincmd w') command('tabnext | wincmd w')
eq(globalDir .. '/' .. directories.window, cwd() ) eq(globalDir .. pathsep .. directories.window, cwd() )
eq(0 , tlwd()) eq(0 , tlwd())
eq(globalDir .. '/' .. directories.window, wcwd()) eq(globalDir .. pathsep .. directories.window, wcwd())
end) end)
end) end)
end end
@ -280,6 +279,9 @@ describe("getcwd()", function ()
end) end)
it("returns empty string if working directory does not exist", function() it("returns empty string if working directory does not exist", function()
if helpers.iswin() then
return
end
command("cd "..directories.global) command("cd "..directories.global)
command("call delete('../"..directories.global.."', 'd')") command("call delete('../"..directories.global.."', 'd')")
eq("", helpers.eval("getcwd()")) eq("", helpers.eval("getcwd()"))

View File

@ -10,8 +10,6 @@ local feed_command = helpers.feed_command
local funcs = helpers.funcs local funcs = helpers.funcs
local meths = helpers.meths local meths = helpers.meths
if helpers.pending_win32(pending) then return end
local fname = 'Xtest-functional-ex_cmds-write' local fname = 'Xtest-functional-ex_cmds-write'
local fname_bak = fname .. '~' local fname_bak = fname .. '~'
local fname_broken = fname_bak .. 'broken' local fname_broken = fname_bak .. 'broken'
@ -36,7 +34,11 @@ describe(':write', function()
it('&backupcopy=auto preserves symlinks', function() it('&backupcopy=auto preserves symlinks', function()
command('set backupcopy=auto') command('set backupcopy=auto')
write_file('test_bkc_file.txt', 'content0') write_file('test_bkc_file.txt', 'content0')
command("silent !ln -s test_bkc_file.txt test_bkc_link.txt") if helpers.iswin() then
command("silent !mklink test_bkc_link.txt test_bkc_file.txt")
else
command("silent !ln -s test_bkc_file.txt test_bkc_link.txt")
end
source([[ source([[
edit test_bkc_link.txt edit test_bkc_link.txt
call setline(1, ['content1']) call setline(1, ['content1'])
@ -49,7 +51,11 @@ describe(':write', function()
it('&backupcopy=no replaces symlink with new file', function() it('&backupcopy=no replaces symlink with new file', function()
command('set backupcopy=no') command('set backupcopy=no')
write_file('test_bkc_file.txt', 'content0') write_file('test_bkc_file.txt', 'content0')
command("silent !ln -s test_bkc_file.txt test_bkc_link.txt") if helpers.iswin() then
command("silent !mklink test_bkc_link.txt test_bkc_file.txt")
else
command("silent !ln -s test_bkc_file.txt test_bkc_link.txt")
end
source([[ source([[
edit test_bkc_link.txt edit test_bkc_link.txt
call setline(1, ['content1']) call setline(1, ['content1'])
@ -82,8 +88,10 @@ describe(':write', function()
command('let $HOME=""') command('let $HOME=""')
eq(funcs.fnamemodify('.', ':p:h'), funcs.fnamemodify('.', ':p:h:~')) eq(funcs.fnamemodify('.', ':p:h'), funcs.fnamemodify('.', ':p:h:~'))
-- Message from check_overwrite -- Message from check_overwrite
eq(('\nE17: "'..funcs.fnamemodify('.', ':p:h')..'" is a directory'), if not helpers.iswin() then
redir_exec('write .')) eq(('\nE17: "'..funcs.fnamemodify('.', ':p:h')..'" is a directory'),
redir_exec('write .'))
end
meths.set_option('writeany', true) meths.set_option('writeany', true)
-- Message from buf_write -- Message from buf_write
eq(('\nE502: "." is a directory'), eq(('\nE502: "." is a directory'),
@ -100,9 +108,16 @@ describe(':write', function()
funcs.setfperm(fname, 'r--------') funcs.setfperm(fname, 'r--------')
eq('Vim(write):E505: "Xtest-functional-ex_cmds-write" is read-only (add ! to override)', eq('Vim(write):E505: "Xtest-functional-ex_cmds-write" is read-only (add ! to override)',
exc_exec('write')) exc_exec('write'))
os.remove(fname) if helpers.iswin() then
os.remove(fname_bak) eq(0, os.execute('del /q/f ' .. fname))
eq(0, os.execute('rd /q/s ' .. fname_bak))
else
eq(true, os.remove(fname))
eq(true, os.remove(fname_bak))
end
write_file(fname_bak, 'TTYX') write_file(fname_bak, 'TTYX')
-- FIXME: exc_exec('write!') outputs 0 in Windows
if helpers.iswin() then return end
lfs.link(fname_bak .. ('/xxxxx'):rep(20), fname, true) lfs.link(fname_bak .. ('/xxxxx'):rep(20), fname, true)
eq('Vim(write):E166: Can\'t open linked file for writing', eq('Vim(write):E166: Can\'t open linked file for writing',
exc_exec('write!')) exc_exec('write!'))

View File

@ -641,7 +641,7 @@ local function redir_exec(cmd)
end end
local function get_pathsep() local function get_pathsep()
return funcs.fnamemodify('.', ':p'):sub(-1) return iswin() and '\\' or '/'
end end
local function pathroot() local function pathroot()

View File

@ -18,10 +18,9 @@ local clear, feed_command, expect, eq, neq, dedent, write_file, feed =
helpers.clear, helpers.feed_command, helpers.expect, helpers.eq, helpers.neq, helpers.clear, helpers.feed_command, helpers.expect, helpers.eq, helpers.neq,
helpers.dedent, helpers.write_file, helpers.feed helpers.dedent, helpers.write_file, helpers.feed
if helpers.pending_win32(pending) then return end
local function has_gzip() local function has_gzip()
return os.execute('gzip --help >/dev/null 2>&1') == 0 local null = helpers.iswin() and 'nul' or '/dev/null'
return os.execute('gzip --help >' .. null .. ' 2>&1') == 0
end end
local function prepare_gz_file(name, text) local function prepare_gz_file(name, text)
@ -142,6 +141,7 @@ describe('file reading, writing and bufnew and filter autocommands', function()
end) end)
it('FilterReadPre, FilterReadPost', function() it('FilterReadPre, FilterReadPost', function()
if helpers.pending_win32(pending) then return end
-- Write a special input file for this test block. -- Write a special input file for this test block.
write_file('test.out', dedent([[ write_file('test.out', dedent([[
startstart startstart

View File

@ -5,8 +5,6 @@ local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local feed_command, expect = helpers.feed_command, helpers.expect local feed_command, expect = helpers.feed_command, helpers.expect
if helpers.pending_win32(pending) then return end
describe('jump to a tag with hidden set', function() describe('jump to a tag with hidden set', function()
setup(clear) setup(clear)
@ -25,12 +23,17 @@ describe('jump to a tag with hidden set', function()
feed_command('set hidden') feed_command('set hidden')
-- Create a link from test25.dir to the current directory. -- Create a link from test25.dir to the current directory.
feed_command('!rm -f test25.dir') if helpers.iswin() then
feed_command('!ln -s . test25.dir') feed_command('!rd /q/s test25.dir')
feed_command('!mklink /j test25.dir .')
else
feed_command('!rm -f test25.dir')
feed_command('!ln -s . test25.dir')
end
-- Create tags.text, with the current directory name inserted. -- Create tags.text, with the current directory name inserted.
feed_command('/tags line') feed_command('/tags line')
feed_command('r !pwd') feed_command('r !' .. (helpers.iswin() and 'cd' or 'pwd'))
feed('d$/test<cr>') feed('d$/test<cr>')
feed('hP:.w! tags.test<cr>') feed('hP:.w! tags.test<cr>')
@ -39,7 +42,13 @@ describe('jump to a tag with hidden set', function()
-- space will then be eaten by hit-return, instead of moving the cursor to 'd'. -- space will then be eaten by hit-return, instead of moving the cursor to 'd'.
feed_command('set tags=tags.test') feed_command('set tags=tags.test')
feed('G<C-]> x:yank a<cr>') feed('G<C-]> x:yank a<cr>')
feed_command('!rm -f Xxx test25.dir tags.test') feed_command("call delete('tags.test')")
feed_command("call delete('Xxx')")
if helpers.iswin() then
feed_command('!rd /q test25.dir')
else
feed_command('!rm -f test25.dir')
end
-- Put @a and remove empty line -- Put @a and remove empty line
feed_command('%d') feed_command('%d')

View File

@ -5,8 +5,6 @@ local feed, clear, command = helpers.feed, helpers.clear, helpers.command
local eq, write_file = helpers.eq, helpers.write_file local eq, write_file = helpers.eq, helpers.write_file
local wait = helpers.wait local wait = helpers.wait
if helpers.pending_win32(pending) then return end
describe('fileformats option', function() describe('fileformats option', function()
setup(function() setup(function()
clear() clear()

View File

@ -8,8 +8,6 @@ local eq = helpers.eq
local wait = helpers.wait local wait = helpers.wait
local exc_exec = helpers.exc_exec local exc_exec = helpers.exc_exec
if helpers.pending_win32(pending) then return end
describe(':highlight', function() describe(':highlight', function()
setup(clear) setup(clear)

View File

@ -5,8 +5,6 @@ local feed, insert, source = helpers.feed, helpers.insert, helpers.source
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
local write_file, call = helpers.write_file, helpers.call local write_file, call = helpers.write_file, helpers.call
if helpers.pending_win32(pending) then return end
local function write_latin1(name, text) local function write_latin1(name, text)
text = call('iconv', text, 'utf-8', 'latin-1') text = call('iconv', text, 'utf-8', 'latin-1')
write_file(name, text) write_file(name, text)
@ -507,8 +505,13 @@ describe("spell checking with 'encoding' set to utf-8", function()
-- Vim function in the original legacy test. -- Vim function in the original legacy test.
local function test_one(aff, dic) local function test_one(aff, dic)
-- Generate a .spl file from a .dic and .aff file. -- Generate a .spl file from a .dic and .aff file.
os.execute('cp -f Xtest'..aff..'.aff Xtest.aff') if helpers.iswin() then
os.execute('cp -f Xtest'..dic..'.dic Xtest.dic') os.execute('copy /y Xtest'..aff..'.aff Xtest.aff')
os.execute('copy /y Xtest'..dic..'.dic Xtest.dic')
else
os.execute('cp -f Xtest'..aff..'.aff Xtest.aff')
os.execute('cp -f Xtest'..dic..'.dic Xtest.dic')
end
source([[ source([[
set spellfile= set spellfile=
function! SpellDumpNoShow() function! SpellDumpNoShow()
@ -559,7 +562,11 @@ describe("spell checking with 'encoding' set to utf-8", function()
feed_command([[$put =soundfold('kóopërÿnôven')]]) feed_command([[$put =soundfold('kóopërÿnôven')]])
feed_command([[$put =soundfold('oeverloos gezwets edale')]]) feed_command([[$put =soundfold('oeverloos gezwets edale')]])
-- And now with SAL instead of SOFO items; test automatic reloading. -- And now with SAL instead of SOFO items; test automatic reloading.
os.execute('cp -f Xtest-sal.aff Xtest.aff') if helpers.iswin() then
os.execute('copy /y Xtest-sal.aff Xtest.aff')
else
os.execute('cp -f Xtest-sal.aff Xtest.aff')
end
feed_command('mkspell! Xtest Xtest') feed_command('mkspell! Xtest Xtest')
feed_command([[$put =soundfold('goobledygoook')]]) feed_command([[$put =soundfold('goobledygoook')]])
feed_command([[$put =soundfold('kóopërÿnôven')]]) feed_command([[$put =soundfold('kóopërÿnôven')]])

View File

@ -7,8 +7,6 @@ local helpers = require('test.functional.helpers')(after_each)
local feed, insert = helpers.feed, helpers.insert local feed, insert = helpers.feed, helpers.insert
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
if helpers.pending_win32(pending) then return end
describe('store cursor position in session file in Latin-1', function() describe('store cursor position in session file in Latin-1', function()
setup(clear) setup(clear)

View File

@ -6,15 +6,19 @@ local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear local clear = helpers.clear
local command, expect = helpers.command, helpers.expect local command, expect = helpers.command, helpers.expect
if helpers.pending_win32(pending) then return end
describe('glob() and globpath()', function() describe('glob() and globpath()', function()
setup(clear) setup(clear)
setup(function() setup(function()
os.execute("mkdir -p sautest/autoload") if helpers.iswin() then
os.execute("touch sautest/autoload/Test104.vim") os.execute("md sautest\\autoload")
os.execute("touch sautest/autoload/footest.vim") os.execute(".>sautest\\autoload\\Test104.vim 2>nul")
os.execute(".>sautest\\autoload\\footest.vim 2>nul")
else
os.execute("mkdir -p sautest/autoload")
os.execute("touch sautest/autoload/Test104.vim")
os.execute("touch sautest/autoload/footest.vim")
end
end) end)
it('is working', function() it('is working', function()
@ -24,29 +28,55 @@ describe('glob() and globpath()', function()
-- Consistent sorting of file names -- Consistent sorting of file names
command('set nofileignorecase') command('set nofileignorecase')
command([[$put =glob('Xxx\{')]]) if helpers.iswin() then
command([[$put =glob('Xxx\$')]]) command([[$put =glob('Xxx{')]])
command([[$put =glob('Xxx$')]])
command('silent w! Xxx{') command('silent w! Xxx{')
command([[w! Xxx\$]]) command([[w! Xxx$]])
command([[$put =glob('Xxx\{')]]) command([[$put =glob('Xxx{')]])
command([[$put =glob('Xxx\$')]]) command([[$put =glob('Xxx$')]])
command("$put =string(globpath('sautest/autoload', '*.vim'))") command([[$put =string(globpath('sautest\autoload', '*.vim'))]])
command("$put =string(globpath('sautest/autoload', '*.vim', 0, 1))") command([[$put =string(globpath('sautest\autoload', '*.vim', 0, 1))]])
expect([=[
expect([=[
Xxx{ Xxx{
Xxx$ Xxx$
'sautest/autoload/Test104.vim 'sautest\autoload\Test104.vim
sautest/autoload/footest.vim' sautest\autoload\footest.vim'
['sautest/autoload/Test104.vim', 'sautest/autoload/footest.vim']]=]) ['sautest\autoload\Test104.vim', 'sautest\autoload\footest.vim']]=])
else
command([[$put =glob('Xxx\{')]])
command([[$put =glob('Xxx\$')]])
command('silent w! Xxx{')
command([[w! Xxx\$]])
command([[$put =glob('Xxx\{')]])
command([[$put =glob('Xxx\$')]])
command("$put =string(globpath('sautest/autoload', '*.vim'))")
command("$put =string(globpath('sautest/autoload', '*.vim', 0, 1))")
expect([=[
Xxx{
Xxx$
'sautest/autoload/Test104.vim
sautest/autoload/footest.vim'
['sautest/autoload/Test104.vim', 'sautest/autoload/footest.vim']]=])
end
end) end)
teardown(function() teardown(function()
os.execute("rm -rf sautest Xxx{ Xxx$") if helpers.iswin() then
os.execute('del /q/f Xxx{ Xxx$')
os.execute('rd /q sautest')
else
os.execute("rm -rf sautest Xxx{ Xxx$")
end
end) end)
end) end)

View File

@ -8,8 +8,6 @@ local clear = helpers.clear
local insert = helpers.insert local insert = helpers.insert
local command = helpers.command local command = helpers.command
if helpers.pending_win32(pending) then return end
describe('107', function() describe('107', function()
setup(clear) setup(clear)

View File

@ -4,8 +4,6 @@ local helpers = require('test.functional.helpers')(after_each)
local clear, command, eq = helpers.clear, helpers.command, helpers.eq local clear, command, eq = helpers.clear, helpers.command, helpers.eq
local eval, exc_exec, neq = helpers.eval, helpers.exc_exec, helpers.neq local eval, exc_exec, neq = helpers.eval, helpers.exc_exec, helpers.neq
if helpers.pending_win32(pending) then return end
describe('argument list commands', function() describe('argument list commands', function()
before_each(clear) before_each(clear)

View File

@ -2,8 +2,6 @@ local helpers = require('test.functional.helpers')(after_each)
local clear, source = helpers.clear, helpers.source local clear, source = helpers.clear, helpers.source
local eq, eval, command = helpers.eq, helpers.eval, helpers.command local eq, eval, command = helpers.eq, helpers.eval, helpers.command
if helpers.pending_win32(pending) then return end
describe('Test for delete()', function() describe('Test for delete()', function()
before_each(clear) before_each(clear)
@ -48,7 +46,11 @@ describe('Test for delete()', function()
split Xfile split Xfile
call setline(1, ['a', 'b']) call setline(1, ['a', 'b'])
wq wq
silent !ln -s Xfile Xlink if has('win32')
silent !mklink Xlink Xfile
else
silent !ln -s Xfile Xlink
endif
]]) ]])
-- Delete the link, not the file -- Delete the link, not the file
eq(0, eval("delete('Xlink')")) eq(0, eval("delete('Xlink')"))
@ -58,7 +60,11 @@ describe('Test for delete()', function()
it('symlink directory delete', function() it('symlink directory delete', function()
command("call mkdir('Xdir1')") command("call mkdir('Xdir1')")
command("silent !ln -s Xdir1 Xlink") if helpers.iswin() then
command("silent !mklink /j Xlink Xdir1")
else
command("silent !ln -s Xdir1 Xlink")
end
eq(1, eval("isdirectory('Xdir1')")) eq(1, eval("isdirectory('Xdir1')"))
eq(1, eval("isdirectory('Xlink')")) eq(1, eval("isdirectory('Xlink')"))
-- Delete the link, not the directory -- Delete the link, not the directory
@ -78,7 +84,11 @@ describe('Test for delete()', function()
w Xdir3/subdir/Xfile w Xdir3/subdir/Xfile
w Xdir4/Xfile w Xdir4/Xfile
close close
silent !ln -s ../Xdir4 Xdir3/Xlink if has('win32')
silent !mklink /j Xdir3\Xlink Xdir4
else
silent !ln -s ../Xdir4 Xdir3/Xlink
endif
]]) ]])
eq(1, eval("isdirectory('Xdir3')")) eq(1, eval("isdirectory('Xdir3')"))

View File

@ -4,15 +4,14 @@ local helpers = require('test.functional.helpers')(after_each)
local feed = helpers.feed local feed = helpers.feed
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
if helpers.pending_win32(pending) then return end
describe('fixeol', function() describe('fixeol', function()
local function rmtestfiles() local function rmtestfiles()
os.remove('test.out') feed_command('%bwipeout!')
os.remove('XXEol') feed_command('call delete("test.out")')
os.remove('XXNoEol') feed_command('call delete("XXEol")')
os.remove('XXTestEol') feed_command('call delete("XXNoEol")')
os.remove('XXTestNoEol') feed_command('call delete("XXTestEol")')
feed_command('call delete("XXTestNoEol")')
end end
setup(function() setup(function()
clear() clear()

View File

@ -4,8 +4,6 @@ local helpers = require('test.functional.helpers')(after_each)
local eq, eval, source = helpers.eq, helpers.eval, helpers.source local eq, eval, source = helpers.eq, helpers.eval, helpers.source
local call, clear, command = helpers.call, helpers.clear, helpers.command local call, clear, command = helpers.call, helpers.clear, helpers.command
if helpers.pending_win32(pending) then return end
describe('getcwd', function() describe('getcwd', function()
before_each(clear) before_each(clear)

View File

@ -9,17 +9,15 @@ local function expected_empty()
eq({}, nvim.get_vvar('errors')) eq({}, nvim.get_vvar('errors'))
end end
if helpers.pending_win32(pending) then return end
describe('packadd', function() describe('packadd', function()
before_each(function() before_each(function()
clear() clear()
source([=[ source([=[
func SetUp() func SetUp()
let s:topdir = expand('%:p:h') . '/Xdir' let s:topdir = expand(expand('%:p:h') . '/Xdir')
exe 'set packpath=' . s:topdir exe 'set packpath=' . s:topdir
let s:plugdir = s:topdir . '/pack/mine/opt/mytest' let s:plugdir = expand(s:topdir . '/pack/mine/opt/mytest')
endfunc endfunc
func TearDown() func TearDown()
@ -52,8 +50,8 @@ describe('packadd', function()
call assert_equal(77, g:plugin_also_works) call assert_equal(77, g:plugin_also_works)
call assert_true(17, g:ftdetect_works) call assert_true(17, g:ftdetect_works)
call assert_true(len(&rtp) > len(rtp)) call assert_true(len(&rtp) > len(rtp))
call assert_true(&rtp =~ (s:plugdir . '\($\|,\)')) call assert_true(&rtp =~ (escape(s:plugdir, '\') . '\($\|,\)'))
call assert_true(&rtp =~ (s:plugdir . '/after$')) call assert_true(&rtp =~ escape(expand(s:plugdir . '/after$'), '\'))
" Check exception " Check exception
call assert_fails("packadd directorynotfound", 'E919:') call assert_fails("packadd directorynotfound", 'E919:')
@ -74,7 +72,7 @@ describe('packadd', function()
packadd! mytest packadd! mytest
call assert_true(len(&rtp) > len(rtp)) call assert_true(len(&rtp) > len(rtp))
call assert_true(&rtp =~ (s:plugdir . '\($\|,\)')) call assert_true(&rtp =~ (escape(s:plugdir, '\') . '\($\|,\)'))
call assert_equal(0, g:plugin_works) call assert_equal(0, g:plugin_works)
" check the path is not added twice " check the path is not added twice
@ -84,17 +82,18 @@ describe('packadd', function()
endfunc endfunc
func Test_packadd_symlink_dir() func Test_packadd_symlink_dir()
if !has('unix') let top2_dir = expand(s:topdir . '/Xdir2')
return let real_dir = expand(s:topdir . '/Xsym')
endif
let top2_dir = s:topdir . '/Xdir2'
let real_dir = s:topdir . '/Xsym'
call mkdir(real_dir, 'p') call mkdir(real_dir, 'p')
exec "silent! !ln -s Xsym" top2_dir if has('win32')
let &rtp = top2_dir . ',' . top2_dir . '/after' exec "silent! !mklink /d" top2_dir "Xsym"
else
exec "silent! !ln -s Xsym" top2_dir
endif
let &rtp = top2_dir . ',' . expand(top2_dir . '/after')
let &packpath = &rtp let &packpath = &rtp
let s:plugdir = top2_dir . '/pack/mine/opt/mytest' let s:plugdir = expand(top2_dir . '/pack/mine/opt/mytest')
call mkdir(s:plugdir . '/plugin', 'p') call mkdir(s:plugdir . '/plugin', 'p')
exe 'split ' . s:plugdir . '/plugin/test.vim' exe 'split ' . s:plugdir . '/plugin/test.vim'
@ -105,7 +104,7 @@ describe('packadd', function()
packadd mytest packadd mytest
" Must have been inserted in the middle, not at the end " Must have been inserted in the middle, not at the end
call assert_true(&rtp =~ '/pack/mine/opt/mytest,') call assert_true(&rtp =~ escape(expand('/pack/mine/opt/mytest').',', '\'))
call assert_equal(44, g:plugin_works) call assert_equal(44, g:plugin_works)
" No change when doing it again. " No change when doing it again.
@ -115,7 +114,7 @@ describe('packadd', function()
set rtp& set rtp&
let rtp = &rtp let rtp = &rtp
exec "silent !rm" top2_dir exec "silent !" (has('win32') ? "rd /q/s" : "rm") top2_dir
endfunc endfunc
func Test_packloadall() func Test_packloadall()

View File

@ -6,8 +6,6 @@ local clear, command = helpers.clear, helpers.command
local eq, eval = helpers.eq, helpers.eval local eq, eval = helpers.eq, helpers.eval
local wait = helpers.wait local wait = helpers.wait
if helpers.pending_win32(pending) then return end
describe('wordcount', function() describe('wordcount', function()
before_each(clear) before_each(clear)

View File

@ -60,8 +60,7 @@ describe("'wildmenu'", function()
command('set wildmenu wildmode=full') command('set wildmenu wildmode=full')
command('set scrollback=4') command('set scrollback=4')
if iswin() then if iswin() then
if helpers.pending_win32(pending) then return end feed([[:terminal for /L \%I in (1,1,5000) do @(echo foo & echo foo & echo foo)<cr>]])
-- feed([[:terminal 1,2,3,4,5 | foreach-object -process {echo $_; sleep 0.1}]])
else else
feed([[:terminal for i in $(seq 1 5000); do printf 'foo\nfoo\nfoo\n'; sleep 0.1; done<cr>]]) feed([[:terminal for i in $(seq 1 5000); do printf 'foo\nfoo\nfoo\n'; sleep 0.1; done<cr>]])
end end