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 =
helpers.eval, helpers.eq, helpers.retry
local ok = helpers.ok
local iswin = helpers.iswin
if helpers.pending_win32(pending) then return end
describe('TermClose event', function()
before_each(function()
@ -23,7 +23,7 @@ describe('TermClose event', function()
end)
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('terminal')
command('call jobstop(b:terminal_job_id)')
@ -31,6 +31,7 @@ describe('TermClose event', function()
end)
it('kills job trapping SIGTERM', function()
if helpers.pending_win32(pending) 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', { ]]
@ -48,6 +49,7 @@ describe('TermClose event', function()
end)
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', 'shellcmdflag', '-c')
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()
nvim('command', "let g:job_opts.cwd = '/'")
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
nvim('command', "let j = jobstart('pwd', g:job_opts)")
end
@ -75,7 +75,7 @@ describe('jobs', function()
mkdir(dir)
nvim('command', "let g:job_opts.cwd = '" .. dir .. "'")
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
nvim('command', "let j = jobstart('pwd', g:job_opts)")
end
@ -115,13 +115,13 @@ describe('jobs', function()
end)
it('returns -1 when target is not executable #5465', function()
if helpers.pending_win32(pending) then return end
local function new_job()
return eval([[jobstart('')]])
end
local executable_jobid = new_job()
local nonexecutable_jobid = eval(
"jobstart(['./test/functional/fixtures/non_executable.txt'])")
local nonexecutable_jobid = eval("jobstart(['"..(iswin()
and './test/functional/fixtures'
or './test/functional/fixtures/non_executable.txt').."'])")
eq(-1, nonexecutable_jobid)
-- Should _not_ throw an error.
eq("", eval("v:errmsg"))
@ -133,11 +133,10 @@ describe('jobs', function()
-- TODO: hangs on Windows
if helpers.pending_win32(pending) then return end
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, {'', ''}}},
{'notification', 'stdout', {0, {''}}}},
{{'notification', 'stderr', {0, {''}}}})
eq({'notification', 'exit', {0, 0}}, next_msg())
end)
@ -253,7 +252,6 @@ describe('jobs', function()
end)
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)")
end)
@ -299,14 +297,6 @@ describe('jobs', function()
eq({'notification', 'exit', {data, 0}}, next_msg())
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()
nvim('command', 'unlet g:job_opts.on_stdout')
nvim('command', 'let g:job_opts.user = 5')
@ -348,7 +338,6 @@ describe('jobs', function()
end)
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()
screen:attach()
screen:set_default_attr_ids({
@ -363,7 +352,7 @@ describe('jobs', function()
\ 'on_stderr': function('g:JobHandler'),
\ 'on_exit': function('g:JobHandler')
\ }
let job = jobstart('cat -', g:callbacks)
let job = jobstart(['cat', '-'], g:callbacks)
]])
wait()
source([[

View File

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

View File

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

View File

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

View File

@ -641,7 +641,7 @@ local function redir_exec(cmd)
end
local function get_pathsep()
return funcs.fnamemodify('.', ':p'):sub(-1)
return iswin() and '\\' or '/'
end
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.dedent, helpers.write_file, helpers.feed
if helpers.pending_win32(pending) then return end
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
local function prepare_gz_file(name, text)
@ -142,6 +141,7 @@ describe('file reading, writing and bufnew and filter autocommands', function()
end)
it('FilterReadPre, FilterReadPost', function()
if helpers.pending_win32(pending) then return end
-- Write a special input file for this test block.
write_file('test.out', dedent([[
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 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()
setup(clear)
@ -25,12 +23,17 @@ describe('jump to a tag with hidden set', function()
feed_command('set hidden')
-- Create a link from test25.dir to the current directory.
feed_command('!rm -f test25.dir')
feed_command('!ln -s . test25.dir')
if helpers.iswin() then
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.
feed_command('/tags line')
feed_command('r !pwd')
feed_command('r !' .. (helpers.iswin() and 'cd' or 'pwd'))
feed('d$/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'.
feed_command('set tags=tags.test')
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
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 wait = helpers.wait
if helpers.pending_win32(pending) then return end
describe('fileformats option', function()
setup(function()
clear()

View File

@ -8,8 +8,6 @@ local eq = helpers.eq
local wait = helpers.wait
local exc_exec = helpers.exc_exec
if helpers.pending_win32(pending) then return end
describe(':highlight', function()
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 write_file, call = helpers.write_file, helpers.call
if helpers.pending_win32(pending) then return end
local function write_latin1(name, text)
text = call('iconv', text, 'utf-8', 'latin-1')
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.
local function test_one(aff, dic)
-- Generate a .spl file from a .dic and .aff file.
os.execute('cp -f Xtest'..aff..'.aff Xtest.aff')
os.execute('cp -f Xtest'..dic..'.dic Xtest.dic')
if helpers.iswin() then
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([[
set spellfile=
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('oeverloos gezwets edale')]])
-- 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([[$put =soundfold('goobledygoook')]])
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 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()
setup(clear)

View File

@ -6,15 +6,19 @@ local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local command, expect = helpers.command, helpers.expect
if helpers.pending_win32(pending) then return end
describe('glob() and globpath()', function()
setup(clear)
setup(function()
os.execute("mkdir -p sautest/autoload")
os.execute("touch sautest/autoload/Test104.vim")
os.execute("touch sautest/autoload/footest.vim")
if helpers.iswin() then
os.execute("md sautest\\autoload")
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)
it('is working', function()
@ -24,29 +28,55 @@ describe('glob() and globpath()', function()
-- Consistent sorting of file names
command('set nofileignorecase')
command([[$put =glob('Xxx\{')]])
command([[$put =glob('Xxx\$')]])
if helpers.iswin() then
command([[$put =glob('Xxx{')]])
command([[$put =glob('Xxx$')]])
command('silent w! Xxx{')
command([[w! Xxx\$]])
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([=[
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']]=])
Xxx{
Xxx$
'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)
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)

View File

@ -8,8 +8,6 @@ local clear = helpers.clear
local insert = helpers.insert
local command = helpers.command
if helpers.pending_win32(pending) then return end
describe('107', function()
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 eval, exc_exec, neq = helpers.eval, helpers.exc_exec, helpers.neq
if helpers.pending_win32(pending) then return end
describe('argument list commands', function()
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 eq, eval, command = helpers.eq, helpers.eval, helpers.command
if helpers.pending_win32(pending) then return end
describe('Test for delete()', function()
before_each(clear)
@ -48,7 +46,11 @@ describe('Test for delete()', function()
split Xfile
call setline(1, ['a', 'b'])
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
eq(0, eval("delete('Xlink')"))
@ -58,7 +60,11 @@ describe('Test for delete()', function()
it('symlink directory delete', function()
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('Xlink')"))
-- Delete the link, not the directory
@ -78,7 +84,11 @@ describe('Test for delete()', function()
w Xdir3/subdir/Xfile
w Xdir4/Xfile
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')"))

View File

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

View File

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

View File

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

View File

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