mirror of
https://github.com/neovim/neovim.git
synced 2025-12-10 00:22:41 +00:00
test(old): add more missing test files and run more tests alone
Copy four files from Vim v8.2.1432.
Try to match Vim's test_alot.vim.
This marks Vim patch 8.2.0164 as ported:
vim-patch:8.2.0164: test_alot takes too long
Problem: Test_alot takes too long.
Solution: Run several tests individually.
842931cd7a
This commit is contained in:
@@ -1,7 +1,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
|
||||
local exc_exec = helpers.exc_exec
|
||||
|
||||
describe('Test for delete()', function()
|
||||
before_each(clear)
|
||||
@@ -9,42 +8,6 @@ describe('Test for delete()', function()
|
||||
os.remove('Xfile')
|
||||
end)
|
||||
|
||||
it('file delete', function()
|
||||
command('split Xfile')
|
||||
command("call setline(1, ['a', 'b'])")
|
||||
command('wq')
|
||||
eq(eval("['a', 'b']"), eval("readfile('Xfile')"))
|
||||
eq(0, eval("delete('Xfile')"))
|
||||
eq(-1, eval("delete('Xfile')"))
|
||||
end)
|
||||
|
||||
it('directory delete', function()
|
||||
command("call mkdir('Xdir1')")
|
||||
eq(1, eval("isdirectory('Xdir1')"))
|
||||
eq(0, eval("delete('Xdir1', 'd')"))
|
||||
eq(0, eval("isdirectory('Xdir1')"))
|
||||
eq(-1, eval("delete('Xdir1', 'd')"))
|
||||
end)
|
||||
it('recursive delete', function()
|
||||
command("call mkdir('Xdir1')")
|
||||
command("call mkdir('Xdir1/subdir')")
|
||||
command("call mkdir('Xdir1/empty')")
|
||||
command('split Xdir1/Xfile')
|
||||
command("call setline(1, ['a', 'b'])")
|
||||
command('w')
|
||||
command('w Xdir1/subdir/Xfile')
|
||||
command('close')
|
||||
|
||||
eq(1, eval("isdirectory('Xdir1')"))
|
||||
eq(eval("['a', 'b']"), eval("readfile('Xdir1/Xfile')"))
|
||||
eq(1, eval("isdirectory('Xdir1/subdir')"))
|
||||
eq(eval("['a', 'b']"), eval("readfile('Xdir1/subdir/Xfile')"))
|
||||
eq(1, eval("'Xdir1/empty'->isdirectory()"))
|
||||
eq(0, eval("delete('Xdir1', 'rf')"))
|
||||
eq(0, eval("isdirectory('Xdir1')"))
|
||||
eq(-1, eval("delete('Xdir1', 'd')"))
|
||||
end)
|
||||
|
||||
it('symlink delete', function()
|
||||
source([[
|
||||
split Xfile
|
||||
@@ -115,10 +78,4 @@ describe('Test for delete()', function()
|
||||
eq(0, eval("delete('Xdir4/Xfile')"))
|
||||
eq(0, eval("delete('Xdir4', 'd')"))
|
||||
end)
|
||||
|
||||
it('gives correct emsgs', function()
|
||||
eq('Vim(call):E474: Invalid argument', exc_exec("call delete('')"))
|
||||
eq('Vim(call):E15: Invalid expression: 0',
|
||||
exc_exec("call delete('foo', 0)"))
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
-- Test getting and setting file permissions.
|
||||
require('os')
|
||||
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local clear, call, eq = helpers.clear, helpers.call, helpers.eq
|
||||
local neq, exc_exec, eval = helpers.neq, helpers.exc_exec, helpers.eval
|
||||
|
||||
describe('Test getting and setting file permissions', function()
|
||||
local tempfile = helpers.tmpname()
|
||||
|
||||
before_each(function()
|
||||
os.remove(tempfile)
|
||||
clear()
|
||||
end)
|
||||
|
||||
it('file permissions', function()
|
||||
-- eval() is used to test VimL method syntax for setfperm() and getfperm()
|
||||
eq('', call('getfperm', tempfile))
|
||||
eq(0, eval("'" .. tempfile .. "'->setfperm('r--------')"))
|
||||
|
||||
call('writefile', {'one'}, tempfile)
|
||||
eq(9, eval("len('" .. tempfile .. "'->getfperm())"))
|
||||
|
||||
eq(1, call('setfperm', tempfile, 'rwx------'))
|
||||
if helpers.is_os('win') then
|
||||
eq('rw-rw-rw-', call('getfperm', tempfile))
|
||||
else
|
||||
eq('rwx------', call('getfperm', tempfile))
|
||||
end
|
||||
|
||||
eq(1, call('setfperm', tempfile, 'r--r--r--'))
|
||||
eq('r--r--r--', call('getfperm', tempfile))
|
||||
|
||||
local err = exc_exec(('call setfperm("%s", "---")'):format(tempfile))
|
||||
neq(err:find('E475:'), nil)
|
||||
|
||||
eq(1, call('setfperm', tempfile, 'rwx------'))
|
||||
end)
|
||||
|
||||
after_each(function()
|
||||
os.remove(tempfile)
|
||||
end)
|
||||
end)
|
||||
@@ -1,35 +0,0 @@
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local call = helpers.call
|
||||
local clear = helpers.clear
|
||||
local command = helpers.command
|
||||
local eq = helpers.eq
|
||||
local eval = helpers.eval
|
||||
local insert = helpers.insert
|
||||
|
||||
describe('searchpos', function()
|
||||
before_each(clear)
|
||||
|
||||
it('is working', function()
|
||||
insert([[
|
||||
1a3
|
||||
123xyz]])
|
||||
|
||||
call('cursor', 1, 1)
|
||||
eq({1, 1, 2}, eval([[searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW')]]))
|
||||
call('cursor', 1, 2)
|
||||
eq({2, 1, 1}, eval([['\%(\([a-z]\)\|\_.\)\{-}xyz'->searchpos('pcW')]]))
|
||||
|
||||
command('set cpo-=c')
|
||||
call('cursor', 1, 2)
|
||||
eq({1, 2, 2}, eval([[searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW')]]))
|
||||
call('cursor', 1, 3)
|
||||
eq({1, 3, 1}, eval([[searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW')]]))
|
||||
|
||||
-- Now with \zs, first match is in column 0, "a" is matched.
|
||||
call('cursor', 1, 3)
|
||||
eq({2, 4, 2}, eval([[searchpos('\%(\([a-z]\)\|\_.\)\{-}\zsxyz', 'pcW')]]))
|
||||
-- With z flag start at cursor column, don't see the "a".
|
||||
call('cursor', 1, 3)
|
||||
eq({2, 4, 1}, eval([[searchpos('\%(\([a-z]\)\|\_.\)\{-}\zsxyz', 'pcWz')]]))
|
||||
end)
|
||||
end)
|
||||
@@ -1,30 +0,0 @@
|
||||
-- Tests for :set
|
||||
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local clear, command, eval, eq =
|
||||
helpers.clear, helpers.command, helpers.eval, helpers.eq
|
||||
|
||||
describe(':set', function()
|
||||
before_each(clear)
|
||||
|
||||
it('handles backslash properly', function()
|
||||
command('set iskeyword=a,b,c')
|
||||
command('set iskeyword+=d')
|
||||
eq('a,b,c,d', eval('&iskeyword'))
|
||||
|
||||
command([[set iskeyword+=\\,e]])
|
||||
eq([[a,b,c,d,\,e]], eval('&iskeyword'))
|
||||
|
||||
command('set iskeyword-=e')
|
||||
eq([[a,b,c,d,\]], eval('&iskeyword'))
|
||||
|
||||
command([[set iskeyword-=\]])
|
||||
eq('a,b,c,d', eval('&iskeyword'))
|
||||
end)
|
||||
|
||||
it('recognizes a trailing comma with +=', function()
|
||||
command('set wildignore=*.png,')
|
||||
command('set wildignore+=*.jpg')
|
||||
eq('*.png,*.jpg', eval('&wildignore'))
|
||||
end)
|
||||
end)
|
||||
Reference in New Issue
Block a user