mirror of
https://github.com/neovim/neovim.git
synced 2025-11-21 09:36:29 +00:00
Merge #6481 from ZyX-I/rename-execute
Rename execute() function to feed_command()
This commit is contained in:
@@ -5,7 +5,8 @@ for p in ("${TEST_INCLUDE_DIRS}" .. ";"):gmatch("[^;]+") do
|
|||||||
table.insert(module.include_paths, p)
|
table.insert(module.include_paths, p)
|
||||||
end
|
end
|
||||||
|
|
||||||
module.test_include_path = "${CMAKE_BINARY_DIR}/test/includes/post"
|
module.test_build_dir = "${CMAKE_BINARY_DIR}"
|
||||||
|
module.test_include_path = module.test_build_dir .. "/test/includes/post"
|
||||||
module.test_libnvim_path = "${TEST_LIBNVIM_PATH}"
|
module.test_libnvim_path = "${TEST_LIBNVIM_PATH}"
|
||||||
module.test_source_path = "${CMAKE_SOURCE_DIR}"
|
module.test_source_path = "${CMAKE_SOURCE_DIR}"
|
||||||
module.test_lua_prg = "${LUA_PRG}"
|
module.test_lua_prg = "${LUA_PRG}"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ local curbufmeths, ok = helpers.curbufmeths, helpers.ok
|
|||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local request = helpers.request
|
local request = helpers.request
|
||||||
local exc_exec = helpers.exc_exec
|
local exc_exec = helpers.exc_exec
|
||||||
local execute = helpers.execute
|
local feed_command = helpers.feed_command
|
||||||
local insert = helpers.insert
|
local insert = helpers.insert
|
||||||
local NIL = helpers.NIL
|
local NIL = helpers.NIL
|
||||||
local meth_pcall = helpers.meth_pcall
|
local meth_pcall = helpers.meth_pcall
|
||||||
@@ -246,7 +246,7 @@ describe('api/buf', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it("set_line on alternate buffer does not access invalid line (E315)", function()
|
it("set_line on alternate buffer does not access invalid line (E315)", function()
|
||||||
execute('set hidden')
|
feed_command('set hidden')
|
||||||
insert('Initial file')
|
insert('Initial file')
|
||||||
command('enew')
|
command('enew')
|
||||||
insert([[
|
insert([[
|
||||||
@@ -257,7 +257,7 @@ describe('api/buf', function()
|
|||||||
The
|
The
|
||||||
Other
|
Other
|
||||||
Buffer]])
|
Buffer]])
|
||||||
execute('$')
|
feed_command('$')
|
||||||
local retval = exc_exec("call nvim_buf_set_lines(1, 0, 1, v:false, ['test'])")
|
local retval = exc_exec("call nvim_buf_set_lines(1, 0, 1, v:false, ['test'])")
|
||||||
eq(0, retval)
|
eq(0, retval)
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local eq, clear, eval, execute, nvim, next_message =
|
local eq, clear, eval, command, nvim, next_message =
|
||||||
helpers.eq, helpers.clear, helpers.eval, helpers.execute, helpers.nvim,
|
helpers.eq, helpers.clear, helpers.eval, helpers.command, helpers.nvim,
|
||||||
helpers.next_message
|
helpers.next_message
|
||||||
local meths = helpers.meths
|
local meths = helpers.meths
|
||||||
|
|
||||||
@@ -16,8 +16,8 @@ describe('notify', function()
|
|||||||
it('sends the notification/args to the corresponding channel', function()
|
it('sends the notification/args to the corresponding channel', function()
|
||||||
eval('rpcnotify('..channel..', "test-event", 1, 2, 3)')
|
eval('rpcnotify('..channel..', "test-event", 1, 2, 3)')
|
||||||
eq({'notification', 'test-event', {1, 2, 3}}, next_message())
|
eq({'notification', 'test-event', {1, 2, 3}}, next_message())
|
||||||
execute('au FileType lua call rpcnotify('..channel..', "lua!")')
|
command('au FileType lua call rpcnotify('..channel..', "lua!")')
|
||||||
execute('set filetype=lua')
|
command('set filetype=lua')
|
||||||
eq({'notification', 'lua!', {}}, next_message())
|
eq({'notification', 'lua!', {}}, next_message())
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
-- Test server -> client RPC scenarios. Note: unlike `rpcnotify`, to evaluate
|
-- Test server -> client RPC scenarios. Note: unlike `rpcnotify`, to evaluate
|
||||||
-- `rpcrequest` calls we need the client event loop to be running.
|
-- `rpcrequest` calls we need the client event loop to be running.
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
local Paths = require('test.config.paths')
|
||||||
|
|
||||||
local clear, nvim, eval = helpers.clear, helpers.nvim, helpers.eval
|
local clear, nvim, eval = helpers.clear, helpers.nvim, helpers.eval
|
||||||
local eq, neq, run, stop = helpers.eq, helpers.neq, helpers.run, helpers.stop
|
local eq, neq, run, stop = helpers.eq, helpers.neq, helpers.run, helpers.stop
|
||||||
local nvim_prog, command, funcs = helpers.nvim_prog, helpers.command, helpers.funcs
|
local nvim_prog, command, funcs = helpers.nvim_prog, helpers.command, helpers.funcs
|
||||||
@@ -200,7 +202,7 @@ describe('server -> client', function()
|
|||||||
\ 'rpc': v:true
|
\ 'rpc': v:true
|
||||||
\ }
|
\ }
|
||||||
]])
|
]])
|
||||||
local lua_prog = arg[-1]
|
local lua_prog = Paths.test_lua_prg
|
||||||
meths.set_var("args", {lua_prog, 'test/functional/api/rpc_fixture.lua'})
|
meths.set_var("args", {lua_prog, 'test/functional/api/rpc_fixture.lua'})
|
||||||
jobid = eval("jobstart(g:args, g:job_opts)")
|
jobid = eval("jobstart(g:args, g:job_opts)")
|
||||||
neq(0, 'jobid')
|
neq(0, 'jobid')
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
|
||||||
local clear = helpers.clear
|
|
||||||
local command = helpers.command
|
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
|
local clear = helpers.clear
|
||||||
|
local meths = helpers.meths
|
||||||
|
local expect = helpers.expect
|
||||||
|
local command = helpers.command
|
||||||
|
local exc_exec = helpers.exc_exec
|
||||||
|
local curbufmeths = helpers.curbufmeths
|
||||||
|
|
||||||
describe('autocmds:', function()
|
describe('autocmds:', function()
|
||||||
before_each(clear)
|
before_each(clear)
|
||||||
@@ -33,4 +37,22 @@ describe('autocmds:', function()
|
|||||||
it('v:vim_did_enter is 1 after VimEnter', function()
|
it('v:vim_did_enter is 1 after VimEnter', function()
|
||||||
eq(1, eval('v:vim_did_enter'))
|
eq(1, eval('v:vim_did_enter'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
describe('BufLeave autocommand', function()
|
||||||
|
it('can wipe out the buffer created by :edit which triggered autocmd',
|
||||||
|
function()
|
||||||
|
meths.set_option('hidden', true)
|
||||||
|
curbufmeths.set_lines(0, 1, false, {
|
||||||
|
'start of test file xx',
|
||||||
|
'end of test file xx'})
|
||||||
|
|
||||||
|
command('autocmd BufLeave * bwipeout yy')
|
||||||
|
eq('Vim(edit):E143: Autocommands unexpectedly deleted new buffer yy',
|
||||||
|
exc_exec('edit yy'))
|
||||||
|
|
||||||
|
expect([[
|
||||||
|
start of test file xx
|
||||||
|
end of test file xx]])
|
||||||
|
end)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ local clear = helpers.clear
|
|||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
local execute = helpers.execute
|
|
||||||
local request = helpers.request
|
local request = helpers.request
|
||||||
local source = helpers.source
|
local source = helpers.source
|
||||||
|
|
||||||
@@ -28,7 +27,7 @@ describe('autocmd BufEnter', function()
|
|||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
]])
|
]])
|
||||||
execute("call Test()")
|
command("call Test()")
|
||||||
eq(1, eval("exists('g:dir_bufenter')")) -- Did BufEnter for the directory.
|
eq(1, eval("exists('g:dir_bufenter')")) -- Did BufEnter for the directory.
|
||||||
eq(2, eval("bufnr('%')")) -- Switched to the dir buffer.
|
eq(2, eval("bufnr('%')")) -- Switched to the dir buffer.
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear, eval, eq = helpers.clear, helpers.eval, helpers.eq
|
local clear, eval, eq = helpers.clear, helpers.eval, helpers.eq
|
||||||
local feed, execute, expect, command = helpers.feed, helpers.execute, helpers.expect, helpers.command
|
local feed, command, expect = helpers.feed, helpers.command, helpers.expect
|
||||||
local curbufmeths, funcs, neq = helpers.curbufmeths, helpers.funcs, helpers.neq
|
local curbufmeths, funcs, neq = helpers.curbufmeths, helpers.funcs, helpers.neq
|
||||||
|
|
||||||
describe('TextYankPost', function()
|
describe('TextYankPost', function()
|
||||||
@@ -8,11 +8,11 @@ describe('TextYankPost', function()
|
|||||||
clear()
|
clear()
|
||||||
|
|
||||||
-- emulate the clipboard so system clipboard isn't affected
|
-- emulate the clipboard so system clipboard isn't affected
|
||||||
execute('let &rtp = "test/functional/fixtures,".&rtp')
|
command('let &rtp = "test/functional/fixtures,".&rtp')
|
||||||
|
|
||||||
execute('let g:count = 0')
|
command('let g:count = 0')
|
||||||
execute('autocmd TextYankPost * let g:event = copy(v:event)')
|
command('autocmd TextYankPost * let g:event = copy(v:event)')
|
||||||
execute('autocmd TextYankPost * let g:count += 1')
|
command('autocmd TextYankPost * let g:count += 1')
|
||||||
|
|
||||||
curbufmeths.set_lines(0, -1, true, {
|
curbufmeths.set_lines(0, -1, true, {
|
||||||
'foo\0bar',
|
'foo\0bar',
|
||||||
@@ -61,27 +61,27 @@ describe('TextYankPost', function()
|
|||||||
regtype = 'V'
|
regtype = 'V'
|
||||||
}, eval('g:event'))
|
}, eval('g:event'))
|
||||||
|
|
||||||
execute('set debug=msg')
|
command('set debug=msg')
|
||||||
-- the regcontents should not be changed without copy.
|
-- the regcontents should not be changed without copy.
|
||||||
local status, err = pcall(command,'call extend(g:event.regcontents, ["more text"])')
|
local status, err = pcall(command,'call extend(g:event.regcontents, ["more text"])')
|
||||||
eq(status,false)
|
eq(status,false)
|
||||||
neq(nil, string.find(err, ':E742:'))
|
neq(nil, string.find(err, ':E742:'))
|
||||||
|
|
||||||
-- can't mutate keys inside the autocommand
|
-- can't mutate keys inside the autocommand
|
||||||
execute('autocmd! TextYankPost * let v:event.regcontents = 0')
|
command('autocmd! TextYankPost * let v:event.regcontents = 0')
|
||||||
status, err = pcall(command,'normal yy')
|
status, err = pcall(command,'normal yy')
|
||||||
eq(status,false)
|
eq(status,false)
|
||||||
neq(nil, string.find(err, ':E46:'))
|
neq(nil, string.find(err, ':E46:'))
|
||||||
|
|
||||||
-- can't add keys inside the autocommand
|
-- can't add keys inside the autocommand
|
||||||
execute('autocmd! TextYankPost * let v:event.mykey = 0')
|
command('autocmd! TextYankPost * let v:event.mykey = 0')
|
||||||
status, err = pcall(command,'normal yy')
|
status, err = pcall(command,'normal yy')
|
||||||
eq(status,false)
|
eq(status,false)
|
||||||
neq(nil, string.find(err, ':E742:'))
|
neq(nil, string.find(err, ':E742:'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('is not invoked recursively', function()
|
it('is not invoked recursively', function()
|
||||||
execute('autocmd TextYankPost * normal "+yy')
|
command('autocmd TextYankPost * normal "+yy')
|
||||||
feed('yy')
|
feed('yy')
|
||||||
eq({
|
eq({
|
||||||
operator = 'y',
|
operator = 'y',
|
||||||
@@ -134,7 +134,7 @@ describe('TextYankPost', function()
|
|||||||
feed('"_yy')
|
feed('"_yy')
|
||||||
eq(0, eval('g:count'))
|
eq(0, eval('g:count'))
|
||||||
|
|
||||||
execute('delete _')
|
command('delete _')
|
||||||
eq(0, eval('g:count'))
|
eq(0, eval('g:count'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ describe('TextYankPost', function()
|
|||||||
regtype = 'V'
|
regtype = 'V'
|
||||||
}, eval('g:event'))
|
}, eval('g:event'))
|
||||||
|
|
||||||
execute("set clipboard=unnamed")
|
command("set clipboard=unnamed")
|
||||||
|
|
||||||
-- regname still shows the name the user requested
|
-- regname still shows the name the user requested
|
||||||
feed('yy')
|
feed('yy')
|
||||||
@@ -176,7 +176,7 @@ describe('TextYankPost', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('works with Ex commands', function()
|
it('works with Ex commands', function()
|
||||||
execute('1delete +')
|
command('1delete +')
|
||||||
eq({
|
eq({
|
||||||
operator = 'd',
|
operator = 'd',
|
||||||
regcontents = { 'foo\nbar' },
|
regcontents = { 'foo\nbar' },
|
||||||
@@ -185,7 +185,7 @@ describe('TextYankPost', function()
|
|||||||
}, eval('g:event'))
|
}, eval('g:event'))
|
||||||
eq(1, eval('g:count'))
|
eq(1, eval('g:count'))
|
||||||
|
|
||||||
execute('yank')
|
command('yank')
|
||||||
eq({
|
eq({
|
||||||
operator = 'y',
|
operator = 'y',
|
||||||
regcontents = { 'baz text' },
|
regcontents = { 'baz text' },
|
||||||
@@ -194,7 +194,7 @@ describe('TextYankPost', function()
|
|||||||
}, eval('g:event'))
|
}, eval('g:event'))
|
||||||
eq(2, eval('g:count'))
|
eq(2, eval('g:count'))
|
||||||
|
|
||||||
execute('normal yw')
|
command('normal yw')
|
||||||
eq({
|
eq({
|
||||||
operator = 'y',
|
operator = 'y',
|
||||||
regcontents = { 'baz ' },
|
regcontents = { 'baz ' },
|
||||||
@@ -203,7 +203,7 @@ describe('TextYankPost', function()
|
|||||||
}, eval('g:event'))
|
}, eval('g:event'))
|
||||||
eq(3, eval('g:count'))
|
eq(3, eval('g:count'))
|
||||||
|
|
||||||
execute('normal! dd')
|
command('normal! dd')
|
||||||
eq({
|
eq({
|
||||||
operator = 'd',
|
operator = 'd',
|
||||||
regcontents = { 'baz text' },
|
regcontents = { 'baz text' },
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
|
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
|
||||||
local execute, expect, eq, eval = helpers.execute, helpers.expect, helpers.eq, helpers.eval
|
local feed_command, expect, eq, eval = helpers.feed_command, helpers.expect, helpers.eq, helpers.eval
|
||||||
|
|
||||||
local function basic_register_test(noblock)
|
local function basic_register_test(noblock)
|
||||||
insert("some words")
|
insert("some words")
|
||||||
@@ -95,7 +95,7 @@ describe('clipboard usage', function()
|
|||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
reset()
|
reset()
|
||||||
execute('call getreg("*")') -- force load of provider
|
feed_command('call getreg("*")') -- force load of provider
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('has independent "* and unnamed registers per default', function()
|
it('has independent "* and unnamed registers per default', function()
|
||||||
@@ -140,8 +140,8 @@ describe('clipboard usage', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('support autodectection of regtype', function()
|
it('support autodectection of regtype', function()
|
||||||
execute("let g:test_clip['*'] = ['linewise stuff','']")
|
feed_command("let g:test_clip['*'] = ['linewise stuff','']")
|
||||||
execute("let g:test_clip['+'] = ['charwise','stuff']")
|
feed_command("let g:test_clip['+'] = ['charwise','stuff']")
|
||||||
eq("V", eval("getregtype('*')"))
|
eq("V", eval("getregtype('*')"))
|
||||||
eq("v", eval("getregtype('+')"))
|
eq("v", eval("getregtype('+')"))
|
||||||
insert("just some text")
|
insert("just some text")
|
||||||
@@ -156,7 +156,7 @@ describe('clipboard usage', function()
|
|||||||
insert([[
|
insert([[
|
||||||
much
|
much
|
||||||
text]])
|
text]])
|
||||||
execute("let g:test_clip['*'] = [['very','block'],'b']")
|
feed_command("let g:test_clip['*'] = [['very','block'],'b']")
|
||||||
feed('gg"*P')
|
feed('gg"*P')
|
||||||
expect([[
|
expect([[
|
||||||
very much
|
very much
|
||||||
@@ -170,15 +170,15 @@ describe('clipboard usage', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('supports setreg', function()
|
it('supports setreg', function()
|
||||||
execute('call setreg("*", "setted\\ntext", "c")')
|
feed_command('call setreg("*", "setted\\ntext", "c")')
|
||||||
execute('call setreg("+", "explicitly\\nlines", "l")')
|
feed_command('call setreg("+", "explicitly\\nlines", "l")')
|
||||||
feed('"+P"*p')
|
feed('"+P"*p')
|
||||||
expect([[
|
expect([[
|
||||||
esetted
|
esetted
|
||||||
textxplicitly
|
textxplicitly
|
||||||
lines
|
lines
|
||||||
]])
|
]])
|
||||||
execute('call setreg("+", "blocky\\nindeed", "b")')
|
feed_command('call setreg("+", "blocky\\nindeed", "b")')
|
||||||
feed('"+p')
|
feed('"+p')
|
||||||
expect([[
|
expect([[
|
||||||
esblockyetted
|
esblockyetted
|
||||||
@@ -188,13 +188,13 @@ describe('clipboard usage', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('supports let @+ (issue #1427)', function()
|
it('supports let @+ (issue #1427)', function()
|
||||||
execute("let @+ = 'some'")
|
feed_command("let @+ = 'some'")
|
||||||
execute("let @* = ' other stuff'")
|
feed_command("let @* = ' other stuff'")
|
||||||
eq({{'some'}, 'v'}, eval("g:test_clip['+']"))
|
eq({{'some'}, 'v'}, eval("g:test_clip['+']"))
|
||||||
eq({{' other stuff'}, 'v'}, eval("g:test_clip['*']"))
|
eq({{' other stuff'}, 'v'}, eval("g:test_clip['*']"))
|
||||||
feed('"+p"*p')
|
feed('"+p"*p')
|
||||||
expect('some other stuff')
|
expect('some other stuff')
|
||||||
execute("let @+ .= ' more'")
|
feed_command("let @+ .= ' more'")
|
||||||
feed('dd"+p')
|
feed('dd"+p')
|
||||||
expect('some more')
|
expect('some more')
|
||||||
end)
|
end)
|
||||||
@@ -202,7 +202,7 @@ describe('clipboard usage', function()
|
|||||||
it('pastes unnamed register if the provider fails', function()
|
it('pastes unnamed register if the provider fails', function()
|
||||||
insert('the text')
|
insert('the text')
|
||||||
feed('yy')
|
feed('yy')
|
||||||
execute("let g:cliperror = 1")
|
feed_command("let g:cliperror = 1")
|
||||||
feed('"*p')
|
feed('"*p')
|
||||||
expect([[
|
expect([[
|
||||||
the text
|
the text
|
||||||
@@ -214,7 +214,7 @@ describe('clipboard usage', function()
|
|||||||
-- the basic behavior of unnamed register should be the same
|
-- the basic behavior of unnamed register should be the same
|
||||||
-- even when handled by clipboard provider
|
-- even when handled by clipboard provider
|
||||||
before_each(function()
|
before_each(function()
|
||||||
execute('set clipboard=unnamed')
|
feed_command('set clipboard=unnamed')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('works', function()
|
it('works', function()
|
||||||
@@ -222,7 +222,7 @@ describe('clipboard usage', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('works with pure text clipboard', function()
|
it('works with pure text clipboard', function()
|
||||||
execute("let g:cliplossy = 1")
|
feed_command("let g:cliplossy = 1")
|
||||||
-- expect failure for block mode
|
-- expect failure for block mode
|
||||||
basic_register_test(true)
|
basic_register_test(true)
|
||||||
end)
|
end)
|
||||||
@@ -237,7 +237,7 @@ describe('clipboard usage', function()
|
|||||||
-- "+ shouldn't have changed
|
-- "+ shouldn't have changed
|
||||||
eq({''}, eval("g:test_clip['+']"))
|
eq({''}, eval("g:test_clip['+']"))
|
||||||
|
|
||||||
execute("let g:test_clip['*'] = ['linewise stuff','']")
|
feed_command("let g:test_clip['*'] = ['linewise stuff','']")
|
||||||
feed('p')
|
feed('p')
|
||||||
expect([[
|
expect([[
|
||||||
words
|
words
|
||||||
@@ -247,7 +247,7 @@ describe('clipboard usage', function()
|
|||||||
it('does not clobber "0 when pasting', function()
|
it('does not clobber "0 when pasting', function()
|
||||||
insert('a line')
|
insert('a line')
|
||||||
feed('yy')
|
feed('yy')
|
||||||
execute("let g:test_clip['*'] = ['b line','']")
|
feed_command("let g:test_clip['*'] = ['b line','']")
|
||||||
feed('"0pp"0p')
|
feed('"0pp"0p')
|
||||||
expect([[
|
expect([[
|
||||||
a line
|
a line
|
||||||
@@ -258,20 +258,20 @@ describe('clipboard usage', function()
|
|||||||
|
|
||||||
it('supports v:register and getreg() without parameters', function()
|
it('supports v:register and getreg() without parameters', function()
|
||||||
eq('*', eval('v:register'))
|
eq('*', eval('v:register'))
|
||||||
execute("let g:test_clip['*'] = [['some block',''], 'b']")
|
feed_command("let g:test_clip['*'] = [['some block',''], 'b']")
|
||||||
eq('some block', eval('getreg()'))
|
eq('some block', eval('getreg()'))
|
||||||
eq('\02210', eval('getregtype()'))
|
eq('\02210', eval('getregtype()'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('yanks visual selection when pasting', function()
|
it('yanks visual selection when pasting', function()
|
||||||
insert("indeed visual")
|
insert("indeed visual")
|
||||||
execute("let g:test_clip['*'] = [['clipboard'], 'c']")
|
feed_command("let g:test_clip['*'] = [['clipboard'], 'c']")
|
||||||
feed("viwp")
|
feed("viwp")
|
||||||
eq({{'visual'}, 'v'}, eval("g:test_clip['*']"))
|
eq({{'visual'}, 'v'}, eval("g:test_clip['*']"))
|
||||||
expect("indeed clipboard")
|
expect("indeed clipboard")
|
||||||
|
|
||||||
-- explicit "* should do the same
|
-- explicit "* should do the same
|
||||||
execute("let g:test_clip['*'] = [['star'], 'c']")
|
feed_command("let g:test_clip['*'] = [['star'], 'c']")
|
||||||
feed('viw"*p')
|
feed('viw"*p')
|
||||||
eq({{'clipboard'}, 'v'}, eval("g:test_clip['*']"))
|
eq({{'clipboard'}, 'v'}, eval("g:test_clip['*']"))
|
||||||
expect("indeed star")
|
expect("indeed star")
|
||||||
@@ -280,7 +280,7 @@ describe('clipboard usage', function()
|
|||||||
it('unamed operations work even if the provider fails', function()
|
it('unamed operations work even if the provider fails', function()
|
||||||
insert('the text')
|
insert('the text')
|
||||||
feed('yy')
|
feed('yy')
|
||||||
execute("let g:cliperror = 1")
|
feed_command("let g:cliperror = 1")
|
||||||
feed('p')
|
feed('p')
|
||||||
expect([[
|
expect([[
|
||||||
the text
|
the text
|
||||||
@@ -294,11 +294,11 @@ describe('clipboard usage', function()
|
|||||||
match
|
match
|
||||||
text
|
text
|
||||||
]])
|
]])
|
||||||
execute('g/match/d')
|
feed_command('g/match/d')
|
||||||
eq('match\n', eval('getreg("*")'))
|
eq('match\n', eval('getreg("*")'))
|
||||||
feed('u')
|
feed('u')
|
||||||
eval('setreg("*", "---")')
|
eval('setreg("*", "---")')
|
||||||
execute('g/test/')
|
feed_command('g/test/')
|
||||||
feed('<esc>')
|
feed('<esc>')
|
||||||
eq('---', eval('getreg("*")'))
|
eq('---', eval('getreg("*")'))
|
||||||
end)
|
end)
|
||||||
@@ -307,7 +307,7 @@ describe('clipboard usage', function()
|
|||||||
|
|
||||||
describe('with clipboard=unnamedplus', function()
|
describe('with clipboard=unnamedplus', function()
|
||||||
before_each(function()
|
before_each(function()
|
||||||
execute('set clipboard=unnamedplus')
|
feed_command('set clipboard=unnamedplus')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('links the "+ and unnamed registers', function()
|
it('links the "+ and unnamed registers', function()
|
||||||
@@ -320,13 +320,13 @@ describe('clipboard usage', function()
|
|||||||
-- "* shouldn't have changed
|
-- "* shouldn't have changed
|
||||||
eq({''}, eval("g:test_clip['*']"))
|
eq({''}, eval("g:test_clip['*']"))
|
||||||
|
|
||||||
execute("let g:test_clip['+'] = ['three']")
|
feed_command("let g:test_clip['+'] = ['three']")
|
||||||
feed('p')
|
feed('p')
|
||||||
expect('twothree')
|
expect('twothree')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('and unnamed, yanks to both', function()
|
it('and unnamed, yanks to both', function()
|
||||||
execute('set clipboard=unnamedplus,unnamed')
|
feed_command('set clipboard=unnamedplus,unnamed')
|
||||||
insert([[
|
insert([[
|
||||||
really unnamed
|
really unnamed
|
||||||
text]])
|
text]])
|
||||||
@@ -340,8 +340,8 @@ describe('clipboard usage', function()
|
|||||||
|
|
||||||
-- unnamedplus takes predecence when pasting
|
-- unnamedplus takes predecence when pasting
|
||||||
eq('+', eval('v:register'))
|
eq('+', eval('v:register'))
|
||||||
execute("let g:test_clip['+'] = ['the plus','']")
|
feed_command("let g:test_clip['+'] = ['the plus','']")
|
||||||
execute("let g:test_clip['*'] = ['the star','']")
|
feed_command("let g:test_clip['*'] = ['the star','']")
|
||||||
feed("p")
|
feed("p")
|
||||||
expect([[
|
expect([[
|
||||||
text
|
text
|
||||||
@@ -356,11 +356,11 @@ describe('clipboard usage', function()
|
|||||||
match
|
match
|
||||||
text
|
text
|
||||||
]])
|
]])
|
||||||
execute('g/match/d')
|
feed_command('g/match/d')
|
||||||
eq('match\n', eval('getreg("+")'))
|
eq('match\n', eval('getreg("+")'))
|
||||||
feed('u')
|
feed('u')
|
||||||
eval('setreg("+", "---")')
|
eval('setreg("+", "---")')
|
||||||
execute('g/test/')
|
feed_command('g/test/')
|
||||||
feed('<esc>')
|
feed('<esc>')
|
||||||
eq('---', eval('getreg("+")'))
|
eq('---', eval('getreg("+")'))
|
||||||
end)
|
end)
|
||||||
@@ -375,13 +375,13 @@ describe('clipboard usage', function()
|
|||||||
|
|
||||||
it('supports :put', function()
|
it('supports :put', function()
|
||||||
insert("a line")
|
insert("a line")
|
||||||
execute("let g:test_clip['*'] = ['some text']")
|
feed_command("let g:test_clip['*'] = ['some text']")
|
||||||
execute("let g:test_clip['+'] = ['more', 'text', '']")
|
feed_command("let g:test_clip['+'] = ['more', 'text', '']")
|
||||||
execute(":put *")
|
feed_command(":put *")
|
||||||
expect([[
|
expect([[
|
||||||
a line
|
a line
|
||||||
some text]])
|
some text]])
|
||||||
execute(":put +")
|
feed_command(":put +")
|
||||||
expect([[
|
expect([[
|
||||||
a line
|
a line
|
||||||
some text
|
some text
|
||||||
@@ -392,9 +392,9 @@ describe('clipboard usage', function()
|
|||||||
it('supports "+ and "* in registers', function()
|
it('supports "+ and "* in registers', function()
|
||||||
local screen = Screen.new(60, 10)
|
local screen = Screen.new(60, 10)
|
||||||
screen:attach()
|
screen:attach()
|
||||||
execute("let g:test_clip['*'] = ['some', 'star data','']")
|
feed_command("let g:test_clip['*'] = ['some', 'star data','']")
|
||||||
execute("let g:test_clip['+'] = ['such', 'plus', 'stuff']")
|
feed_command("let g:test_clip['+'] = ['such', 'plus', 'stuff']")
|
||||||
execute("registers")
|
feed_command("registers")
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
@@ -418,17 +418,17 @@ describe('clipboard usage', function()
|
|||||||
insert('s/s/t/')
|
insert('s/s/t/')
|
||||||
feed('gg"*y$:<c-r>*<cr>')
|
feed('gg"*y$:<c-r>*<cr>')
|
||||||
expect('t/s/t/')
|
expect('t/s/t/')
|
||||||
execute("let g:test_clip['*'] = ['s/s/u']")
|
feed_command("let g:test_clip['*'] = ['s/s/u']")
|
||||||
feed(':<c-r>*<cr>')
|
feed(':<c-r>*<cr>')
|
||||||
expect('t/u/t/')
|
expect('t/u/t/')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('supports :redir @*>', function()
|
it('supports :redir @*>', function()
|
||||||
execute("let g:test_clip['*'] = ['stuff']")
|
feed_command("let g:test_clip['*'] = ['stuff']")
|
||||||
execute('redir @*>')
|
feed_command('redir @*>')
|
||||||
-- it is made empty
|
-- it is made empty
|
||||||
eq({{''}, 'v'}, eval("g:test_clip['*']"))
|
eq({{''}, 'v'}, eval("g:test_clip['*']"))
|
||||||
execute('let g:test = doesnotexist')
|
feed_command('let g:test = doesnotexist')
|
||||||
feed('<cr>')
|
feed('<cr>')
|
||||||
eq({{
|
eq({{
|
||||||
'',
|
'',
|
||||||
@@ -436,7 +436,7 @@ describe('clipboard usage', function()
|
|||||||
'E121: Undefined variable: doesnotexist',
|
'E121: Undefined variable: doesnotexist',
|
||||||
'E15: Invalid expression: doesnotexist',
|
'E15: Invalid expression: doesnotexist',
|
||||||
}, 'v'}, eval("g:test_clip['*']"))
|
}, 'v'}, eval("g:test_clip['*']"))
|
||||||
execute(':echo "Howdy!"')
|
feed_command(':echo "Howdy!"')
|
||||||
eq({{
|
eq({{
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
@@ -448,7 +448,7 @@ describe('clipboard usage', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('handles middleclick correctly', function()
|
it('handles middleclick correctly', function()
|
||||||
execute('set mouse=a')
|
feed_command('set mouse=a')
|
||||||
|
|
||||||
local screen = Screen.new(30, 5)
|
local screen = Screen.new(30, 5)
|
||||||
screen:attach()
|
screen:attach()
|
||||||
@@ -471,7 +471,7 @@ describe('clipboard usage', function()
|
|||||||
the a target]])
|
the a target]])
|
||||||
|
|
||||||
-- on error, fall back to unnamed register
|
-- on error, fall back to unnamed register
|
||||||
execute("let g:cliperror = 1")
|
feed_command("let g:cliperror = 1")
|
||||||
feed('<MiddleMouse><6,1>')
|
feed('<MiddleMouse><6,1>')
|
||||||
expect([[
|
expect([[
|
||||||
the source
|
the source
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear, eq, eval, exc_exec, execute, feed, insert, neq, next_msg, nvim,
|
local clear, eq, eval, exc_exec, feed_command, feed, insert, neq, next_msg, nvim,
|
||||||
nvim_dir, ok, source, write_file, mkdir, rmdir = helpers.clear,
|
nvim_dir, ok, source, write_file, mkdir, rmdir = helpers.clear,
|
||||||
helpers.eq, helpers.eval, helpers.exc_exec, helpers.execute, helpers.feed,
|
helpers.eq, helpers.eval, helpers.exc_exec, helpers.feed_command, helpers.feed,
|
||||||
helpers.insert, helpers.neq, helpers.next_message, helpers.nvim,
|
helpers.insert, helpers.neq, helpers.next_message, helpers.nvim,
|
||||||
helpers.nvim_dir, helpers.ok, helpers.source,
|
helpers.nvim_dir, helpers.ok, helpers.source,
|
||||||
helpers.write_file, helpers.mkdir, helpers.rmdir
|
helpers.write_file, helpers.mkdir, helpers.rmdir
|
||||||
@@ -94,7 +94,7 @@ describe('jobs', function()
|
|||||||
|
|
||||||
it('returns 0 when it fails to start', function()
|
it('returns 0 when it fails to start', function()
|
||||||
eq("", eval("v:errmsg"))
|
eq("", eval("v:errmsg"))
|
||||||
execute("let g:test_jobid = jobstart([])")
|
feed_command("let g:test_jobid = jobstart([])")
|
||||||
eq(0, eval("g:test_jobid"))
|
eq(0, eval("g:test_jobid"))
|
||||||
eq("E474:", string.match(eval("v:errmsg"), "E%d*:"))
|
eq("E474:", string.match(eval("v:errmsg"), "E%d*:"))
|
||||||
end)
|
end)
|
||||||
@@ -470,7 +470,7 @@ describe('jobs', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('will return -2 when interrupted', function()
|
it('will return -2 when interrupted', function()
|
||||||
execute('call rpcnotify(g:channel, "ready") | '..
|
feed_command('call rpcnotify(g:channel, "ready") | '..
|
||||||
'call rpcnotify(g:channel, "wait", '..
|
'call rpcnotify(g:channel, "wait", '..
|
||||||
'jobwait([jobstart("sleep 10; exit 55")]))')
|
'jobwait([jobstart("sleep 10; exit 55")]))')
|
||||||
eq({'notification', 'ready', {}}, next_msg())
|
eq({'notification', 'ready', {}}, next_msg())
|
||||||
@@ -514,7 +514,7 @@ describe('jobs', function()
|
|||||||
\ ])
|
\ ])
|
||||||
endfunction
|
endfunction
|
||||||
]])
|
]])
|
||||||
execute('call Run()')
|
feed_command('call Run()')
|
||||||
local r
|
local r
|
||||||
for i = 10, 1, -1 do
|
for i = 10, 1, -1 do
|
||||||
r = next_msg()
|
r = next_msg()
|
||||||
@@ -668,7 +668,7 @@ describe("pty process teardown", function()
|
|||||||
it("does not prevent/delay exit. #4798 #4900", function()
|
it("does not prevent/delay exit. #4798 #4900", function()
|
||||||
if helpers.pending_win32(pending) then return end
|
if helpers.pending_win32(pending) then return end
|
||||||
-- Use a nested nvim (in :term) to test without --headless.
|
-- Use a nested nvim (in :term) to test without --headless.
|
||||||
execute(":terminal '"..helpers.nvim_prog
|
feed_command(":terminal '"..helpers.nvim_prog
|
||||||
-- Use :term again in the _nested_ nvim to get a PTY process.
|
-- Use :term again in the _nested_ nvim to get a PTY process.
|
||||||
-- Use `sleep` to simulate a long-running child of the PTY.
|
-- Use `sleep` to simulate a long-running child of the PTY.
|
||||||
.."' +terminal +'!(sleep 300 &)' +qa")
|
.."' +terminal +'!(sleep 300 &)' +qa")
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local lfs = require('lfs')
|
local lfs = require('lfs')
|
||||||
local neq, eq, execute = helpers.neq, helpers.eq, helpers.execute
|
local neq, eq, command = helpers.neq, helpers.eq, helpers.command
|
||||||
local clear, curbufmeths = helpers.clear, helpers.curbufmeths
|
local clear, curbufmeths = helpers.clear, helpers.curbufmeths
|
||||||
local exc_exec, expect, eval = helpers.exc_exec, helpers.expect, helpers.eval
|
local exc_exec, expect, eval = helpers.exc_exec, helpers.expect, helpers.eval
|
||||||
local insert = helpers.insert
|
local insert = helpers.insert
|
||||||
@@ -10,17 +10,17 @@ describe('api functions', function()
|
|||||||
before_each(clear)
|
before_each(clear)
|
||||||
|
|
||||||
it("work", function()
|
it("work", function()
|
||||||
execute("call nvim_command('let g:test = 1')")
|
command("call nvim_command('let g:test = 1')")
|
||||||
eq(1, eval("nvim_get_var('test')"))
|
eq(1, eval("nvim_get_var('test')"))
|
||||||
|
|
||||||
local buf = eval("nvim_get_current_buf()")
|
local buf = eval("nvim_get_current_buf()")
|
||||||
execute("call nvim_buf_set_lines("..buf..", 0, -1, v:true, ['aa', 'bb'])")
|
command("call nvim_buf_set_lines("..buf..", 0, -1, v:true, ['aa', 'bb'])")
|
||||||
expect([[
|
expect([[
|
||||||
aa
|
aa
|
||||||
bb]])
|
bb]])
|
||||||
|
|
||||||
execute("call nvim_win_set_cursor(0, [1, 1])")
|
command("call nvim_win_set_cursor(0, [1, 1])")
|
||||||
execute("call nvim_input('ax<esc>')")
|
command("call nvim_input('ax<esc>')")
|
||||||
expect([[
|
expect([[
|
||||||
aax
|
aax
|
||||||
bb]])
|
bb]])
|
||||||
@@ -57,7 +57,7 @@ describe('api functions', function()
|
|||||||
eq(bnr, bhnd)
|
eq(bnr, bhnd)
|
||||||
eq(wid, whnd)
|
eq(wid, whnd)
|
||||||
|
|
||||||
execute("new") -- creates new buffer and new window
|
command("new") -- creates new buffer and new window
|
||||||
local bnr2 = eval("bufnr('')")
|
local bnr2 = eval("bufnr('')")
|
||||||
local bhnd2 = eval("nvim_get_current_buf()")
|
local bhnd2 = eval("nvim_get_current_buf()")
|
||||||
local wid2 = eval("win_getid()")
|
local wid2 = eval("win_getid()")
|
||||||
@@ -69,7 +69,7 @@ describe('api functions', function()
|
|||||||
-- 0 is synonymous to the current buffer
|
-- 0 is synonymous to the current buffer
|
||||||
eq(bnr2, eval("nvim_buf_get_number(0)"))
|
eq(bnr2, eval("nvim_buf_get_number(0)"))
|
||||||
|
|
||||||
execute("bn") -- show old buffer in new window
|
command("bn") -- show old buffer in new window
|
||||||
eq(bnr, eval("nvim_get_current_buf()"))
|
eq(bnr, eval("nvim_get_current_buf()"))
|
||||||
eq(bnr, eval("bufnr('')"))
|
eq(bnr, eval("bufnr('')"))
|
||||||
eq(bnr, eval("nvim_buf_get_number(0)"))
|
eq(bnr, eval("nvim_buf_get_number(0)"))
|
||||||
@@ -81,7 +81,7 @@ describe('api functions', function()
|
|||||||
curbufmeths.set_lines(0, -1, true, {"aa\0", "b\0b"})
|
curbufmeths.set_lines(0, -1, true, {"aa\0", "b\0b"})
|
||||||
eq({'aa\n', 'b\nb'}, eval("nvim_buf_get_lines(0, 0, -1, 1)"))
|
eq({'aa\n', 'b\nb'}, eval("nvim_buf_get_lines(0, 0, -1, 1)"))
|
||||||
|
|
||||||
execute('call nvim_buf_set_lines(0, 1, 2, v:true, ["xx", "\\nyy"])')
|
command('call nvim_buf_set_lines(0, 1, 2, v:true, ["xx", "\\nyy"])')
|
||||||
eq({'aa\0', 'xx', '\0yy'}, curbufmeths.get_lines(0, -1, 1))
|
eq({'aa\0', 'xx', '\0yy'}, curbufmeths.get_lines(0, -1, 1))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -124,9 +124,9 @@ describe('api functions', function()
|
|||||||
[5] = {bold = true, foreground = Screen.colors.Blue},
|
[5] = {bold = true, foreground = Screen.colors.Blue},
|
||||||
})
|
})
|
||||||
|
|
||||||
execute("set ft=vim")
|
command("set ft=vim")
|
||||||
execute("let &rtp='build/runtime/,'.&rtp")
|
command("let &rtp='build/runtime/,'.&rtp")
|
||||||
execute("syntax on")
|
command("syntax on")
|
||||||
insert([[
|
insert([[
|
||||||
call bufnr('%')
|
call bufnr('%')
|
||||||
call nvim_input('typing...')
|
call nvim_input('typing...')
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
local lfs = require('lfs')
|
local lfs = require('lfs')
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear, execute, eval, eq = helpers.clear, helpers.execute, helpers.eval, helpers.eq
|
local clear, command, eval, eq = helpers.clear, helpers.command, helpers.eval, helpers.eq
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
lfs.mkdir('test-glob')
|
lfs.mkdir('test-glob')
|
||||||
|
|
||||||
-- Long path might cause "Press ENTER" prompt; use :silent to avoid it.
|
-- Long path might cause "Press ENTER" prompt; use :silent to avoid it.
|
||||||
execute('silent cd test-glob')
|
command('silent cd test-glob')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
after_each(function()
|
after_each(function()
|
||||||
|
|||||||
@@ -4,16 +4,17 @@ local funcs = helpers.funcs
|
|||||||
local meths = helpers.meths
|
local meths = helpers.meths
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
local execute = helpers.execute
|
local command = helpers.command
|
||||||
local exc_exec = helpers.exc_exec
|
local exc_exec = helpers.exc_exec
|
||||||
local redir_exec = helpers.redir_exec
|
local redir_exec = helpers.redir_exec
|
||||||
local NIL = helpers.NIL
|
local NIL = helpers.NIL
|
||||||
|
local source = helpers.source
|
||||||
|
|
||||||
describe('json_decode() function', function()
|
describe('json_decode() function', function()
|
||||||
local restart = function(...)
|
local restart = function(...)
|
||||||
clear(...)
|
clear(...)
|
||||||
execute('language C')
|
source([[
|
||||||
execute([[
|
language C
|
||||||
function Eq(exp, act)
|
function Eq(exp, act)
|
||||||
let act = a:act
|
let act = a:act
|
||||||
let exp = a:exp
|
let exp = a:exp
|
||||||
@@ -45,8 +46,6 @@ describe('json_decode() function', function()
|
|||||||
endif
|
endif
|
||||||
return 1
|
return 1
|
||||||
endfunction
|
endfunction
|
||||||
]])
|
|
||||||
execute([[
|
|
||||||
function EvalEq(exp, act_expr)
|
function EvalEq(exp, act_expr)
|
||||||
let act = eval(a:act_expr)
|
let act = eval(a:act_expr)
|
||||||
if Eq(a:exp, act)
|
if Eq(a:exp, act)
|
||||||
@@ -441,7 +440,7 @@ describe('json_decode() function', function()
|
|||||||
local sp_decode_eq = function(expected, json)
|
local sp_decode_eq = function(expected, json)
|
||||||
meths.set_var('__json', json)
|
meths.set_var('__json', json)
|
||||||
speq(expected, 'json_decode(g:__json)')
|
speq(expected, 'json_decode(g:__json)')
|
||||||
execute('unlet! g:__json')
|
command('unlet! g:__json')
|
||||||
end
|
end
|
||||||
|
|
||||||
it('parses strings with NUL properly', function()
|
it('parses strings with NUL properly', function()
|
||||||
@@ -527,7 +526,7 @@ end)
|
|||||||
describe('json_encode() function', function()
|
describe('json_encode() function', function()
|
||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
execute('language C')
|
command('language C')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('dumps strings', function()
|
it('dumps strings', function()
|
||||||
@@ -576,94 +575,94 @@ describe('json_encode() function', function()
|
|||||||
|
|
||||||
it('cannot dump generic mapping with generic mapping keys and values',
|
it('cannot dump generic mapping with generic mapping keys and values',
|
||||||
function()
|
function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
|
command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
|
||||||
execute('let todumpv1 = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
|
command('let todumpv1 = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
|
||||||
execute('let todumpv2 = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
|
command('let todumpv2 = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
|
||||||
execute('call add(todump._VAL, [todumpv1, todumpv2])')
|
command('call add(todump._VAL, [todumpv1, todumpv2])')
|
||||||
eq('Vim(call):E474: Invalid key in special dictionary', exc_exec('call json_encode(todump)'))
|
eq('Vim(call):E474: Invalid key in special dictionary', exc_exec('call json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('cannot dump generic mapping with ext key', function()
|
it('cannot dump generic mapping with ext key', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.ext, "_VAL": [5, ["",""]]}')
|
command('let todump = {"_TYPE": v:msgpack_types.ext, "_VAL": [5, ["",""]]}')
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
|
command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
|
||||||
eq('Vim(call):E474: Invalid key in special dictionary', exc_exec('call json_encode(todump)'))
|
eq('Vim(call):E474: Invalid key in special dictionary', exc_exec('call json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('cannot dump generic mapping with array key', function()
|
it('cannot dump generic mapping with array key', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": [5, [""]]}')
|
command('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": [5, [""]]}')
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
|
command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
|
||||||
eq('Vim(call):E474: Invalid key in special dictionary', exc_exec('call json_encode(todump)'))
|
eq('Vim(call):E474: Invalid key in special dictionary', exc_exec('call json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('cannot dump generic mapping with UINT64_MAX key', function()
|
it('cannot dump generic mapping with UINT64_MAX key', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.integer}')
|
command('let todump = {"_TYPE": v:msgpack_types.integer}')
|
||||||
execute('let todump._VAL = [1, 3, 0x7FFFFFFF, 0x7FFFFFFF]')
|
command('let todump._VAL = [1, 3, 0x7FFFFFFF, 0x7FFFFFFF]')
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
|
command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
|
||||||
eq('Vim(call):E474: Invalid key in special dictionary', exc_exec('call json_encode(todump)'))
|
eq('Vim(call):E474: Invalid key in special dictionary', exc_exec('call json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('cannot dump generic mapping with floating-point key', function()
|
it('cannot dump generic mapping with floating-point key', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.float, "_VAL": 0.125}')
|
command('let todump = {"_TYPE": v:msgpack_types.float, "_VAL": 0.125}')
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
|
command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
|
||||||
eq('Vim(call):E474: Invalid key in special dictionary', exc_exec('call json_encode(todump)'))
|
eq('Vim(call):E474: Invalid key in special dictionary', exc_exec('call json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump generic mapping with STR special key and NUL', function()
|
it('can dump generic mapping with STR special key and NUL', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.string, "_VAL": ["\\n"]}')
|
command('let todump = {"_TYPE": v:msgpack_types.string, "_VAL": ["\\n"]}')
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
|
command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
|
||||||
eq('{"\\u0000": 1}', eval('json_encode(todump)'))
|
eq('{"\\u0000": 1}', eval('json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump generic mapping with BIN special key and NUL', function()
|
it('can dump generic mapping with BIN special key and NUL', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.binary, "_VAL": ["\\n"]}')
|
command('let todump = {"_TYPE": v:msgpack_types.binary, "_VAL": ["\\n"]}')
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
|
command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
|
||||||
eq('{"\\u0000": 1}', eval('json_encode(todump)'))
|
eq('{"\\u0000": 1}', eval('json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump STR special mapping with NUL and NL', function()
|
it('can dump STR special mapping with NUL and NL', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.string, "_VAL": ["\\n", ""]}')
|
command('let todump = {"_TYPE": v:msgpack_types.string, "_VAL": ["\\n", ""]}')
|
||||||
eq('"\\u0000\\n"', eval('json_encode(todump)'))
|
eq('"\\u0000\\n"', eval('json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump BIN special mapping with NUL and NL', function()
|
it('can dump BIN special mapping with NUL and NL', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.binary, "_VAL": ["\\n", ""]}')
|
command('let todump = {"_TYPE": v:msgpack_types.binary, "_VAL": ["\\n", ""]}')
|
||||||
eq('"\\u0000\\n"', eval('json_encode(todump)'))
|
eq('"\\u0000\\n"', eval('json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('cannot dump special ext mapping', function()
|
it('cannot dump special ext mapping', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.ext, "_VAL": [5, ["",""]]}')
|
command('let todump = {"_TYPE": v:msgpack_types.ext, "_VAL": [5, ["",""]]}')
|
||||||
eq('Vim(call):E474: Unable to convert EXT string to JSON', exc_exec('call json_encode(todump)'))
|
eq('Vim(call):E474: Unable to convert EXT string to JSON', exc_exec('call json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump special array mapping', function()
|
it('can dump special array mapping', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": [5, [""]]}')
|
command('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": [5, [""]]}')
|
||||||
eq('[5, [""]]', eval('json_encode(todump)'))
|
eq('[5, [""]]', eval('json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump special UINT64_MAX mapping', function()
|
it('can dump special UINT64_MAX mapping', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.integer}')
|
command('let todump = {"_TYPE": v:msgpack_types.integer}')
|
||||||
execute('let todump._VAL = [1, 3, 0x7FFFFFFF, 0x7FFFFFFF]')
|
command('let todump._VAL = [1, 3, 0x7FFFFFFF, 0x7FFFFFFF]')
|
||||||
eq('18446744073709551615', eval('json_encode(todump)'))
|
eq('18446744073709551615', eval('json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump special INT64_MIN mapping', function()
|
it('can dump special INT64_MIN mapping', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.integer}')
|
command('let todump = {"_TYPE": v:msgpack_types.integer}')
|
||||||
execute('let todump._VAL = [-1, 2, 0, 0]')
|
command('let todump._VAL = [-1, 2, 0, 0]')
|
||||||
eq('-9223372036854775808', eval('json_encode(todump)'))
|
eq('-9223372036854775808', eval('json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump special BOOLEAN true mapping', function()
|
it('can dump special BOOLEAN true mapping', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.boolean, "_VAL": 1}')
|
command('let todump = {"_TYPE": v:msgpack_types.boolean, "_VAL": 1}')
|
||||||
eq('true', eval('json_encode(todump)'))
|
eq('true', eval('json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump special BOOLEAN false mapping', function()
|
it('can dump special BOOLEAN false mapping', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.boolean, "_VAL": 0}')
|
command('let todump = {"_TYPE": v:msgpack_types.boolean, "_VAL": 0}')
|
||||||
eq('false', eval('json_encode(todump)'))
|
eq('false', eval('json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump special NIL mapping', function()
|
it('can dump special NIL mapping', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.nil, "_VAL": 0}')
|
command('let todump = {"_TYPE": v:msgpack_types.nil, "_VAL": 0}')
|
||||||
eq('null', eval('json_encode(todump)'))
|
eq('null', eval('json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -673,7 +672,7 @@ describe('json_encode() function', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to dump a partial', function()
|
it('fails to dump a partial', function()
|
||||||
execute('function T() dict\nendfunction')
|
command('function T() dict\nendfunction')
|
||||||
eq('Vim(call):E474: Error while dumping encode_tv2json() argument, itself: attempt to dump function reference',
|
eq('Vim(call):E474: Error while dumping encode_tv2json() argument, itself: attempt to dump function reference',
|
||||||
exc_exec('call json_encode(function("T", [1, 2], {}))'))
|
exc_exec('call json_encode(function("T", [1, 2], {}))'))
|
||||||
end)
|
end)
|
||||||
@@ -684,56 +683,56 @@ describe('json_encode() function', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to dump a recursive list', function()
|
it('fails to dump a recursive list', function()
|
||||||
execute('let todump = [[[]]]')
|
command('let todump = [[[]]]')
|
||||||
execute('call add(todump[0][0], todump)')
|
command('call add(todump[0][0], todump)')
|
||||||
eq('Vim(call):E724: unable to correctly dump variable with self-referencing container',
|
eq('Vim(call):E724: unable to correctly dump variable with self-referencing container',
|
||||||
exc_exec('call json_encode(todump)'))
|
exc_exec('call json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to dump a recursive dict', function()
|
it('fails to dump a recursive dict', function()
|
||||||
execute('let todump = {"d": {"d": {}}}')
|
command('let todump = {"d": {"d": {}}}')
|
||||||
execute('call extend(todump.d.d, {"d": todump})')
|
command('call extend(todump.d.d, {"d": todump})')
|
||||||
eq('Vim(call):E724: unable to correctly dump variable with self-referencing container',
|
eq('Vim(call):E724: unable to correctly dump variable with self-referencing container',
|
||||||
exc_exec('call json_encode([todump])'))
|
exc_exec('call json_encode([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump dict with two same dicts inside', function()
|
it('can dump dict with two same dicts inside', function()
|
||||||
execute('let inter = {}')
|
command('let inter = {}')
|
||||||
execute('let todump = {"a": inter, "b": inter}')
|
command('let todump = {"a": inter, "b": inter}')
|
||||||
eq('{"a": {}, "b": {}}', eval('json_encode(todump)'))
|
eq('{"a": {}, "b": {}}', eval('json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump list with two same lists inside', function()
|
it('can dump list with two same lists inside', function()
|
||||||
execute('let inter = []')
|
command('let inter = []')
|
||||||
execute('let todump = [inter, inter]')
|
command('let todump = [inter, inter]')
|
||||||
eq('[[], []]', eval('json_encode(todump)'))
|
eq('[[], []]', eval('json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to dump a recursive list in a special dict', function()
|
it('fails to dump a recursive list in a special dict', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": []}')
|
command('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": []}')
|
||||||
execute('call add(todump._VAL, todump)')
|
command('call add(todump._VAL, todump)')
|
||||||
eq('Vim(call):E724: unable to correctly dump variable with self-referencing container',
|
eq('Vim(call):E724: unable to correctly dump variable with self-referencing container',
|
||||||
exc_exec('call json_encode(todump)'))
|
exc_exec('call json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to dump a recursive (val) map in a special dict', function()
|
it('fails to dump a recursive (val) map in a special dict', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
|
command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
|
||||||
execute('call add(todump._VAL, ["", todump])')
|
command('call add(todump._VAL, ["", todump])')
|
||||||
eq('Vim(call):E724: unable to correctly dump variable with self-referencing container',
|
eq('Vim(call):E724: unable to correctly dump variable with self-referencing container',
|
||||||
exc_exec('call json_encode([todump])'))
|
exc_exec('call json_encode([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to dump a recursive (val) map in a special dict, _VAL reference', function()
|
it('fails to dump a recursive (val) map in a special dict, _VAL reference', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [["", []]]}')
|
command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [["", []]]}')
|
||||||
execute('call add(todump._VAL[0][1], todump._VAL)')
|
command('call add(todump._VAL[0][1], todump._VAL)')
|
||||||
eq('Vim(call):E724: unable to correctly dump variable with self-referencing container',
|
eq('Vim(call):E724: unable to correctly dump variable with self-referencing container',
|
||||||
exc_exec('call json_encode(todump)'))
|
exc_exec('call json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to dump a recursive (val) special list in a special dict',
|
it('fails to dump a recursive (val) special list in a special dict',
|
||||||
function()
|
function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": []}')
|
command('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": []}')
|
||||||
execute('call add(todump._VAL, ["", todump._VAL])')
|
command('call add(todump._VAL, ["", todump._VAL])')
|
||||||
eq('Vim(call):E724: unable to correctly dump variable with self-referencing container',
|
eq('Vim(call):E724: unable to correctly dump variable with self-referencing container',
|
||||||
exc_exec('call json_encode(todump)'))
|
exc_exec('call json_encode(todump)'))
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear, execute, write_file = helpers.clear, helpers.execute, helpers.write_file
|
local clear, command, write_file = helpers.clear, helpers.command, helpers.write_file
|
||||||
local eq, eval = helpers.eq, helpers.eval
|
local eq, eval = helpers.eq, helpers.eval
|
||||||
|
|
||||||
describe("modeline", function()
|
describe("modeline", function()
|
||||||
@@ -12,7 +12,7 @@ describe("modeline", function()
|
|||||||
|
|
||||||
it('does not crash with a large version number', function()
|
it('does not crash with a large version number', function()
|
||||||
write_file(tempfile, 'vim100000000000000000000000')
|
write_file(tempfile, 'vim100000000000000000000000')
|
||||||
execute('e! ' .. tempfile)
|
command('e! ' .. tempfile)
|
||||||
|
|
||||||
eq(2, eval('1+1')) -- Still alive?
|
eq(2, eval('1+1')) -- Still alive?
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
|
|||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local eval, eq = helpers.eval, helpers.eq
|
local eval, eq = helpers.eval, helpers.eq
|
||||||
local execute = helpers.execute
|
local command = helpers.command
|
||||||
local nvim = helpers.nvim
|
local nvim = helpers.nvim
|
||||||
local exc_exec = helpers.exc_exec
|
local exc_exec = helpers.exc_exec
|
||||||
|
|
||||||
@@ -331,9 +331,9 @@ describe('msgpack*() functions', function()
|
|||||||
obj_test('are able to dump and restore floating-point value', {0.125})
|
obj_test('are able to dump and restore floating-point value', {0.125})
|
||||||
|
|
||||||
it('can restore and dump UINT64_MAX', function()
|
it('can restore and dump UINT64_MAX', function()
|
||||||
execute('let dumped = ["\\xCF" . repeat("\\xFF", 8)]')
|
command('let dumped = ["\\xCF" . repeat("\\xFF", 8)]')
|
||||||
execute('let parsed = msgpackparse(dumped)')
|
command('let parsed = msgpackparse(dumped)')
|
||||||
execute('let dumped2 = msgpackdump(parsed)')
|
command('let dumped2 = msgpackdump(parsed)')
|
||||||
eq(1, eval('type(parsed[0]) == type(0) ' ..
|
eq(1, eval('type(parsed[0]) == type(0) ' ..
|
||||||
'|| parsed[0]._TYPE is v:msgpack_types.integer'))
|
'|| parsed[0]._TYPE is v:msgpack_types.integer'))
|
||||||
if eval('type(parsed[0]) == type(0)') == 1 then
|
if eval('type(parsed[0]) == type(0)') == 1 then
|
||||||
@@ -345,9 +345,9 @@ describe('msgpack*() functions', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('can restore and dump INT64_MIN', function()
|
it('can restore and dump INT64_MIN', function()
|
||||||
execute('let dumped = ["\\xD3\\x80" . repeat("\\n", 7)]')
|
command('let dumped = ["\\xD3\\x80" . repeat("\\n", 7)]')
|
||||||
execute('let parsed = msgpackparse(dumped)')
|
command('let parsed = msgpackparse(dumped)')
|
||||||
execute('let dumped2 = msgpackdump(parsed)')
|
command('let dumped2 = msgpackdump(parsed)')
|
||||||
eq(1, eval('type(parsed[0]) == type(0) ' ..
|
eq(1, eval('type(parsed[0]) == type(0) ' ..
|
||||||
'|| parsed[0]._TYPE is v:msgpack_types.integer'))
|
'|| parsed[0]._TYPE is v:msgpack_types.integer'))
|
||||||
if eval('type(parsed[0]) == type(0)') == 1 then
|
if eval('type(parsed[0]) == type(0)') == 1 then
|
||||||
@@ -359,33 +359,33 @@ describe('msgpack*() functions', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('can restore and dump BIN string with zero byte', function()
|
it('can restore and dump BIN string with zero byte', function()
|
||||||
execute('let dumped = ["\\xC4\\x01\\n"]')
|
command('let dumped = ["\\xC4\\x01\\n"]')
|
||||||
execute('let parsed = msgpackparse(dumped)')
|
command('let parsed = msgpackparse(dumped)')
|
||||||
execute('let dumped2 = msgpackdump(parsed)')
|
command('let dumped2 = msgpackdump(parsed)')
|
||||||
eq({{_TYPE={}, _VAL={'\n'}}}, eval('parsed'))
|
eq({{_TYPE={}, _VAL={'\n'}}}, eval('parsed'))
|
||||||
eq(1, eval('parsed[0]._TYPE is v:msgpack_types.binary'))
|
eq(1, eval('parsed[0]._TYPE is v:msgpack_types.binary'))
|
||||||
eq(1, eval('dumped ==# dumped2'))
|
eq(1, eval('dumped ==# dumped2'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can restore and dump STR string with zero byte', function()
|
it('can restore and dump STR string with zero byte', function()
|
||||||
execute('let dumped = ["\\xA1\\n"]')
|
command('let dumped = ["\\xA1\\n"]')
|
||||||
execute('let parsed = msgpackparse(dumped)')
|
command('let parsed = msgpackparse(dumped)')
|
||||||
execute('let dumped2 = msgpackdump(parsed)')
|
command('let dumped2 = msgpackdump(parsed)')
|
||||||
eq({{_TYPE={}, _VAL={'\n'}}}, eval('parsed'))
|
eq({{_TYPE={}, _VAL={'\n'}}}, eval('parsed'))
|
||||||
eq(1, eval('parsed[0]._TYPE is v:msgpack_types.string'))
|
eq(1, eval('parsed[0]._TYPE is v:msgpack_types.string'))
|
||||||
eq(1, eval('dumped ==# dumped2'))
|
eq(1, eval('dumped ==# dumped2'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can restore and dump BIN string with NL', function()
|
it('can restore and dump BIN string with NL', function()
|
||||||
execute('let dumped = ["\\xC4\\x01", ""]')
|
command('let dumped = ["\\xC4\\x01", ""]')
|
||||||
execute('let parsed = msgpackparse(dumped)')
|
command('let parsed = msgpackparse(dumped)')
|
||||||
execute('let dumped2 = msgpackdump(parsed)')
|
command('let dumped2 = msgpackdump(parsed)')
|
||||||
eq({"\n"}, eval('parsed'))
|
eq({"\n"}, eval('parsed'))
|
||||||
eq(1, eval('dumped ==# dumped2'))
|
eq(1, eval('dumped ==# dumped2'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('dump and restore special mapping with floating-point value', function()
|
it('dump and restore special mapping with floating-point value', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.float, "_VAL": 0.125}')
|
command('let todump = {"_TYPE": v:msgpack_types.float, "_VAL": 0.125}')
|
||||||
eq({0.125}, eval('msgpackparse(msgpackdump([todump]))'))
|
eq({0.125}, eval('msgpackparse(msgpackdump([todump]))'))
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
@@ -394,52 +394,53 @@ describe('msgpackparse() function', function()
|
|||||||
before_each(clear)
|
before_each(clear)
|
||||||
|
|
||||||
it('restores nil as v:null', function()
|
it('restores nil as v:null', function()
|
||||||
execute('let dumped = ["\\xC0"]')
|
command('let dumped = ["\\xC0"]')
|
||||||
execute('let parsed = msgpackparse(dumped)')
|
command('let parsed = msgpackparse(dumped)')
|
||||||
eq('[v:null]', eval('string(parsed)'))
|
eq('[v:null]', eval('string(parsed)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('restores boolean false as v:false', function()
|
it('restores boolean false as v:false', function()
|
||||||
execute('let dumped = ["\\xC2"]')
|
command('let dumped = ["\\xC2"]')
|
||||||
execute('let parsed = msgpackparse(dumped)')
|
command('let parsed = msgpackparse(dumped)')
|
||||||
eq({false}, eval('parsed'))
|
eq({false}, eval('parsed'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('restores boolean true as v:true', function()
|
it('restores boolean true as v:true', function()
|
||||||
execute('let dumped = ["\\xC3"]')
|
command('let dumped = ["\\xC3"]')
|
||||||
execute('let parsed = msgpackparse(dumped)')
|
command('let parsed = msgpackparse(dumped)')
|
||||||
eq({true}, eval('parsed'))
|
eq({true}, eval('parsed'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('restores FIXSTR as special dict', function()
|
it('restores FIXSTR as special dict', function()
|
||||||
execute('let dumped = ["\\xa2ab"]')
|
command('let dumped = ["\\xa2ab"]')
|
||||||
execute('let parsed = msgpackparse(dumped)')
|
command('let parsed = msgpackparse(dumped)')
|
||||||
eq({{_TYPE={}, _VAL={'ab'}}}, eval('parsed'))
|
eq({{_TYPE={}, _VAL={'ab'}}}, eval('parsed'))
|
||||||
eq(1, eval('g:parsed[0]._TYPE is v:msgpack_types.string'))
|
eq(1, eval('g:parsed[0]._TYPE is v:msgpack_types.string'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('restores BIN 8 as string', function()
|
it('restores BIN 8 as string', function()
|
||||||
execute('let dumped = ["\\xC4\\x02ab"]')
|
command('let dumped = ["\\xC4\\x02ab"]')
|
||||||
eq({'ab'}, eval('msgpackparse(dumped)'))
|
eq({'ab'}, eval('msgpackparse(dumped)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('restores FIXEXT1 as special dictionary', function()
|
it('restores FIXEXT1 as special dictionary', function()
|
||||||
execute('let dumped = ["\\xD4\\x10", ""]')
|
command('let dumped = ["\\xD4\\x10", ""]')
|
||||||
execute('let parsed = msgpackparse(dumped)')
|
command('let parsed = msgpackparse(dumped)')
|
||||||
eq({{_TYPE={}, _VAL={0x10, {"", ""}}}}, eval('parsed'))
|
eq({{_TYPE={}, _VAL={0x10, {"", ""}}}}, eval('parsed'))
|
||||||
eq(1, eval('g:parsed[0]._TYPE is v:msgpack_types.ext'))
|
eq(1, eval('g:parsed[0]._TYPE is v:msgpack_types.ext'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('restores MAP with BIN key as special dictionary', function()
|
it('restores MAP with BIN key as special dictionary', function()
|
||||||
execute('let dumped = ["\\x81\\xC4\\x01a\\xC4\\n"]')
|
command('let dumped = ["\\x81\\xC4\\x01a\\xC4\\n"]')
|
||||||
execute('let parsed = msgpackparse(dumped)')
|
command('let parsed = msgpackparse(dumped)')
|
||||||
eq({{_TYPE={}, _VAL={{'a', ''}}}}, eval('parsed'))
|
eq({{_TYPE={}, _VAL={{'a', ''}}}}, eval('parsed'))
|
||||||
eq(1, eval('g:parsed[0]._TYPE is v:msgpack_types.map'))
|
eq(1, eval('g:parsed[0]._TYPE is v:msgpack_types.map'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('restores MAP with duplicate STR keys as special dictionary', function()
|
it('restores MAP with duplicate STR keys as special dictionary', function()
|
||||||
execute('let dumped = ["\\x82\\xA1a\\xC4\\n\\xA1a\\xC4\\n"]')
|
command('let dumped = ["\\x82\\xA1a\\xC4\\n\\xA1a\\xC4\\n"]')
|
||||||
execute('let parsed = msgpackparse(dumped)')
|
-- FIXME Internal error bug
|
||||||
|
command('silent! let parsed = msgpackparse(dumped)')
|
||||||
eq({{_TYPE={}, _VAL={ {{_TYPE={}, _VAL={'a'}}, ''},
|
eq({{_TYPE={}, _VAL={ {{_TYPE={}, _VAL={'a'}}, ''},
|
||||||
{{_TYPE={}, _VAL={'a'}}, ''}}} }, eval('parsed'))
|
{{_TYPE={}, _VAL={'a'}}, ''}}} }, eval('parsed'))
|
||||||
eq(1, eval('g:parsed[0]._TYPE is v:msgpack_types.map'))
|
eq(1, eval('g:parsed[0]._TYPE is v:msgpack_types.map'))
|
||||||
@@ -448,8 +449,8 @@ describe('msgpackparse() function', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('restores MAP with MAP key as special dictionary', function()
|
it('restores MAP with MAP key as special dictionary', function()
|
||||||
execute('let dumped = ["\\x81\\x80\\xC4\\n"]')
|
command('let dumped = ["\\x81\\x80\\xC4\\n"]')
|
||||||
execute('let parsed = msgpackparse(dumped)')
|
command('let parsed = msgpackparse(dumped)')
|
||||||
eq({{_TYPE={}, _VAL={{{}, ''}}}}, eval('parsed'))
|
eq({{_TYPE={}, _VAL={{{}, ''}}}}, eval('parsed'))
|
||||||
eq(1, eval('g:parsed[0]._TYPE is v:msgpack_types.map'))
|
eq(1, eval('g:parsed[0]._TYPE is v:msgpack_types.map'))
|
||||||
end)
|
end)
|
||||||
@@ -494,7 +495,7 @@ describe('msgpackparse() function', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to parse a partial', function()
|
it('fails to parse a partial', function()
|
||||||
execute('function T() dict\nendfunction')
|
command('function T() dict\nendfunction')
|
||||||
eq('Vim(call):E686: Argument of msgpackparse() must be a List',
|
eq('Vim(call):E686: Argument of msgpackparse() must be a List',
|
||||||
exc_exec('call msgpackparse(function("T", [1, 2], {}))'))
|
exc_exec('call msgpackparse(function("T", [1, 2], {}))'))
|
||||||
end)
|
end)
|
||||||
@@ -514,10 +515,10 @@ describe('msgpackdump() function', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump generic mapping with generic mapping keys and values', function()
|
it('can dump generic mapping with generic mapping keys and values', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
|
command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
|
||||||
execute('let todumpv1 = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
|
command('let todumpv1 = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
|
||||||
execute('let todumpv2 = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
|
command('let todumpv2 = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
|
||||||
execute('call add(todump._VAL, [todumpv1, todumpv2])')
|
command('call add(todump._VAL, [todumpv1, todumpv2])')
|
||||||
eq({'\129\128\128'}, eval('msgpackdump([todump])'))
|
eq({'\129\128\128'}, eval('msgpackdump([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -530,130 +531,130 @@ describe('msgpackdump() function', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('can v:null', function()
|
it('can v:null', function()
|
||||||
execute('let todump = v:null')
|
command('let todump = v:null')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump special bool mapping (true)', function()
|
it('can dump special bool mapping (true)', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.boolean, "_VAL": 1}')
|
command('let todump = {"_TYPE": v:msgpack_types.boolean, "_VAL": 1}')
|
||||||
eq({'\195'}, eval('msgpackdump([todump])'))
|
eq({'\195'}, eval('msgpackdump([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump special bool mapping (false)', function()
|
it('can dump special bool mapping (false)', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.boolean, "_VAL": 0}')
|
command('let todump = {"_TYPE": v:msgpack_types.boolean, "_VAL": 0}')
|
||||||
eq({'\194'}, eval('msgpackdump([todump])'))
|
eq({'\194'}, eval('msgpackdump([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump special nil mapping', function()
|
it('can dump special nil mapping', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.nil, "_VAL": 0}')
|
command('let todump = {"_TYPE": v:msgpack_types.nil, "_VAL": 0}')
|
||||||
eq({'\192'}, eval('msgpackdump([todump])'))
|
eq({'\192'}, eval('msgpackdump([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump special ext mapping', function()
|
it('can dump special ext mapping', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.ext, "_VAL": [5, ["",""]]}')
|
command('let todump = {"_TYPE": v:msgpack_types.ext, "_VAL": [5, ["",""]]}')
|
||||||
eq({'\212\005', ''}, eval('msgpackdump([todump])'))
|
eq({'\212\005', ''}, eval('msgpackdump([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump special array mapping', function()
|
it('can dump special array mapping', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": [5, [""]]}')
|
command('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": [5, [""]]}')
|
||||||
eq({'\146\005\145\196\n'}, eval('msgpackdump([todump])'))
|
eq({'\146\005\145\196\n'}, eval('msgpackdump([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump special UINT64_MAX mapping', function()
|
it('can dump special UINT64_MAX mapping', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.integer}')
|
command('let todump = {"_TYPE": v:msgpack_types.integer}')
|
||||||
execute('let todump._VAL = [1, 3, 0x7FFFFFFF, 0x7FFFFFFF]')
|
command('let todump._VAL = [1, 3, 0x7FFFFFFF, 0x7FFFFFFF]')
|
||||||
eq({'\207\255\255\255\255\255\255\255\255'}, eval('msgpackdump([todump])'))
|
eq({'\207\255\255\255\255\255\255\255\255'}, eval('msgpackdump([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump special INT64_MIN mapping', function()
|
it('can dump special INT64_MIN mapping', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.integer}')
|
command('let todump = {"_TYPE": v:msgpack_types.integer}')
|
||||||
execute('let todump._VAL = [-1, 2, 0, 0]')
|
command('let todump._VAL = [-1, 2, 0, 0]')
|
||||||
eq({'\211\128\n\n\n\n\n\n\n'}, eval('msgpackdump([todump])'))
|
eq({'\211\128\n\n\n\n\n\n\n'}, eval('msgpackdump([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to dump a function reference', function()
|
it('fails to dump a function reference', function()
|
||||||
execute('let Todump = function("tr")')
|
command('let Todump = function("tr")')
|
||||||
eq('Vim(call):E5004: Error while dumping msgpackdump() argument, index 0, itself: attempt to dump function reference',
|
eq('Vim(call):E5004: Error while dumping msgpackdump() argument, index 0, itself: attempt to dump function reference',
|
||||||
exc_exec('call msgpackdump([Todump])'))
|
exc_exec('call msgpackdump([Todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to dump a partial', function()
|
it('fails to dump a partial', function()
|
||||||
execute('function T() dict\nendfunction')
|
command('function T() dict\nendfunction')
|
||||||
execute('let Todump = function("T", [1, 2], {})')
|
command('let Todump = function("T", [1, 2], {})')
|
||||||
eq('Vim(call):E5004: Error while dumping msgpackdump() argument, index 0, itself: attempt to dump function reference',
|
eq('Vim(call):E5004: Error while dumping msgpackdump() argument, index 0, itself: attempt to dump function reference',
|
||||||
exc_exec('call msgpackdump([Todump])'))
|
exc_exec('call msgpackdump([Todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to dump a function reference in a list', function()
|
it('fails to dump a function reference in a list', function()
|
||||||
execute('let todump = [function("tr")]')
|
command('let todump = [function("tr")]')
|
||||||
eq('Vim(call):E5004: Error while dumping msgpackdump() argument, index 0, index 0: attempt to dump function reference',
|
eq('Vim(call):E5004: Error while dumping msgpackdump() argument, index 0, index 0: attempt to dump function reference',
|
||||||
exc_exec('call msgpackdump([todump])'))
|
exc_exec('call msgpackdump([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to dump a recursive list', function()
|
it('fails to dump a recursive list', function()
|
||||||
execute('let todump = [[[]]]')
|
command('let todump = [[[]]]')
|
||||||
execute('call add(todump[0][0], todump)')
|
command('call add(todump[0][0], todump)')
|
||||||
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in index 0, index 0, index 0',
|
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in index 0, index 0, index 0',
|
||||||
exc_exec('call msgpackdump([todump])'))
|
exc_exec('call msgpackdump([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to dump a recursive dict', function()
|
it('fails to dump a recursive dict', function()
|
||||||
execute('let todump = {"d": {"d": {}}}')
|
command('let todump = {"d": {"d": {}}}')
|
||||||
execute('call extend(todump.d.d, {"d": todump})')
|
command('call extend(todump.d.d, {"d": todump})')
|
||||||
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in key \'d\', key \'d\', key \'d\'',
|
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in key \'d\', key \'d\', key \'d\'',
|
||||||
exc_exec('call msgpackdump([todump])'))
|
exc_exec('call msgpackdump([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump dict with two same dicts inside', function()
|
it('can dump dict with two same dicts inside', function()
|
||||||
execute('let inter = {}')
|
command('let inter = {}')
|
||||||
execute('let todump = {"a": inter, "b": inter}')
|
command('let todump = {"a": inter, "b": inter}')
|
||||||
eq({"\130\161a\128\161b\128"}, eval('msgpackdump([todump])'))
|
eq({"\130\161a\128\161b\128"}, eval('msgpackdump([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can dump list with two same lists inside', function()
|
it('can dump list with two same lists inside', function()
|
||||||
execute('let inter = []')
|
command('let inter = []')
|
||||||
execute('let todump = [inter, inter]')
|
command('let todump = [inter, inter]')
|
||||||
eq({"\146\144\144"}, eval('msgpackdump([todump])'))
|
eq({"\146\144\144"}, eval('msgpackdump([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to dump a recursive list in a special dict', function()
|
it('fails to dump a recursive list in a special dict', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": []}')
|
command('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": []}')
|
||||||
execute('call add(todump._VAL, todump)')
|
command('call add(todump._VAL, todump)')
|
||||||
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in index 0',
|
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in index 0',
|
||||||
exc_exec('call msgpackdump([todump])'))
|
exc_exec('call msgpackdump([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to dump a recursive (key) map in a special dict', function()
|
it('fails to dump a recursive (key) map in a special dict', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
|
command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
|
||||||
execute('call add(todump._VAL, [todump, 0])')
|
command('call add(todump._VAL, [todump, 0])')
|
||||||
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in index 1',
|
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in index 1',
|
||||||
exc_exec('call msgpackdump([todump])'))
|
exc_exec('call msgpackdump([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to dump a recursive (val) map in a special dict', function()
|
it('fails to dump a recursive (val) map in a special dict', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
|
command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
|
||||||
execute('call add(todump._VAL, [0, todump])')
|
command('call add(todump._VAL, [0, todump])')
|
||||||
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in key 0 at index 0 from special map',
|
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in key 0 at index 0 from special map',
|
||||||
exc_exec('call msgpackdump([todump])'))
|
exc_exec('call msgpackdump([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to dump a recursive (key) map in a special dict, _VAL reference', function()
|
it('fails to dump a recursive (key) map in a special dict, _VAL reference', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[[], []]]}')
|
command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[[], []]]}')
|
||||||
execute('call add(todump._VAL[0][0], todump._VAL)')
|
command('call add(todump._VAL[0][0], todump._VAL)')
|
||||||
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in key [[[[...@0], []]]] at index 0 from special map, index 0',
|
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in key [[[[...@0], []]]] at index 0 from special map, index 0',
|
||||||
exc_exec('call msgpackdump([todump])'))
|
exc_exec('call msgpackdump([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to dump a recursive (val) map in a special dict, _VAL reference', function()
|
it('fails to dump a recursive (val) map in a special dict, _VAL reference', function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[[], []]]}')
|
command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[[], []]]}')
|
||||||
execute('call add(todump._VAL[0][1], todump._VAL)')
|
command('call add(todump._VAL[0][1], todump._VAL)')
|
||||||
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in key [] at index 0 from special map, index 0',
|
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in key [] at index 0 from special map, index 0',
|
||||||
exc_exec('call msgpackdump([todump])'))
|
exc_exec('call msgpackdump([todump])'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to dump a recursive (val) special list in a special dict',
|
it('fails to dump a recursive (val) special list in a special dict',
|
||||||
function()
|
function()
|
||||||
execute('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": []}')
|
command('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": []}')
|
||||||
execute('call add(todump._VAL, [0, todump._VAL])')
|
command('call add(todump._VAL, [0, todump._VAL])')
|
||||||
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in index 0, index 1',
|
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in index 0, index 1',
|
||||||
exc_exec('call msgpackdump([todump])'))
|
exc_exec('call msgpackdump([todump])'))
|
||||||
end)
|
end)
|
||||||
@@ -689,7 +690,7 @@ describe('msgpackdump() function', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('fails to dump a partial', function()
|
it('fails to dump a partial', function()
|
||||||
execute('function T() dict\nendfunction')
|
command('function T() dict\nendfunction')
|
||||||
eq('Vim(call):E686: Argument of msgpackdump() must be a List',
|
eq('Vim(call):E686: Argument of msgpackdump() must be a List',
|
||||||
exc_exec('call msgpackdump(function("T", [1, 2], {}))'))
|
exc_exec('call msgpackdump(function("T", [1, 2], {}))'))
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear, eq, ok = helpers.clear, helpers.eq, helpers.ok
|
local clear, eq, ok = helpers.clear, helpers.eq, helpers.ok
|
||||||
local neq, execute, funcs = helpers.neq, helpers.execute, helpers.funcs
|
local neq, command, funcs = helpers.neq, helpers.command, helpers.funcs
|
||||||
local reltime, reltimestr, reltimefloat = funcs.reltime, funcs.reltimestr, funcs.reltimefloat
|
local reltime, reltimestr, reltimefloat = funcs.reltime, funcs.reltimestr, funcs.reltimefloat
|
||||||
|
|
||||||
describe('reltimestr(), reltimefloat()', function()
|
describe('reltimestr(), reltimefloat()', function()
|
||||||
@@ -8,7 +8,7 @@ describe('reltimestr(), reltimefloat()', function()
|
|||||||
|
|
||||||
it('Checks', function()
|
it('Checks', function()
|
||||||
local now = reltime()
|
local now = reltime()
|
||||||
execute('sleep 10m')
|
command('sleep 10m')
|
||||||
local later = reltime()
|
local later = reltime()
|
||||||
local elapsed = reltime(now)
|
local elapsed = reltime(now)
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ local setpos = helpers.funcs.setpos
|
|||||||
local getpos = helpers.funcs.getpos
|
local getpos = helpers.funcs.getpos
|
||||||
local insert = helpers.insert
|
local insert = helpers.insert
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local execute = helpers.execute
|
local command = helpers.command
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local exc_exec = helpers.exc_exec
|
local exc_exec = helpers.exc_exec
|
||||||
@@ -16,7 +16,7 @@ describe('setpos() function', function()
|
|||||||
First line of text
|
First line of text
|
||||||
Second line of text
|
Second line of text
|
||||||
Third line of text]])
|
Third line of text]])
|
||||||
execute('new')
|
command('new')
|
||||||
insert([[
|
insert([[
|
||||||
Line of text 1
|
Line of text 1
|
||||||
Line of text 2
|
Line of text 2
|
||||||
@@ -34,7 +34,8 @@ describe('setpos() function', function()
|
|||||||
it('can set lowercase marks in the current buffer', function()
|
it('can set lowercase marks in the current buffer', function()
|
||||||
setpos("'d", {0, 2, 1, 0})
|
setpos("'d", {0, 2, 1, 0})
|
||||||
eq(getpos("'d"), {0, 2, 1, 0})
|
eq(getpos("'d"), {0, 2, 1, 0})
|
||||||
execute('undo', 'call setpos("\'d", [2, 3, 1, 0])')
|
command('undo')
|
||||||
|
command('call setpos("\'d", [2, 3, 1, 0])')
|
||||||
eq(getpos("'d"), {0, 3, 1, 0})
|
eq(getpos("'d"), {0, 3, 1, 0})
|
||||||
end)
|
end)
|
||||||
it('can set lowercase marks in other buffers', function()
|
it('can set lowercase marks in other buffers', function()
|
||||||
@@ -42,7 +43,7 @@ describe('setpos() function', function()
|
|||||||
eq(0, retval)
|
eq(0, retval)
|
||||||
setpos("'d", {1, 2, 1, 0})
|
setpos("'d", {1, 2, 1, 0})
|
||||||
eq(getpos("'d"), {0, 0, 0, 0})
|
eq(getpos("'d"), {0, 0, 0, 0})
|
||||||
execute('wincmd w')
|
command('wincmd w')
|
||||||
eq(eval('bufnr("%")'), 1)
|
eq(eval('bufnr("%")'), 1)
|
||||||
eq(getpos("'d"), {0, 2, 1, 0})
|
eq(getpos("'d"), {0, 2, 1, 0})
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local exc_exec = helpers.exc_exec
|
local exc_exec = helpers.exc_exec
|
||||||
local execute = helpers.execute
|
local command = helpers.command
|
||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
@@ -12,7 +12,7 @@ describe('Special values', function()
|
|||||||
before_each(clear)
|
before_each(clear)
|
||||||
|
|
||||||
it('do not cause error when freed', function()
|
it('do not cause error when freed', function()
|
||||||
execute([[
|
command([[
|
||||||
function Test()
|
function Test()
|
||||||
try
|
try
|
||||||
return v:true
|
return v:true
|
||||||
@@ -109,7 +109,7 @@ describe('Special values', function()
|
|||||||
it('does not work with +=/-=/.=', function()
|
it('does not work with +=/-=/.=', function()
|
||||||
meths.set_var('true', true)
|
meths.set_var('true', true)
|
||||||
meths.set_var('false', false)
|
meths.set_var('false', false)
|
||||||
execute('let null = v:null')
|
command('let null = v:null')
|
||||||
|
|
||||||
eq('Vim(let):E734: Wrong variable type for +=', exc_exec('let true += 1'))
|
eq('Vim(let):E734: Wrong variable type for +=', exc_exec('let true += 1'))
|
||||||
eq('Vim(let):E734: Wrong variable type for +=', exc_exec('let false += 1'))
|
eq('Vim(let):E734: Wrong variable type for +=', exc_exec('let false += 1'))
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local eq, call, clear, eval, execute, feed, nvim =
|
|
||||||
helpers.eq, helpers.call, helpers.clear, helpers.eval, helpers.execute,
|
local nvim_dir = helpers.nvim_dir
|
||||||
|
local eq, call, clear, eval, feed_command, feed, nvim =
|
||||||
|
helpers.eq, helpers.call, helpers.clear, helpers.eval, helpers.feed_command,
|
||||||
helpers.feed, helpers.nvim
|
helpers.feed, helpers.nvim
|
||||||
|
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
@@ -31,7 +33,7 @@ describe('system()', function()
|
|||||||
|
|
||||||
describe('command passed as a List', function()
|
describe('command passed as a List', function()
|
||||||
local function printargs_path()
|
local function printargs_path()
|
||||||
return helpers.nvim_dir..'/printargs-test'
|
return nvim_dir..'/printargs-test'
|
||||||
.. (helpers.os_name() == 'windows' and '.exe' or '')
|
.. (helpers.os_name() == 'windows' and '.exe' or '')
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -43,10 +45,10 @@ describe('system()', function()
|
|||||||
it('parameter validation does NOT modify v:shell_error', function()
|
it('parameter validation does NOT modify v:shell_error', function()
|
||||||
-- 1. Call system() with invalid parameters.
|
-- 1. Call system() with invalid parameters.
|
||||||
-- 2. Assert that v:shell_error was NOT set.
|
-- 2. Assert that v:shell_error was NOT set.
|
||||||
execute('call system({})')
|
feed_command('call system({})')
|
||||||
eq('E475: Invalid argument: expected String or List', eval('v:errmsg'))
|
eq('E475: Invalid argument: expected String or List', eval('v:errmsg'))
|
||||||
eq(0, eval('v:shell_error'))
|
eq(0, eval('v:shell_error'))
|
||||||
execute('call system([])')
|
feed_command('call system([])')
|
||||||
eq('E474: Invalid argument', eval('v:errmsg'))
|
eq('E474: Invalid argument', eval('v:errmsg'))
|
||||||
eq(0, eval('v:shell_error'))
|
eq(0, eval('v:shell_error'))
|
||||||
|
|
||||||
@@ -57,9 +59,9 @@ describe('system()', function()
|
|||||||
|
|
||||||
-- 1. Call system() with invalid parameters.
|
-- 1. Call system() with invalid parameters.
|
||||||
-- 2. Assert that v:shell_error was NOT modified.
|
-- 2. Assert that v:shell_error was NOT modified.
|
||||||
execute('call system({})')
|
feed_command('call system({})')
|
||||||
eq(old_val, eval('v:shell_error'))
|
eq(old_val, eval('v:shell_error'))
|
||||||
execute('call system([])')
|
feed_command('call system([])')
|
||||||
eq(old_val, eval('v:shell_error'))
|
eq(old_val, eval('v:shell_error'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -182,7 +184,7 @@ describe('system()', function()
|
|||||||
end)
|
end)
|
||||||
it('to backgrounded command does not crash', function()
|
it('to backgrounded command does not crash', function()
|
||||||
-- This is indeterminate, just exercise the codepath. May get E5677.
|
-- This is indeterminate, just exercise the codepath. May get E5677.
|
||||||
execute('call system("echo -n echoed &")')
|
feed_command('call system("echo -n echoed &")')
|
||||||
local v_errnum = string.match(eval("v:errmsg"), "^E%d*:")
|
local v_errnum = string.match(eval("v:errmsg"), "^E%d*:")
|
||||||
if v_errnum then
|
if v_errnum then
|
||||||
eq("E5677:", v_errnum)
|
eq("E5677:", v_errnum)
|
||||||
@@ -197,7 +199,7 @@ describe('system()', function()
|
|||||||
end)
|
end)
|
||||||
it('to backgrounded command does not crash', function()
|
it('to backgrounded command does not crash', function()
|
||||||
-- This is indeterminate, just exercise the codepath. May get E5677.
|
-- This is indeterminate, just exercise the codepath. May get E5677.
|
||||||
execute('call system("cat - &")')
|
feed_command('call system("cat - &")')
|
||||||
local v_errnum = string.match(eval("v:errmsg"), "^E%d*:")
|
local v_errnum = string.match(eval("v:errmsg"), "^E%d*:")
|
||||||
if v_errnum then
|
if v_errnum then
|
||||||
eq("E5677:", v_errnum)
|
eq("E5677:", v_errnum)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
|
|||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local ok, feed, eq, eval = helpers.ok, helpers.feed, helpers.eq, helpers.eval
|
local ok, feed, eq, eval = helpers.ok, helpers.feed, helpers.eq, helpers.eval
|
||||||
local source, nvim_async, run = helpers.source, helpers.nvim_async, helpers.run
|
local source, nvim_async, run = helpers.source, helpers.nvim_async, helpers.run
|
||||||
local clear, execute, funcs = helpers.clear, helpers.execute, helpers.funcs
|
local clear, command, funcs = helpers.clear, helpers.command, helpers.funcs
|
||||||
local curbufmeths = helpers.curbufmeths
|
local curbufmeths = helpers.curbufmeths
|
||||||
|
|
||||||
describe('timers', function()
|
describe('timers', function()
|
||||||
@@ -17,14 +17,14 @@ describe('timers', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('works one-shot', function()
|
it('works one-shot', function()
|
||||||
execute("call timer_start(50, 'MyHandler')")
|
command("call timer_start(50, 'MyHandler')")
|
||||||
eq(0,eval("g:val"))
|
eq(0,eval("g:val"))
|
||||||
run(nil, nil, nil, 200)
|
run(nil, nil, nil, 200)
|
||||||
eq(1,eval("g:val"))
|
eq(1,eval("g:val"))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('works one-shot when repeat=0', function()
|
it('works one-shot when repeat=0', function()
|
||||||
execute("call timer_start(50, 'MyHandler', {'repeat': 0})")
|
command("call timer_start(50, 'MyHandler', {'repeat': 0})")
|
||||||
eq(0,eval("g:val"))
|
eq(0,eval("g:val"))
|
||||||
run(nil, nil, nil, 200)
|
run(nil, nil, nil, 200)
|
||||||
eq(1,eval("g:val"))
|
eq(1,eval("g:val"))
|
||||||
@@ -32,14 +32,14 @@ describe('timers', function()
|
|||||||
|
|
||||||
|
|
||||||
it('works with repeat two', function()
|
it('works with repeat two', function()
|
||||||
execute("call timer_start(50, 'MyHandler', {'repeat': 2})")
|
command("call timer_start(50, 'MyHandler', {'repeat': 2})")
|
||||||
eq(0,eval("g:val"))
|
eq(0,eval("g:val"))
|
||||||
run(nil, nil, nil, 300)
|
run(nil, nil, nil, 300)
|
||||||
eq(2,eval("g:val"))
|
eq(2,eval("g:val"))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('are triggered during sleep', function()
|
it('are triggered during sleep', function()
|
||||||
execute("call timer_start(50, 'MyHandler', {'repeat': 2})")
|
command("call timer_start(50, 'MyHandler', {'repeat': 2})")
|
||||||
nvim_async("command", "sleep 10")
|
nvim_async("command", "sleep 10")
|
||||||
eq(0,eval("g:val"))
|
eq(0,eval("g:val"))
|
||||||
run(nil, nil, nil, 300)
|
run(nil, nil, nil, 300)
|
||||||
@@ -63,12 +63,12 @@ describe('timers', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('are paused when event processing is disabled', function()
|
it('are paused when event processing is disabled', function()
|
||||||
execute("call timer_start(50, 'MyHandler', {'repeat': -1})")
|
command("call timer_start(50, 'MyHandler', {'repeat': -1})")
|
||||||
run(nil, nil, nil, 100)
|
run(nil, nil, nil, 100)
|
||||||
local count = eval("g:val")
|
local count = eval("g:val")
|
||||||
-- shows two line error message and thus invokes the return prompt.
|
-- shows two line error message and thus invokes the return prompt.
|
||||||
-- if we start to allow event processing here, we need to change this test.
|
-- if we start to allow event processing here, we need to change this test.
|
||||||
execute("throw 'fatal error'")
|
feed(':throw "fatal error"<CR>')
|
||||||
run(nil, nil, nil, 300)
|
run(nil, nil, nil, 300)
|
||||||
feed("<cr>")
|
feed("<cr>")
|
||||||
local diff = eval("g:val") - count
|
local diff = eval("g:val") - count
|
||||||
@@ -76,7 +76,7 @@ describe('timers', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('are triggered in blocking getchar() call', function()
|
it('are triggered in blocking getchar() call', function()
|
||||||
execute("call timer_start(50, 'MyHandler', {'repeat': -1})")
|
command("call timer_start(50, 'MyHandler', {'repeat': -1})")
|
||||||
nvim_async("command", "let g:c = getchar()")
|
nvim_async("command", "let g:c = getchar()")
|
||||||
run(nil, nil, nil, 300)
|
run(nil, nil, nil, 300)
|
||||||
feed("c")
|
feed("c")
|
||||||
@@ -157,7 +157,7 @@ describe('timers', function()
|
|||||||
endif
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
]])
|
]])
|
||||||
execute("call timer_start(50, 'MyHandler', {'repeat': -1})")
|
command("call timer_start(50, 'MyHandler', {'repeat': -1})")
|
||||||
eq(0,eval("g:val"))
|
eq(0,eval("g:val"))
|
||||||
run(nil, nil, nil, 300)
|
run(nil, nil, nil, 300)
|
||||||
eq(3,eval("g:val"))
|
eq(3,eval("g:val"))
|
||||||
@@ -170,8 +170,8 @@ describe('timers', function()
|
|||||||
let g:val2 += 1
|
let g:val2 += 1
|
||||||
endfunc
|
endfunc
|
||||||
]])
|
]])
|
||||||
execute("call timer_start(50, 'MyHandler', {'repeat': 3})")
|
command("call timer_start(50, 'MyHandler', {'repeat': 3})")
|
||||||
execute("call timer_start(100, 'MyHandler2', {'repeat': 2})")
|
command("call timer_start(100, 'MyHandler2', {'repeat': 2})")
|
||||||
run(nil, nil, nil, 300)
|
run(nil, nil, nil, 300)
|
||||||
eq(3,eval("g:val"))
|
eq(3,eval("g:val"))
|
||||||
eq(2,eval("g:val2"))
|
eq(2,eval("g:val2"))
|
||||||
@@ -186,7 +186,7 @@ describe('timers', function()
|
|||||||
let g:val += 1
|
let g:val += 1
|
||||||
endfunc
|
endfunc
|
||||||
]])
|
]])
|
||||||
execute("call timer_start(5, 'MyHandler', {'repeat': 1})")
|
command("call timer_start(5, 'MyHandler', {'repeat': 1})")
|
||||||
run(nil, nil, nil, 300)
|
run(nil, nil, nil, 300)
|
||||||
eq(1,eval("g:val"))
|
eq(1,eval("g:val"))
|
||||||
end)
|
end)
|
||||||
@@ -201,7 +201,7 @@ describe('timers', function()
|
|||||||
echo "evil"
|
echo "evil"
|
||||||
endfunc
|
endfunc
|
||||||
]])
|
]])
|
||||||
execute("call timer_start(100, 'MyHandler', {'repeat': 1})")
|
command("call timer_start(100, 'MyHandler', {'repeat': 1})")
|
||||||
feed(":good")
|
feed(":good")
|
||||||
screen:sleep(200)
|
screen:sleep(200)
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
local helpers = require("test.functional.helpers")(after_each)
|
local helpers = require("test.functional.helpers")(after_each)
|
||||||
local eq, execute, funcs = helpers.eq, helpers.execute, helpers.funcs
|
local eq, command, funcs = helpers.eq, helpers.command, helpers.funcs
|
||||||
local ok = helpers.ok
|
local ok = helpers.ok
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
|
|
||||||
@@ -9,15 +9,15 @@ describe(":argument", function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it("does not restart :terminal buffer", function()
|
it("does not restart :terminal buffer", function()
|
||||||
execute("terminal")
|
command("terminal")
|
||||||
helpers.feed([[<C-\><C-N>]])
|
helpers.feed([[<C-\><C-N>]])
|
||||||
execute("argadd")
|
command("argadd")
|
||||||
helpers.feed([[<C-\><C-N>]])
|
helpers.feed([[<C-\><C-N>]])
|
||||||
local bufname_before = funcs.bufname("%")
|
local bufname_before = funcs.bufname("%")
|
||||||
local bufnr_before = funcs.bufnr("%")
|
local bufnr_before = funcs.bufnr("%")
|
||||||
helpers.ok(nil ~= string.find(bufname_before, "^term://")) -- sanity
|
helpers.ok(nil ~= string.find(bufname_before, "^term://")) -- sanity
|
||||||
|
|
||||||
execute("argument 1")
|
command("argument 1")
|
||||||
helpers.feed([[<C-\><C-N>]])
|
helpers.feed([[<C-\><C-N>]])
|
||||||
|
|
||||||
local bufname_after = funcs.bufname("%")
|
local bufname_after = funcs.bufname("%")
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
-- Specs for bang/filter commands
|
-- Specs for bang/filter commands
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, execute, clear = helpers.feed, helpers.execute, helpers.clear
|
local feed, command, clear = helpers.feed, helpers.command, helpers.clear
|
||||||
local mkdir, write_file, rmdir = helpers.mkdir, helpers.write_file, helpers.rmdir
|
local mkdir, write_file, rmdir = helpers.mkdir, helpers.write_file, helpers.rmdir
|
||||||
|
|
||||||
if helpers.pending_win32(pending) then return end
|
if helpers.pending_win32(pending) then return end
|
||||||
@@ -28,7 +28,7 @@ describe('issues', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('#3269 Last line of shell output is not truncated', function()
|
it('#3269 Last line of shell output is not truncated', function()
|
||||||
execute([[nnoremap <silent>\l :!ls bang_filter_spec<cr>]])
|
command([[nnoremap <silent>\l :!ls bang_filter_spec<cr>]])
|
||||||
feed([[\l]])
|
feed([[\l]])
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
~ |
|
~ |
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ local helpers = require('test.functional.helpers')(after_each)
|
|||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local call = helpers.call
|
local call = helpers.call
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local execute = helpers.execute
|
local command = helpers.command
|
||||||
local exc_exec = helpers.exc_exec
|
local exc_exec = helpers.exc_exec
|
||||||
|
|
||||||
if helpers.pending_win32(pending) then return end
|
if helpers.pending_win32(pending) then return end
|
||||||
@@ -58,7 +58,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
|
|||||||
eq(0, lwd(globalwin))
|
eq(0, lwd(globalwin))
|
||||||
eq(0, lwd(globalwin, tabnr))
|
eq(0, lwd(globalwin, tabnr))
|
||||||
|
|
||||||
execute('bot split')
|
command('bot split')
|
||||||
local localwin = call('winnr')
|
local localwin = call('winnr')
|
||||||
-- Initial window is still using globalDir
|
-- Initial window is still using globalDir
|
||||||
eq(globalDir, cwd(localwin))
|
eq(globalDir, cwd(localwin))
|
||||||
@@ -66,7 +66,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
|
|||||||
eq(0, lwd(globalwin))
|
eq(0, lwd(globalwin))
|
||||||
eq(0, lwd(globalwin, tabnr))
|
eq(0, lwd(globalwin, tabnr))
|
||||||
|
|
||||||
execute('silent l' .. cmd .. ' ' .. directories.window)
|
command('silent l' .. cmd .. ' ' .. directories.window)
|
||||||
-- From window with local dir, the original window
|
-- From window with local dir, the original window
|
||||||
-- is still reporting the global dir
|
-- is still reporting the global dir
|
||||||
eq(globalDir, cwd(globalwin))
|
eq(globalDir, cwd(globalwin))
|
||||||
@@ -80,7 +80,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
|
|||||||
eq(1, lwd(localwin))
|
eq(1, lwd(localwin))
|
||||||
eq(1, lwd(localwin, tabnr))
|
eq(1, lwd(localwin, tabnr))
|
||||||
|
|
||||||
execute('tabnew')
|
command('tabnew')
|
||||||
-- From new tab page, original window reports global dir
|
-- From new tab page, original window reports global dir
|
||||||
eq(globalDir, cwd(globalwin, tabnr))
|
eq(globalDir, cwd(globalwin, tabnr))
|
||||||
eq(0, lwd(globalwin, tabnr))
|
eq(0, lwd(globalwin, tabnr))
|
||||||
@@ -100,8 +100,8 @@ for _, cmd in ipairs {'cd', 'chdir'} do
|
|||||||
eq(0, lwd(-1, 0))
|
eq(0, lwd(-1, 0))
|
||||||
eq(0, lwd(-1, globaltab))
|
eq(0, lwd(-1, globaltab))
|
||||||
|
|
||||||
execute('tabnew')
|
command('tabnew')
|
||||||
execute('silent t' .. cmd .. ' ' .. directories.tab)
|
command('silent t' .. cmd .. ' ' .. directories.tab)
|
||||||
local localtab = call('tabpagenr')
|
local localtab = call('tabpagenr')
|
||||||
|
|
||||||
-- From local tab page, original tab reports globalDir
|
-- From local tab page, original tab reports globalDir
|
||||||
@@ -114,7 +114,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
|
|||||||
eq(1, lwd(-1, 0))
|
eq(1, lwd(-1, 0))
|
||||||
eq(1, lwd(-1, localtab))
|
eq(1, lwd(-1, localtab))
|
||||||
|
|
||||||
execute('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 .. '/' .. directories.tab, cwd(-1, localtab))
|
||||||
eq(1, lwd(-1, localtab))
|
eq(1, lwd(-1, localtab))
|
||||||
@@ -128,13 +128,13 @@ for _, cmd in ipairs {'cd', 'chdir'} do
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('works with tab-local pwd', function()
|
it('works with tab-local pwd', function()
|
||||||
execute('silent t' .. cmd .. ' ' .. directories.tab)
|
command('silent t' .. cmd .. ' ' .. directories.tab)
|
||||||
eq(directories.start, cwd(-1, -1))
|
eq(directories.start, cwd(-1, -1))
|
||||||
eq(0, lwd(-1, -1))
|
eq(0, lwd(-1, -1))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('works with window-local pwd', function()
|
it('works with window-local pwd', function()
|
||||||
execute('silent l' .. cmd .. ' ' .. directories.window)
|
command('silent l' .. cmd .. ' ' .. directories.window)
|
||||||
eq(directories.start, cwd(-1, -1))
|
eq(directories.start, cwd(-1, -1))
|
||||||
eq(0, lwd(-1, -1))
|
eq(0, lwd(-1, -1))
|
||||||
end)
|
end)
|
||||||
@@ -145,18 +145,18 @@ for _, cmd in ipairs {'cd', 'chdir'} do
|
|||||||
local globalDir = directories.start
|
local globalDir = directories.start
|
||||||
|
|
||||||
-- Create a new tab and change directory
|
-- Create a new tab and change directory
|
||||||
execute('tabnew')
|
command('tabnew')
|
||||||
execute('silent t' .. cmd .. ' ' .. directories.tab)
|
command('silent t' .. cmd .. ' ' .. directories.tab)
|
||||||
eq(globalDir .. '/' .. directories.tab, tcwd())
|
eq(globalDir .. '/' .. 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
|
||||||
execute('tabnew')
|
command('tabnew')
|
||||||
eq(globalDir .. '/' .. directories.tab, tcwd())
|
eq(globalDir .. '/' .. directories.tab, tcwd())
|
||||||
|
|
||||||
-- Change tab and change back, verify that directories are correct
|
-- Change tab and change back, verify that directories are correct
|
||||||
execute('tabnext')
|
command('tabnext')
|
||||||
eq(globalDir, tcwd())
|
eq(globalDir, tcwd())
|
||||||
execute('tabprevious')
|
command('tabprevious')
|
||||||
eq(globalDir .. '/' .. directories.tab, tcwd())
|
eq(globalDir .. '/' .. directories.tab, tcwd())
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
@@ -164,7 +164,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
|
|||||||
it('works', function()
|
it('works', function()
|
||||||
local globalDir = directories.start
|
local globalDir = directories.start
|
||||||
-- Create a new tab first and verify that is has the same working dir
|
-- Create a new tab first and verify that is has the same working dir
|
||||||
execute('tabnew')
|
command('tabnew')
|
||||||
eq(globalDir, cwd())
|
eq(globalDir, cwd())
|
||||||
eq(globalDir, tcwd()) -- has no tab-local directory
|
eq(globalDir, tcwd()) -- has no tab-local directory
|
||||||
eq(0, tlwd())
|
eq(0, tlwd())
|
||||||
@@ -172,7 +172,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
|
|||||||
eq(0, wlwd())
|
eq(0, wlwd())
|
||||||
|
|
||||||
-- Change tab-local working directory and verify it is different
|
-- Change tab-local working directory and verify it is different
|
||||||
execute('silent t' .. cmd .. ' ' .. directories.tab)
|
command('silent t' .. cmd .. ' ' .. directories.tab)
|
||||||
eq(globalDir .. '/' .. directories.tab, cwd())
|
eq(globalDir .. '/' .. 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())
|
||||||
@@ -180,46 +180,46 @@ for _, cmd in ipairs {'cd', 'chdir'} do
|
|||||||
eq(0, wlwd())
|
eq(0, wlwd())
|
||||||
|
|
||||||
-- Create a new window in this tab to test `:lcd`
|
-- Create a new window in this tab to test `:lcd`
|
||||||
execute('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 .. '/' .. directories.tab, cwd())
|
||||||
execute('silent l' .. cmd .. ' ../' .. directories.window)
|
command('silent l' .. cmd .. ' ../' .. directories.window)
|
||||||
eq(globalDir .. '/' .. directories.window, cwd())
|
eq(globalDir .. '/' .. directories.window, cwd())
|
||||||
eq(globalDir .. '/' .. directories.tab, tcwd())
|
eq(globalDir .. '/' .. 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
|
||||||
execute('wincmd w')
|
command('wincmd w')
|
||||||
eq(globalDir .. '/' .. directories.tab, cwd())
|
eq(globalDir .. '/' .. directories.tab, cwd())
|
||||||
eq(globalDir .. '/' .. directories.tab, tcwd())
|
eq(globalDir .. '/' .. 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
|
||||||
execute('tabnext')
|
command('tabnext')
|
||||||
eq(globalDir, cwd() )
|
eq(globalDir, cwd() )
|
||||||
eq(0, tlwd())
|
eq(0, tlwd())
|
||||||
eq(0, wlwd())
|
eq(0, wlwd())
|
||||||
|
|
||||||
-- Verify global changes don't affect local ones
|
-- Verify global changes don't affect local ones
|
||||||
execute('silent ' .. cmd .. ' ' .. directories.global)
|
command('silent ' .. cmd .. ' ' .. directories.global)
|
||||||
eq(globalDir .. '/' .. directories.global, cwd())
|
eq(globalDir .. '/' .. directories.global, cwd())
|
||||||
execute('tabnext')
|
command('tabnext')
|
||||||
eq(globalDir .. '/' .. directories.tab, cwd())
|
eq(globalDir .. '/' .. directories.tab, cwd())
|
||||||
eq(globalDir .. '/' .. directories.tab, tcwd())
|
eq(globalDir .. '/' .. 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
|
||||||
execute('silent ' .. cmd .. ' ..')
|
command('silent ' .. cmd .. ' ..')
|
||||||
eq(globalDir, cwd() )
|
eq(globalDir, cwd() )
|
||||||
eq(0 , tlwd())
|
eq(0 , tlwd())
|
||||||
eq(0 , wlwd())
|
eq(0 , wlwd())
|
||||||
-- Which also affects the first tab
|
-- Which also affects the first tab
|
||||||
execute('tabnext')
|
command('tabnext')
|
||||||
eq(globalDir, cwd())
|
eq(globalDir, cwd())
|
||||||
|
|
||||||
-- But not in a window with its own local directory
|
-- But not in a window with its own local directory
|
||||||
execute('tabnext | wincmd w')
|
command('tabnext | wincmd w')
|
||||||
eq(globalDir .. '/' .. directories.window, cwd() )
|
eq(globalDir .. '/' .. directories.window, cwd() )
|
||||||
eq(0 , tlwd())
|
eq(0 , tlwd())
|
||||||
eq(globalDir .. '/' .. directories.window, wcwd())
|
eq(globalDir .. '/' .. directories.window, wcwd())
|
||||||
@@ -280,8 +280,8 @@ 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()
|
||||||
execute("cd "..directories.global)
|
command("cd "..directories.global)
|
||||||
execute("call delete('../"..directories.global.."', 'd')")
|
command("call delete('../"..directories.global.."', 'd')")
|
||||||
eq("", helpers.eval("getcwd()"))
|
eq("", helpers.eval("getcwd()"))
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local clear, feed, source = helpers.clear, helpers.feed, helpers.source
|
local clear, feed, source = helpers.clear, helpers.feed, helpers.source
|
||||||
local execute = helpers.execute
|
local command = helpers.command
|
||||||
|
|
||||||
describe("CTRL-C (mapped)", function()
|
describe("CTRL-C (mapped)", function()
|
||||||
before_each(function()
|
before_each(function()
|
||||||
@@ -20,7 +20,7 @@ describe("CTRL-C (mapped)", function()
|
|||||||
nnoremap <C-C> <NOP>
|
nnoremap <C-C> <NOP>
|
||||||
]])
|
]])
|
||||||
|
|
||||||
execute("silent edit! test/functional/fixtures/bigfile.txt")
|
command("silent edit! test/functional/fixtures/bigfile.txt")
|
||||||
local screen = Screen.new(52, 6)
|
local screen = Screen.new(52, 6)
|
||||||
screen:attach()
|
screen:attach()
|
||||||
screen:set_default_attr_ids({
|
screen:set_default_attr_ids({
|
||||||
@@ -47,7 +47,7 @@ describe("CTRL-C (mapped)", function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- The test is time-sensitive. Try different sleep values.
|
-- The test is time-sensitive. Try different sleep values.
|
||||||
local ms_values = {1, 10, 100}
|
local ms_values = {1, 10, 100, 1000, 10000}
|
||||||
for i, ms in ipairs(ms_values) do
|
for i, ms in ipairs(ms_values) do
|
||||||
if i < #ms_values then
|
if i < #ms_values then
|
||||||
local status, _ = pcall(test_ctrl_c, ms)
|
local status, _ = pcall(test_ctrl_c, ms)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local clear, feed, execute = helpers.clear, helpers.feed, helpers.execute
|
local clear, feed, feed_command = helpers.clear, helpers.feed, helpers.feed_command
|
||||||
|
|
||||||
describe(":drop", function()
|
describe(":drop", function()
|
||||||
local screen
|
local screen
|
||||||
@@ -15,7 +15,7 @@ describe(":drop", function()
|
|||||||
[2] = {reverse = true},
|
[2] = {reverse = true},
|
||||||
[3] = {bold = true},
|
[3] = {bold = true},
|
||||||
})
|
})
|
||||||
execute("set laststatus=2")
|
feed_command("set laststatus=2")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
after_each(function()
|
after_each(function()
|
||||||
@@ -23,7 +23,7 @@ describe(":drop", function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it("works like :e when called with only one window open", function()
|
it("works like :e when called with only one window open", function()
|
||||||
execute("drop tmp1.vim")
|
feed_command("drop tmp1.vim")
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
^ |
|
^ |
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
@@ -39,10 +39,10 @@ describe(":drop", function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it("switches to an open window showing the buffer", function()
|
it("switches to an open window showing the buffer", function()
|
||||||
execute("edit tmp1")
|
feed_command("edit tmp1")
|
||||||
execute("vsplit")
|
feed_command("vsplit")
|
||||||
execute("edit tmp2")
|
feed_command("edit tmp2")
|
||||||
execute("drop tmp1")
|
feed_command("drop tmp1")
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
{2:|}^ |
|
{2:|}^ |
|
||||||
{0:~ }{2:|}{0:~ }|
|
{0:~ }{2:|}{0:~ }|
|
||||||
@@ -58,11 +58,11 @@ describe(":drop", function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it("splits off a new window when a buffer can't be abandoned", function()
|
it("splits off a new window when a buffer can't be abandoned", function()
|
||||||
execute("edit tmp1")
|
feed_command("edit tmp1")
|
||||||
execute("vsplit")
|
feed_command("vsplit")
|
||||||
execute("edit tmp2")
|
feed_command("edit tmp2")
|
||||||
feed("iABC<esc>")
|
feed("iABC<esc>")
|
||||||
execute("drop tmp3")
|
feed_command("drop tmp3")
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
^ {2:|} |
|
^ {2:|} |
|
||||||
{0:~ }{2:|}{0:~ }|
|
{0:~ }{2:|}{0:~ }|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
local helpers = require("test.functional.helpers")(after_each)
|
local helpers = require("test.functional.helpers")(after_each)
|
||||||
local eq, execute, funcs = helpers.eq, helpers.execute, helpers.funcs
|
local eq, command, funcs = helpers.eq, helpers.command, helpers.funcs
|
||||||
local ok = helpers.ok
|
local ok = helpers.ok
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
|
local feed = helpers.feed
|
||||||
|
|
||||||
describe(":edit", function()
|
describe(":edit", function()
|
||||||
before_each(function()
|
before_each(function()
|
||||||
@@ -9,13 +10,13 @@ describe(":edit", function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it("without arguments does not restart :terminal buffer", function()
|
it("without arguments does not restart :terminal buffer", function()
|
||||||
execute("terminal")
|
command("terminal")
|
||||||
helpers.feed([[<C-\><C-N>]])
|
feed([[<C-\><C-N>]])
|
||||||
local bufname_before = funcs.bufname("%")
|
local bufname_before = funcs.bufname("%")
|
||||||
local bufnr_before = funcs.bufnr("%")
|
local bufnr_before = funcs.bufnr("%")
|
||||||
helpers.ok(nil ~= string.find(bufname_before, "^term://")) -- sanity
|
helpers.ok(nil ~= string.find(bufname_before, "^term://")) -- sanity
|
||||||
|
|
||||||
execute("edit")
|
command("edit")
|
||||||
|
|
||||||
local bufname_after = funcs.bufname("%")
|
local bufname_after = funcs.bufname("%")
|
||||||
local bufnr_after = funcs.bufnr("%")
|
local bufnr_after = funcs.bufnr("%")
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear, execute, feed = helpers.clear, helpers.execute, helpers.feed
|
local clear, feed_command, feed = helpers.clear, helpers.feed_command, helpers.feed
|
||||||
local eq, neq, eval = helpers.eq, helpers.neq, helpers.eval
|
local eq, neq, eval = helpers.eq, helpers.neq, helpers.eval
|
||||||
|
|
||||||
describe('&encoding', function()
|
describe('&encoding', function()
|
||||||
@@ -12,7 +12,7 @@ describe('&encoding', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('cannot be changed after setup', function()
|
it('cannot be changed after setup', function()
|
||||||
execute('set encoding=latin1')
|
feed_command('set encoding=latin1')
|
||||||
-- error message expected
|
-- error message expected
|
||||||
feed('<cr>')
|
feed('<cr>')
|
||||||
neq(nil, string.find(eval('v:errmsg'), '^E474:'))
|
neq(nil, string.find(eval('v:errmsg'), '^E474:'))
|
||||||
@@ -31,7 +31,7 @@ describe('&encoding', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('can be set to utf-8 without error', function()
|
it('can be set to utf-8 without error', function()
|
||||||
execute('set encoding=utf-8')
|
feed_command('set encoding=utf-8')
|
||||||
eq("", eval('v:errmsg'))
|
eq("", eval('v:errmsg'))
|
||||||
|
|
||||||
clear('--cmd', 'set enc=utf-8')
|
clear('--cmd', 'set enc=utf-8')
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear, execute, feed, ok, eval =
|
local clear, feed_command, feed, ok, eval =
|
||||||
helpers.clear, helpers.execute, helpers.feed, helpers.ok, helpers.eval
|
helpers.clear, helpers.feed_command, helpers.feed, helpers.ok, helpers.eval
|
||||||
|
|
||||||
describe(':grep', function()
|
describe(':grep', function()
|
||||||
before_each(clear)
|
before_each(clear)
|
||||||
@@ -11,10 +11,10 @@ describe(':grep', function()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
execute([[set grepprg=grep\ -r]])
|
feed_command([[set grepprg=grep\ -r]])
|
||||||
-- Change to test directory so that the test does not run too long.
|
-- Change to test directory so that the test does not run too long.
|
||||||
execute('cd test')
|
feed_command('cd test')
|
||||||
execute('grep a **/*')
|
feed_command('grep a **/*')
|
||||||
feed('<cr>') -- Press ENTER
|
feed('<cr>') -- Press ENTER
|
||||||
ok(eval('len(getqflist())') > 9000) -- IT'S OVER 9000!!1
|
ok(eval('len(getqflist())') > 9000) -- IT'S OVER 9000!!1
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear, execute, nvim = helpers.clear, helpers.execute, helpers.nvim
|
local clear, command, nvim = helpers.clear, helpers.command, helpers.nvim
|
||||||
local expect, feed, command = helpers.expect, helpers.feed, helpers.command
|
local expect, feed = helpers.expect, helpers.feed
|
||||||
local eq, eval = helpers.eq, helpers.eval
|
local eq, eval = helpers.eq, helpers.eval
|
||||||
|
|
||||||
describe(':emenu', function()
|
describe(':emenu', function()
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
execute('nnoremenu Test.Test inormal<ESC>')
|
command('nnoremenu Test.Test inormal<ESC>')
|
||||||
execute('inoremenu Test.Test insert')
|
command('inoremenu Test.Test insert')
|
||||||
execute('vnoremenu Test.Test x')
|
command('vnoremenu Test.Test x')
|
||||||
execute('cnoremenu Test.Test cmdmode')
|
command('cnoremenu Test.Test cmdmode')
|
||||||
|
|
||||||
execute('nnoremenu Edit.Paste p')
|
command('nnoremenu Edit.Paste p')
|
||||||
execute('cnoremenu Edit.Paste <C-R>"')
|
command('cnoremenu Edit.Paste <C-R>"')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('executes correct bindings in normal mode without using API', function()
|
it('executes correct bindings in normal mode without using API', function()
|
||||||
execute('emenu Test.Test')
|
command('emenu Test.Test')
|
||||||
expect('normal')
|
expect('normal')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
|
||||||
local buf, eq, execute = helpers.curbufmeths, helpers.eq, helpers.execute
|
local buf, eq, feed_command = helpers.curbufmeths, helpers.eq, helpers.feed_command
|
||||||
local feed, nvim_prog, wait = helpers.feed, helpers.nvim_prog, helpers.wait
|
local feed, nvim_prog, wait = helpers.feed, helpers.nvim_prog, helpers.wait
|
||||||
local ok, set_session, spawn = helpers.ok, helpers.set_session, helpers.spawn
|
local ok, set_session, spawn = helpers.ok, helpers.set_session, helpers.spawn
|
||||||
|
|
||||||
@@ -27,12 +27,12 @@ describe(':oldfiles', function()
|
|||||||
it('shows most recently used files', function()
|
it('shows most recently used files', function()
|
||||||
local screen = Screen.new(100, 5)
|
local screen = Screen.new(100, 5)
|
||||||
screen:attach()
|
screen:attach()
|
||||||
execute('edit testfile1')
|
feed_command('edit testfile1')
|
||||||
execute('edit testfile2')
|
feed_command('edit testfile2')
|
||||||
execute('wshada ' .. shada_file)
|
feed_command('wshada ' .. shada_file)
|
||||||
execute('rshada! ' .. shada_file)
|
feed_command('rshada! ' .. shada_file)
|
||||||
local oldfiles = helpers.meths.get_vvar('oldfiles')
|
local oldfiles = helpers.meths.get_vvar('oldfiles')
|
||||||
execute('oldfiles')
|
feed_command('oldfiles')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
testfile2 |
|
testfile2 |
|
||||||
1: ]].. add_padding(oldfiles[1]) ..[[ |
|
1: ]].. add_padding(oldfiles[1]) ..[[ |
|
||||||
@@ -50,14 +50,14 @@ describe(':browse oldfiles', function()
|
|||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
_clear()
|
_clear()
|
||||||
execute('edit testfile1')
|
feed_command('edit testfile1')
|
||||||
filename = buf.get_name()
|
filename = buf.get_name()
|
||||||
execute('edit testfile2')
|
feed_command('edit testfile2')
|
||||||
filename2 = buf.get_name()
|
filename2 = buf.get_name()
|
||||||
execute('wshada ' .. shada_file)
|
feed_command('wshada ' .. shada_file)
|
||||||
wait()
|
wait()
|
||||||
_clear()
|
_clear()
|
||||||
execute('rshada! ' .. shada_file)
|
feed_command('rshada! ' .. shada_file)
|
||||||
|
|
||||||
-- Ensure nvim is out of "Press ENTER..." prompt.
|
-- Ensure nvim is out of "Press ENTER..." prompt.
|
||||||
feed('<cr>')
|
feed('<cr>')
|
||||||
@@ -70,7 +70,7 @@ describe(':browse oldfiles', function()
|
|||||||
ok(filename == oldfiles[1] or filename == oldfiles[2])
|
ok(filename == oldfiles[1] or filename == oldfiles[2])
|
||||||
ok(filename2 == oldfiles[1] or filename2 == oldfiles[2])
|
ok(filename2 == oldfiles[1] or filename2 == oldfiles[2])
|
||||||
|
|
||||||
execute('browse oldfiles')
|
feed_command('browse oldfiles')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
after_each(function()
|
after_each(function()
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local lfs = require('lfs')
|
local lfs = require('lfs')
|
||||||
local execute, eq, clear, eval, feed, expect, source =
|
local feed_command, eq, clear, eval, feed, expect, source =
|
||||||
helpers.execute, helpers.eq, helpers.clear, helpers.eval, helpers.feed,
|
helpers.feed_command, helpers.eq, helpers.clear, helpers.eval, helpers.feed,
|
||||||
helpers.expect, helpers.source
|
helpers.expect, helpers.source
|
||||||
|
|
||||||
if helpers.pending_win32(pending) then return end
|
if helpers.pending_win32(pending) then return end
|
||||||
@@ -13,7 +13,7 @@ describe(':recover', function()
|
|||||||
|
|
||||||
it('fails if given a non-existent swapfile', function()
|
it('fails if given a non-existent swapfile', function()
|
||||||
local swapname = 'bogus-swapfile'
|
local swapname = 'bogus-swapfile'
|
||||||
execute('recover '..swapname) -- This should not segfault. #2117
|
feed_command('recover '..swapname) -- This should not segfault. #2117
|
||||||
eq('E305: No swap file found for '..swapname, eval('v:errmsg'))
|
eq('E305: No swap file found for '..swapname, eval('v:errmsg'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -40,12 +40,12 @@ describe(':preserve', function()
|
|||||||
]]
|
]]
|
||||||
|
|
||||||
source(init)
|
source(init)
|
||||||
execute('set swapfile fileformat=unix undolevels=-1')
|
feed_command('set swapfile fileformat=unix undolevels=-1')
|
||||||
-- Put swapdir at the start of the 'directory' list. #1836
|
-- Put swapdir at the start of the 'directory' list. #1836
|
||||||
execute('set directory^='..swapdir..'//')
|
feed_command('set directory^='..swapdir..'//')
|
||||||
execute('edit '..testfile)
|
feed_command('edit '..testfile)
|
||||||
feed('isometext<esc>')
|
feed('isometext<esc>')
|
||||||
execute('preserve')
|
feed_command('preserve')
|
||||||
source('redir => g:swapname | swapname | redir END')
|
source('redir => g:swapname | swapname | redir END')
|
||||||
|
|
||||||
local swappath1 = eval('g:swapname')
|
local swappath1 = eval('g:swapname')
|
||||||
@@ -59,8 +59,8 @@ describe(':preserve', function()
|
|||||||
source(init)
|
source(init)
|
||||||
|
|
||||||
-- Use the "SwapExists" event to choose the (R)ecover choice at the dialog.
|
-- Use the "SwapExists" event to choose the (R)ecover choice at the dialog.
|
||||||
execute('autocmd SwapExists * let v:swapchoice = "r"')
|
feed_command('autocmd SwapExists * let v:swapchoice = "r"')
|
||||||
execute('silent edit '..testfile)
|
feed_command('silent edit '..testfile)
|
||||||
source('redir => g:swapname | swapname | redir END')
|
source('redir => g:swapname | swapname | redir END')
|
||||||
|
|
||||||
local swappath2 = eval('g:swapname')
|
local swappath2 = eval('g:swapname')
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ local clear = helpers.clear
|
|||||||
local insert = helpers.insert
|
local insert = helpers.insert
|
||||||
local feed = helpers.feed
|
local feed = helpers.feed
|
||||||
local expect = helpers.expect
|
local expect = helpers.expect
|
||||||
local execute = helpers.execute
|
local feed_command = helpers.feed_command
|
||||||
local exc_exec = helpers.exc_exec
|
local exc_exec = helpers.exc_exec
|
||||||
|
|
||||||
describe(':undojoin command', function()
|
describe(':undojoin command', function()
|
||||||
@@ -14,10 +14,10 @@ describe(':undojoin command', function()
|
|||||||
insert([[
|
insert([[
|
||||||
Line of text 1
|
Line of text 1
|
||||||
Line of text 2]])
|
Line of text 2]])
|
||||||
execute('goto 1')
|
feed_command('goto 1')
|
||||||
end)
|
end)
|
||||||
it('joins changes in a buffer', function()
|
it('joins changes in a buffer', function()
|
||||||
execute('undojoin | delete')
|
feed_command('undojoin | delete')
|
||||||
expect([[
|
expect([[
|
||||||
Line of text 2]])
|
Line of text 2]])
|
||||||
feed('u')
|
feed('u')
|
||||||
@@ -26,7 +26,7 @@ describe(':undojoin command', function()
|
|||||||
end)
|
end)
|
||||||
it('does not corrupt undolist when connected with redo', function()
|
it('does not corrupt undolist when connected with redo', function()
|
||||||
feed('ixx<esc>')
|
feed('ixx<esc>')
|
||||||
execute('undojoin | redo')
|
feed_command('undojoin | redo')
|
||||||
expect([[
|
expect([[
|
||||||
xxLine of text 1
|
xxLine of text 1
|
||||||
Line of text 2]])
|
Line of text 2]])
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local lfs = require('lfs')
|
local lfs = require('lfs')
|
||||||
local eq, eval, clear, write_file, execute, source, insert =
|
local eq, eval, clear, write_file, source, insert =
|
||||||
helpers.eq, helpers.eval, helpers.clear, helpers.write_file,
|
helpers.eq, helpers.eval, helpers.clear, helpers.write_file,
|
||||||
helpers.execute, helpers.source, helpers.insert
|
helpers.source, helpers.insert
|
||||||
local redir_exec = helpers.redir_exec
|
local redir_exec = helpers.redir_exec
|
||||||
local exc_exec = helpers.exc_exec
|
local exc_exec = helpers.exc_exec
|
||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
|
local feed_command = helpers.feed_command
|
||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local meths = helpers.meths
|
local meths = helpers.meths
|
||||||
|
|
||||||
@@ -33,9 +34,9 @@ describe(':write', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('&backupcopy=auto preserves symlinks', function()
|
it('&backupcopy=auto preserves symlinks', function()
|
||||||
execute('set backupcopy=auto')
|
command('set backupcopy=auto')
|
||||||
write_file('test_bkc_file.txt', 'content0')
|
write_file('test_bkc_file.txt', 'content0')
|
||||||
execute("silent !ln -s test_bkc_file.txt test_bkc_link.txt")
|
command("silent !ln -s test_bkc_file.txt test_bkc_link.txt")
|
||||||
source([[
|
source([[
|
||||||
edit test_bkc_link.txt
|
edit test_bkc_link.txt
|
||||||
call setline(1, ['content1'])
|
call setline(1, ['content1'])
|
||||||
@@ -46,9 +47,9 @@ describe(':write', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('&backupcopy=no replaces symlink with new file', function()
|
it('&backupcopy=no replaces symlink with new file', function()
|
||||||
execute('set backupcopy=no')
|
command('set backupcopy=no')
|
||||||
write_file('test_bkc_file.txt', 'content0')
|
write_file('test_bkc_file.txt', 'content0')
|
||||||
execute("silent !ln -s test_bkc_file.txt test_bkc_link.txt")
|
command("silent !ln -s test_bkc_file.txt test_bkc_link.txt")
|
||||||
source([[
|
source([[
|
||||||
edit test_bkc_link.txt
|
edit test_bkc_link.txt
|
||||||
call setline(1, ['content1'])
|
call setline(1, ['content1'])
|
||||||
@@ -69,7 +70,7 @@ describe(':write', function()
|
|||||||
insert(text)
|
insert(text)
|
||||||
|
|
||||||
-- Blocks until a consumer reads the FIFO.
|
-- Blocks until a consumer reads the FIFO.
|
||||||
execute("write >> test_fifo")
|
feed_command("write >> test_fifo")
|
||||||
|
|
||||||
-- Read the FIFO, this will unblock the :write above.
|
-- Read the FIFO, this will unblock the :write above.
|
||||||
local fifo = assert(io.open("test_fifo"))
|
local fifo = assert(io.open("test_fifo"))
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
-- Specs for :wundo and underlying functions
|
-- Specs for :wundo and underlying functions
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local execute, clear, eval, feed, spawn, nvim_prog, set_session =
|
local command, clear, eval, spawn, nvim_prog, set_session =
|
||||||
helpers.execute, helpers.clear, helpers.eval, helpers.feed, helpers.spawn,
|
helpers.command, helpers.clear, helpers.eval, helpers.spawn,
|
||||||
helpers.nvim_prog, helpers.set_session
|
helpers.nvim_prog, helpers.set_session
|
||||||
|
|
||||||
|
|
||||||
describe(':wundo', function()
|
describe(':wundo', function()
|
||||||
before_each(clear)
|
before_each(clear)
|
||||||
|
after_each(function()
|
||||||
|
os.remove(eval('getcwd()') .. '/foo')
|
||||||
|
end)
|
||||||
|
|
||||||
it('safely fails on new, non-empty buffer', function()
|
it('safely fails on new, non-empty buffer', function()
|
||||||
feed('iabc<esc>')
|
command('normal! iabc')
|
||||||
execute('wundo foo') -- This should not segfault. #1027
|
command('wundo foo') -- This should not segfault. #1027
|
||||||
--TODO: check messages for error message
|
--TODO: check messages for error message
|
||||||
|
|
||||||
os.remove(eval('getcwd()') .. '/foo') --cleanup
|
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ describe('u_* functions', function()
|
|||||||
local session = spawn({nvim_prog, '-u', 'NONE', '-i', 'NONE', '--embed',
|
local session = spawn({nvim_prog, '-u', 'NONE', '-i', 'NONE', '--embed',
|
||||||
'-c', 'set undodir=. undofile'})
|
'-c', 'set undodir=. undofile'})
|
||||||
set_session(session)
|
set_session(session)
|
||||||
execute('echo "True"') -- Should not error out due to crashed Neovim
|
command('echo "True"') -- Should not error out due to crashed Neovim
|
||||||
session:close()
|
session:close()
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local lfs = require('lfs')
|
local lfs = require('lfs')
|
||||||
local execute, eq, neq, spawn, nvim_prog, set_session, wait, write_file
|
local command, eq, neq, spawn, nvim_prog, set_session, write_file =
|
||||||
= helpers.execute, helpers.eq, helpers.neq, helpers.spawn,
|
helpers.command, helpers.eq, helpers.neq, helpers.spawn,
|
||||||
helpers.nvim_prog, helpers.set_session, helpers.wait, helpers.write_file
|
helpers.nvim_prog, helpers.set_session, helpers.write_file
|
||||||
|
|
||||||
describe(':wshada', function()
|
describe(':wshada', function()
|
||||||
local shada_file = 'wshada_test'
|
local shada_file = 'wshada_test'
|
||||||
@@ -24,8 +24,7 @@ describe(':wshada', function()
|
|||||||
it('creates a shada file', function()
|
it('creates a shada file', function()
|
||||||
-- file should _not_ exist
|
-- file should _not_ exist
|
||||||
eq(nil, lfs.attributes(shada_file))
|
eq(nil, lfs.attributes(shada_file))
|
||||||
execute('wsh! '..shada_file)
|
command('wsh! '..shada_file)
|
||||||
wait()
|
|
||||||
-- file _should_ exist
|
-- file _should_ exist
|
||||||
neq(nil, lfs.attributes(shada_file))
|
neq(nil, lfs.attributes(shada_file))
|
||||||
end)
|
end)
|
||||||
@@ -40,8 +39,7 @@ describe(':wshada', function()
|
|||||||
eq(text, io.open(shada_file):read())
|
eq(text, io.open(shada_file):read())
|
||||||
neq(nil, lfs.attributes(shada_file))
|
neq(nil, lfs.attributes(shada_file))
|
||||||
|
|
||||||
execute('wsh! '..shada_file)
|
command('wsh! '..shada_file)
|
||||||
wait()
|
|
||||||
|
|
||||||
-- File should have been overwritten with a shada file.
|
-- File should have been overwritten with a shada file.
|
||||||
local fp = io.open(shada_file, 'r')
|
local fp = io.open(shada_file, 'r')
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ local Session = require('nvim.session')
|
|||||||
local TcpStream = require('nvim.tcp_stream')
|
local TcpStream = require('nvim.tcp_stream')
|
||||||
local SocketStream = require('nvim.socket_stream')
|
local SocketStream = require('nvim.socket_stream')
|
||||||
local ChildProcessStream = require('nvim.child_process_stream')
|
local ChildProcessStream = require('nvim.child_process_stream')
|
||||||
|
local Paths = require('test.config.paths')
|
||||||
|
|
||||||
local check_cores = global_helpers.check_cores
|
local check_cores = global_helpers.check_cores
|
||||||
local check_logs = global_helpers.check_logs
|
local check_logs = global_helpers.check_logs
|
||||||
@@ -20,7 +21,11 @@ local dedent = global_helpers.dedent
|
|||||||
|
|
||||||
local start_dir = lfs.currentdir()
|
local start_dir = lfs.currentdir()
|
||||||
-- XXX: NVIM_PROG takes precedence, QuickBuild sets it.
|
-- XXX: NVIM_PROG takes precedence, QuickBuild sets it.
|
||||||
local nvim_prog = os.getenv('NVIM_PROG') or os.getenv('NVIM_PRG') or 'build/bin/nvim'
|
local nvim_prog = (
|
||||||
|
os.getenv('NVIM_PROG')
|
||||||
|
or os.getenv('NVIM_PRG')
|
||||||
|
or Paths.test_build_dir .. '/bin/nvim'
|
||||||
|
)
|
||||||
-- Default settings for the test session.
|
-- Default settings for the test session.
|
||||||
local nvim_set = 'set shortmess+=I background=light noswapfile noautoindent'
|
local nvim_set = 'set shortmess+=I background=light noswapfile noautoindent'
|
||||||
..' laststatus=1 undodir=. directory=. viewdir=. backupdir=.'
|
..' laststatus=1 undodir=. directory=. viewdir=. backupdir=.'
|
||||||
@@ -305,7 +310,7 @@ end
|
|||||||
|
|
||||||
-- Executes an ex-command by user input. Because nvim_input() is used, VimL
|
-- Executes an ex-command by user input. Because nvim_input() is used, VimL
|
||||||
-- errors will not manifest as client (lua) errors. Use command() for that.
|
-- errors will not manifest as client (lua) errors. Use command() for that.
|
||||||
local function execute(...)
|
local function feed_command(...)
|
||||||
for _, v in ipairs({...}) do
|
for _, v in ipairs({...}) do
|
||||||
if v:sub(1, 1) ~= '/' then
|
if v:sub(1, 1) ~= '/' then
|
||||||
-- not a search command, prefix with colon
|
-- not a search command, prefix with colon
|
||||||
@@ -566,7 +571,7 @@ local M = {
|
|||||||
insert = insert,
|
insert = insert,
|
||||||
iswin = iswin,
|
iswin = iswin,
|
||||||
feed = feed,
|
feed = feed,
|
||||||
execute = execute,
|
feed_command = feed_command,
|
||||||
eval = nvim_eval,
|
eval = nvim_eval,
|
||||||
call = nvim_call,
|
call = nvim_call,
|
||||||
command = nvim_command,
|
command = nvim_command,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
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 execute, expect = helpers.execute, helpers.expect
|
local feed_command, expect = helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe('filename recognition', function()
|
describe('filename recognition', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -17,17 +17,17 @@ describe('filename recognition', function()
|
|||||||
fourth test for URL:\\machine.name\tmp\vimtest2d, and other text]])
|
fourth test for URL:\\machine.name\tmp\vimtest2d, and other text]])
|
||||||
|
|
||||||
-- Go to the first URL and append it to the beginning
|
-- Go to the first URL and append it to the beginning
|
||||||
execute('/^first', '/tmp', 'call append(0, expand("<cfile>"))')
|
feed_command('/^first', '/tmp', 'call append(0, expand("<cfile>"))')
|
||||||
|
|
||||||
-- Repeat for the second URL
|
-- Repeat for the second URL
|
||||||
-- this time, navigate to the word "URL" instead of "tmp"
|
-- this time, navigate to the word "URL" instead of "tmp"
|
||||||
execute('/^second', '/URL', 'call append(1, expand("<cfile>"))')
|
feed_command('/^second', '/URL', 'call append(1, expand("<cfile>"))')
|
||||||
|
|
||||||
-- Repeat for the remaining URLs. This time, the 'isfname' option must be
|
-- Repeat for the remaining URLs. This time, the 'isfname' option must be
|
||||||
-- set to allow '\' in filenames
|
-- set to allow '\' in filenames
|
||||||
execute('set isf=@,48-57,/,.,-,_,+,,,$,:,~,\\')
|
feed_command('set isf=@,48-57,/,.,-,_,+,,,$,:,~,\\')
|
||||||
execute('/^third', '/name', 'call append(2, expand("<cfile>"))')
|
feed_command('/^third', '/name', 'call append(2, expand("<cfile>"))')
|
||||||
execute('/^fourth', '/URL', 'call append(3, expand("<cfile>"))')
|
feed_command('/^fourth', '/URL', 'call append(3, expand("<cfile>"))')
|
||||||
|
|
||||||
-- Delete the initial text, which now starts at line 5
|
-- Delete the initial text, which now starts at line 5
|
||||||
feed('5GdG')
|
feed('5GdG')
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,9 @@
|
|||||||
-- vim: set foldmethod=marker foldmarker=[[,]] :
|
|
||||||
-- Test for autocommand that changes current buffer on BufEnter event.
|
-- Test for autocommand that changes current buffer on BufEnter event.
|
||||||
-- Check if modelines are interpreted for the correct buffer.
|
-- Check if modelines are interpreted for the correct buffer.
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
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 execute, expect = helpers.execute, helpers.expect
|
local feed_command, expect = helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe('BufEnter with modelines', function()
|
describe('BufEnter with modelines', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -20,34 +19,34 @@ describe('BufEnter with modelines', function()
|
|||||||
this is a test
|
this is a test
|
||||||
end of test file Xxx]])
|
end of test file Xxx]])
|
||||||
|
|
||||||
execute('au BufEnter Xxx brew')
|
feed_command('au BufEnter Xxx brew')
|
||||||
|
|
||||||
-- Write test file Xxx
|
-- Write test file Xxx
|
||||||
execute('/start of')
|
feed_command('/start of')
|
||||||
execute('.,/end of/w! Xxx')
|
feed_command('.,/end of/w! Xxx')
|
||||||
execute('set ai modeline modelines=3')
|
feed_command('set ai modeline modelines=3')
|
||||||
|
|
||||||
-- Split to Xxx, autocmd will do :brew
|
-- Split to Xxx, autocmd will do :brew
|
||||||
execute('sp Xxx')
|
feed_command('sp Xxx')
|
||||||
|
|
||||||
-- Append text with autoindent to this file
|
-- Append text with autoindent to this file
|
||||||
feed('G?this is a<CR>')
|
feed('G?this is a<CR>')
|
||||||
feed('othis should be auto-indented<Esc>')
|
feed('othis should be auto-indented<Esc>')
|
||||||
|
|
||||||
-- Go to Xxx, no autocmd anymore
|
-- Go to Xxx, no autocmd anymore
|
||||||
execute('au! BufEnter Xxx')
|
feed_command('au! BufEnter Xxx')
|
||||||
execute('buf Xxx')
|
feed_command('buf Xxx')
|
||||||
|
|
||||||
-- Append text without autoindent to Xxx
|
-- Append text without autoindent to Xxx
|
||||||
feed('G?this is a<CR>')
|
feed('G?this is a<CR>')
|
||||||
feed('othis should be in column 1<Esc>')
|
feed('othis should be in column 1<Esc>')
|
||||||
execute('wq')
|
feed_command('wq')
|
||||||
|
|
||||||
-- Include Xxx in the current file
|
-- Include Xxx in the current file
|
||||||
feed('G:r Xxx<CR>')
|
feed('G:r Xxx<CR>')
|
||||||
|
|
||||||
-- Vim issue #57 do not move cursor on <c-o> when autoindent is set
|
-- Vim issue #57 do not move cursor on <c-o> when autoindent is set
|
||||||
execute('set fo+=r')
|
feed_command('set fo+=r')
|
||||||
feed('G')
|
feed('G')
|
||||||
feed('o# abcdef<Esc>2hi<CR><c-o>d0<Esc>')
|
feed('o# abcdef<Esc>2hi<CR><c-o>d0<Esc>')
|
||||||
feed('o# abcdef<Esc>2hi<c-o>d0<Esc>')
|
feed('o# abcdef<Esc>2hi<c-o>d0<Esc>')
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
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 execute, expect = helpers.execute, helpers.expect
|
local command, expect = helpers.command, helpers.expect
|
||||||
|
local wait = helpers.wait
|
||||||
|
|
||||||
describe('test5', function()
|
describe('test5', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -18,35 +19,37 @@ describe('test5', function()
|
|||||||
this is a test
|
this is a test
|
||||||
end of test file Xxx]])
|
end of test file Xxx]])
|
||||||
|
|
||||||
execute('w! Xxx0')
|
command('w! Xxx0')
|
||||||
execute('au BufLeave Xxx bwipe')
|
command('au BufLeave Xxx bwipe')
|
||||||
execute('/start of')
|
command('/start of')
|
||||||
|
|
||||||
-- Write test file Xxx.
|
-- Write test file Xxx.
|
||||||
execute('.,/end of/w! Xxx')
|
command('.,/end of/w! Xxx')
|
||||||
|
|
||||||
-- Split to Xxx.
|
-- Split to Xxx.
|
||||||
execute('sp Xxx')
|
command('sp Xxx')
|
||||||
|
|
||||||
-- Delete buffer Xxx, now we're back here.
|
-- Delete buffer Xxx, now we're back here.
|
||||||
execute('bwipe')
|
command('bwipe')
|
||||||
feed('G?this is a<cr>')
|
feed('G?this is a<cr>')
|
||||||
feed('othis is some more text<esc>')
|
feed('othis is some more text<esc>')
|
||||||
|
wait()
|
||||||
|
|
||||||
-- Append some text to this file.
|
-- Append some text to this file.
|
||||||
|
|
||||||
-- Write current file contents.
|
-- Write current file contents.
|
||||||
execute('?start?,$yank A')
|
command('?start?,$yank A')
|
||||||
|
|
||||||
-- Delete current buffer, get an empty one.
|
-- Delete current buffer, get an empty one.
|
||||||
execute('bwipe!')
|
command('bwipe!')
|
||||||
-- Append an extra line to the output register.
|
-- Append an extra line to the output register.
|
||||||
feed('ithis is another test line<esc>:yank A<cr>')
|
feed('ithis is another test line<esc>:yank A<cr>')
|
||||||
|
wait()
|
||||||
|
|
||||||
-- Output results
|
-- Output results
|
||||||
execute('%d')
|
command('%d')
|
||||||
execute('0put a')
|
command('0put a')
|
||||||
execute('$d')
|
command('$d')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([[
|
expect([[
|
||||||
|
|||||||
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
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 execute, dedent, eq = helpers.execute, helpers.dedent, helpers.eq
|
local command, dedent, eq = helpers.command, helpers.dedent, helpers.eq
|
||||||
local curbuf_contents = helpers.curbuf_contents
|
local curbuf_contents = helpers.curbuf_contents
|
||||||
|
local wait = helpers.wait
|
||||||
|
|
||||||
describe('argument list', function()
|
describe('argument list', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -16,10 +17,11 @@ describe('argument list', function()
|
|||||||
this is a test
|
this is a test
|
||||||
this is a test
|
this is a test
|
||||||
end of test file Xxx]])
|
end of test file Xxx]])
|
||||||
|
wait()
|
||||||
|
|
||||||
|
command('au BufReadPost Xxx2 next Xxx2 Xxx1')
|
||||||
|
command('/^start of')
|
||||||
|
|
||||||
execute('au BufReadPost Xxx2 next Xxx2 Xxx1')
|
|
||||||
execute('/^start of')
|
|
||||||
|
|
||||||
-- Write test file Xxx1
|
-- Write test file Xxx1
|
||||||
feed('A1<Esc>:.,/end of/w! Xxx1<cr>')
|
feed('A1<Esc>:.,/end of/w! Xxx1<cr>')
|
||||||
|
|
||||||
@@ -28,29 +30,31 @@ describe('argument list', function()
|
|||||||
|
|
||||||
-- Write test file Xxx3
|
-- Write test file Xxx3
|
||||||
feed('$r3:.,/end of/w! Xxx3<cr>')
|
feed('$r3:.,/end of/w! Xxx3<cr>')
|
||||||
|
wait()
|
||||||
|
|
||||||
-- Redefine arglist; go to Xxx1
|
-- Redefine arglist; go to Xxx1
|
||||||
execute('next! Xxx1 Xxx2 Xxx3')
|
command('next! Xxx1 Xxx2 Xxx3')
|
||||||
|
|
||||||
-- Open window for all args
|
-- Open window for all args
|
||||||
execute('all')
|
command('all')
|
||||||
|
|
||||||
-- Write contents of Xxx1
|
-- Write contents of Xxx1
|
||||||
execute('%yank A')
|
command('%yank A')
|
||||||
|
|
||||||
-- Append contents of last window (Xxx1)
|
-- Append contents of last window (Xxx1)
|
||||||
feed('')
|
feed('')
|
||||||
execute('%yank A')
|
wait()
|
||||||
|
command('%yank A')
|
||||||
-- should now be in Xxx2
|
|
||||||
execute('rew')
|
|
||||||
|
|
||||||
-- Append contents of Xxx2
|
|
||||||
execute('%yank A')
|
|
||||||
|
|
||||||
execute('%d')
|
-- should now be in Xxx2
|
||||||
execute('0put=@a')
|
command('rew')
|
||||||
execute('$d')
|
|
||||||
|
-- Append contents of Xxx2
|
||||||
|
command('%yank A')
|
||||||
|
|
||||||
|
command('%d')
|
||||||
|
command('0put=@a')
|
||||||
|
command('$d')
|
||||||
|
|
||||||
eq(dedent([[
|
eq(dedent([[
|
||||||
start of test file Xxx1
|
start of test file Xxx1
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
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 execute, expect = helpers.execute, helpers.expect
|
local feed_command, expect = helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe(':ball', function()
|
describe(':ball', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -14,44 +14,44 @@ describe(':ball', function()
|
|||||||
this is a test
|
this is a test
|
||||||
end of test file Xxx]])
|
end of test file Xxx]])
|
||||||
|
|
||||||
execute('w! Xxx0')
|
feed_command('w! Xxx0')
|
||||||
feed('gg')
|
feed('gg')
|
||||||
|
|
||||||
-- Write test file Xxx1
|
-- Write test file Xxx1
|
||||||
feed('A1:.,/end of/w! Xxx1<cr>')
|
feed('A1:.,/end of/w! Xxx1<cr>')
|
||||||
execute('sp Xxx1')
|
feed_command('sp Xxx1')
|
||||||
execute('close')
|
feed_command('close')
|
||||||
|
|
||||||
-- Write test file Xxx2
|
-- Write test file Xxx2
|
||||||
feed('$r2:.,/end of/w! Xxx2<cr>')
|
feed('$r2:.,/end of/w! Xxx2<cr>')
|
||||||
execute('sp Xxx2')
|
feed_command('sp Xxx2')
|
||||||
execute('close')
|
feed_command('close')
|
||||||
|
|
||||||
-- Write test file Xxx3
|
-- Write test file Xxx3
|
||||||
feed('$r3:.,/end of/w! Xxx3<cr>')
|
feed('$r3:.,/end of/w! Xxx3<cr>')
|
||||||
execute('sp Xxx3')
|
feed_command('sp Xxx3')
|
||||||
execute('close')
|
feed_command('close')
|
||||||
|
|
||||||
execute('au BufReadPost Xxx2 bwipe')
|
feed_command('au BufReadPost Xxx2 bwipe')
|
||||||
|
|
||||||
-- Open window for all args, close Xxx2
|
-- Open window for all args, close Xxx2
|
||||||
feed('$r4:ball<cr>')
|
feed('$r4:ball<cr>')
|
||||||
|
|
||||||
-- Write contents of this file
|
-- Write contents of this file
|
||||||
execute('%yank A')
|
feed_command('%yank A')
|
||||||
|
|
||||||
-- Append contents of second window (Xxx1)
|
-- Append contents of second window (Xxx1)
|
||||||
feed('')
|
feed('')
|
||||||
execute('%yank A')
|
feed_command('%yank A')
|
||||||
|
|
||||||
-- Append contents of last window (this file)
|
-- Append contents of last window (this file)
|
||||||
feed('')
|
feed('')
|
||||||
execute('%yank A')
|
feed_command('%yank A')
|
||||||
|
|
||||||
execute('bf')
|
feed_command('bf')
|
||||||
execute('%d')
|
feed_command('%d')
|
||||||
execute('0put=@a')
|
feed_command('0put=@a')
|
||||||
execute('$d')
|
feed_command('$d')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
start of test file Xxx4
|
start of test file Xxx4
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, source = helpers.feed, helpers.source
|
local feed, source = helpers.feed, helpers.source
|
||||||
local clear, execute, expect, eq, eval = helpers.clear, helpers.execute, helpers.expect, helpers.eq, helpers.eval
|
local clear, feed_command, expect, eq, eval = helpers.clear, helpers.feed_command, helpers.expect, helpers.eq, helpers.eval
|
||||||
local write_file, wait, dedent = helpers.write_file, helpers.wait, helpers.dedent
|
local write_file, wait, dedent = helpers.write_file, helpers.wait, helpers.dedent
|
||||||
local io = require('io')
|
local io = require('io')
|
||||||
|
|
||||||
@@ -25,15 +25,15 @@ describe('autocommands that delete and unload buffers:', function()
|
|||||||
before_each(clear)
|
before_each(clear)
|
||||||
|
|
||||||
it('BufWritePre, BufUnload', function()
|
it('BufWritePre, BufUnload', function()
|
||||||
execute('au BufWritePre Xxx1 bunload')
|
feed_command('au BufWritePre Xxx1 bunload')
|
||||||
execute('au BufWritePre Xxx2 bwipe')
|
feed_command('au BufWritePre Xxx2 bwipe')
|
||||||
execute('e Xxx2')
|
feed_command('e Xxx2')
|
||||||
eq('Xxx2', eval('bufname("%")'))
|
eq('Xxx2', eval('bufname("%")'))
|
||||||
execute('e Xxx1')
|
feed_command('e Xxx1')
|
||||||
eq('Xxx1', eval('bufname("%")'))
|
eq('Xxx1', eval('bufname("%")'))
|
||||||
-- The legacy test file did not check the error message.
|
-- The legacy test file did not check the error message.
|
||||||
execute('let v:errmsg = "no error"')
|
feed_command('let v:errmsg = "no error"')
|
||||||
execute('write')
|
feed_command('write')
|
||||||
-- Discard all "hit enter" prompts and messages.
|
-- Discard all "hit enter" prompts and messages.
|
||||||
feed('<C-L>')
|
feed('<C-L>')
|
||||||
eq('E203: Autocommands deleted or unloaded buffer to be written',
|
eq('E203: Autocommands deleted or unloaded buffer to be written',
|
||||||
@@ -41,11 +41,11 @@ describe('autocommands that delete and unload buffers:', function()
|
|||||||
eq('Xxx2', eval('bufname("%")'))
|
eq('Xxx2', eval('bufname("%")'))
|
||||||
expect(text2)
|
expect(text2)
|
||||||
-- Start editing Xxx2.
|
-- Start editing Xxx2.
|
||||||
execute('e! Xxx2')
|
feed_command('e! Xxx2')
|
||||||
-- The legacy test file did not check the error message.
|
-- The legacy test file did not check the error message.
|
||||||
execute('let v:errmsg = "no error"')
|
feed_command('let v:errmsg = "no error"')
|
||||||
-- Write Xxx2, will delete the buffer and give an error msg.
|
-- Write Xxx2, will delete the buffer and give an error msg.
|
||||||
execute('w')
|
feed_command('w')
|
||||||
-- Discard all "hit enter" prompts and messages.
|
-- Discard all "hit enter" prompts and messages.
|
||||||
feed('<C-L>')
|
feed('<C-L>')
|
||||||
eq('E203: Autocommands deleted or unloaded buffer to be written',
|
eq('E203: Autocommands deleted or unloaded buffer to be written',
|
||||||
@@ -73,17 +73,17 @@ describe('autocommands that delete and unload buffers:', function()
|
|||||||
au BufUnload * call CloseAll()
|
au BufUnload * call CloseAll()
|
||||||
au VimLeave * call WriteToOut()
|
au VimLeave * call WriteToOut()
|
||||||
]])
|
]])
|
||||||
execute('e Xxx2')
|
feed_command('e Xxx2')
|
||||||
-- Discard all "hit enter" prompts and messages.
|
-- Discard all "hit enter" prompts and messages.
|
||||||
feed('<C-L>')
|
feed('<C-L>')
|
||||||
execute('e Xxx1')
|
feed_command('e Xxx1')
|
||||||
-- Discard all "hit enter" prompts and messages.
|
-- Discard all "hit enter" prompts and messages.
|
||||||
feed('<C-L>')
|
feed('<C-L>')
|
||||||
execute('e Makefile') -- an existing file
|
feed_command('e Makefile') -- an existing file
|
||||||
feed('<C-L>')
|
feed('<C-L>')
|
||||||
execute('sp new2')
|
feed_command('sp new2')
|
||||||
feed('<C-L>')
|
feed('<C-L>')
|
||||||
execute('q')
|
feed_command('q')
|
||||||
wait()
|
wait()
|
||||||
eq('VimLeave done',
|
eq('VimLeave done',
|
||||||
string.match(io.open('test.out', 'r'):read('*all'), "^%s*(.-)%s*$"))
|
string.match(io.open('test.out', 'r'):read('*all'), "^%s*(.-)%s*$"))
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
-- Test for Bufleave autocommand that deletes the buffer we are about to edit.
|
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
|
||||||
local clear, insert = helpers.clear, helpers.insert
|
|
||||||
local execute, expect = helpers.execute, helpers.expect
|
|
||||||
|
|
||||||
describe('BufLeave autocommand', function()
|
|
||||||
setup(clear)
|
|
||||||
|
|
||||||
it('is working', function()
|
|
||||||
insert([[
|
|
||||||
start of test file xx
|
|
||||||
end of test file xx]])
|
|
||||||
|
|
||||||
execute('au BufLeave * bwipe yy')
|
|
||||||
execute('e yy')
|
|
||||||
|
|
||||||
expect([[
|
|
||||||
start of test file xx
|
|
||||||
end of test file xx]])
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
@@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
local helpers= require('test.functional.helpers')(after_each)
|
local helpers= require('test.functional.helpers')(after_each)
|
||||||
local lfs = require('lfs')
|
local lfs = require('lfs')
|
||||||
local clear, execute, expect, eq, neq, dedent, write_file, feed =
|
local clear, feed_command, expect, eq, neq, dedent, write_file, feed =
|
||||||
helpers.clear, helpers.execute, 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
|
if helpers.pending_win32(pending) then return end
|
||||||
@@ -66,26 +66,26 @@ describe('file reading, writing and bufnew and filter autocommands', function()
|
|||||||
|
|
||||||
it('FileReadPost (using gzip)', function()
|
it('FileReadPost (using gzip)', function()
|
||||||
prepare_gz_file('Xtestfile', text1)
|
prepare_gz_file('Xtestfile', text1)
|
||||||
execute('let $GZIP = ""')
|
feed_command('let $GZIP = ""')
|
||||||
--execute('au FileChangedShell * echo "caught FileChangedShell"')
|
--execute('au FileChangedShell * echo "caught FileChangedShell"')
|
||||||
execute('set bin')
|
feed_command('set bin')
|
||||||
execute("au FileReadPost *.gz '[,']!gzip -d")
|
feed_command("au FileReadPost *.gz '[,']!gzip -d")
|
||||||
-- Read and decompress the testfile.
|
-- Read and decompress the testfile.
|
||||||
execute('$r Xtestfile.gz')
|
feed_command('$r Xtestfile.gz')
|
||||||
expect('\n'..text1)
|
expect('\n'..text1)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('BufReadPre, BufReadPost (using gzip)', function()
|
it('BufReadPre, BufReadPost (using gzip)', function()
|
||||||
prepare_gz_file('Xtestfile', text1)
|
prepare_gz_file('Xtestfile', text1)
|
||||||
local gzip_data = io.open('Xtestfile.gz'):read('*all')
|
local gzip_data = io.open('Xtestfile.gz'):read('*all')
|
||||||
execute('let $GZIP = ""')
|
feed_command('let $GZIP = ""')
|
||||||
-- Setup autocommands to decompress before reading and re-compress afterwards.
|
-- Setup autocommands to decompress before reading and re-compress afterwards.
|
||||||
execute("au BufReadPre *.gz exe '!gzip -d ' . shellescape(expand('<afile>'))")
|
feed_command("au BufReadPre *.gz exe '!gzip -d ' . shellescape(expand('<afile>'))")
|
||||||
execute("au BufReadPre *.gz call rename(expand('<afile>:r'), expand('<afile>'))")
|
feed_command("au BufReadPre *.gz call rename(expand('<afile>:r'), expand('<afile>'))")
|
||||||
execute("au BufReadPost *.gz call rename(expand('<afile>'), expand('<afile>:r'))")
|
feed_command("au BufReadPost *.gz call rename(expand('<afile>'), expand('<afile>:r'))")
|
||||||
execute("au BufReadPost *.gz exe '!gzip ' . shellescape(expand('<afile>:r'))")
|
feed_command("au BufReadPost *.gz exe '!gzip ' . shellescape(expand('<afile>:r'))")
|
||||||
-- Edit compressed file.
|
-- Edit compressed file.
|
||||||
execute('e! Xtestfile.gz')
|
feed_command('e! Xtestfile.gz')
|
||||||
-- Discard all prompts and messages.
|
-- Discard all prompts and messages.
|
||||||
feed('<C-L>')
|
feed('<C-L>')
|
||||||
-- Expect the decompressed file in the buffer.
|
-- Expect the decompressed file in the buffer.
|
||||||
@@ -96,11 +96,11 @@ describe('file reading, writing and bufnew and filter autocommands', function()
|
|||||||
|
|
||||||
it('FileReadPre, FileReadPost', function()
|
it('FileReadPre, FileReadPost', function()
|
||||||
prepare_gz_file('Xtestfile', text1)
|
prepare_gz_file('Xtestfile', text1)
|
||||||
execute('au! FileReadPre *.gz exe "silent !gzip -d " . shellescape(expand("<afile>"))')
|
feed_command('au! FileReadPre *.gz exe "silent !gzip -d " . shellescape(expand("<afile>"))')
|
||||||
execute('au FileReadPre *.gz call rename(expand("<afile>:r"), expand("<afile>"))')
|
feed_command('au FileReadPre *.gz call rename(expand("<afile>:r"), expand("<afile>"))')
|
||||||
execute("au! FileReadPost *.gz '[,']s/l/L/")
|
feed_command("au! FileReadPost *.gz '[,']s/l/L/")
|
||||||
-- Read compressed file.
|
-- Read compressed file.
|
||||||
execute('$r Xtestfile.gz')
|
feed_command('$r Xtestfile.gz')
|
||||||
-- Discard all prompts and messages.
|
-- Discard all prompts and messages.
|
||||||
feed('<C-L>')
|
feed('<C-L>')
|
||||||
expect([[
|
expect([[
|
||||||
@@ -121,17 +121,17 @@ describe('file reading, writing and bufnew and filter autocommands', function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
it('FileAppendPre, FileAppendPost', function()
|
it('FileAppendPre, FileAppendPost', function()
|
||||||
execute('au BufNewFile *.c read Xtest.c')
|
feed_command('au BufNewFile *.c read Xtest.c')
|
||||||
-- Will load Xtest.c.
|
-- Will load Xtest.c.
|
||||||
execute('e! foo.c')
|
feed_command('e! foo.c')
|
||||||
execute("au FileAppendPre *.out '[,']s/new/NEW/")
|
feed_command("au FileAppendPre *.out '[,']s/new/NEW/")
|
||||||
execute('au FileAppendPost *.out !cat Xtest.c >>test.out')
|
feed_command('au FileAppendPost *.out !cat Xtest.c >>test.out')
|
||||||
-- Append it to the output file.
|
-- Append it to the output file.
|
||||||
execute('w>>test.out')
|
feed_command('w>>test.out')
|
||||||
-- Discard all prompts and messages.
|
-- Discard all prompts and messages.
|
||||||
feed('<C-L>')
|
feed('<C-L>')
|
||||||
-- Expect the decompressed file in the buffer.
|
-- Expect the decompressed file in the buffer.
|
||||||
execute('e test.out')
|
feed_command('e test.out')
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -166,18 +166,18 @@ describe('file reading, writing and bufnew and filter autocommands', function()
|
|||||||
* Here is a new .c file
|
* Here is a new .c file
|
||||||
*/]]))
|
*/]]))
|
||||||
-- Need temp files here.
|
-- Need temp files here.
|
||||||
execute('set shelltemp')
|
feed_command('set shelltemp')
|
||||||
execute('au FilterReadPre *.out call rename(expand("<afile>"), expand("<afile>") . ".t")')
|
feed_command('au FilterReadPre *.out call rename(expand("<afile>"), expand("<afile>") . ".t")')
|
||||||
execute('au FilterReadPre *.out exe "silent !sed s/e/E/ " . shellescape(expand("<afile>")) . ".t >" . shellescape(expand("<afile>"))')
|
feed_command('au FilterReadPre *.out exe "silent !sed s/e/E/ " . shellescape(expand("<afile>")) . ".t >" . shellescape(expand("<afile>"))')
|
||||||
execute('au FilterReadPre *.out exe "silent !rm " . shellescape(expand("<afile>")) . ".t"')
|
feed_command('au FilterReadPre *.out exe "silent !rm " . shellescape(expand("<afile>")) . ".t"')
|
||||||
execute("au FilterReadPost *.out '[,']s/x/X/g")
|
feed_command("au FilterReadPost *.out '[,']s/x/X/g")
|
||||||
-- Edit the output file.
|
-- Edit the output file.
|
||||||
execute('e! test.out')
|
feed_command('e! test.out')
|
||||||
execute('23,$!cat')
|
feed_command('23,$!cat')
|
||||||
-- Discard all prompts and messages.
|
-- Discard all prompts and messages.
|
||||||
feed('<C-L>')
|
feed('<C-L>')
|
||||||
-- Remove CR for when sed adds them.
|
-- Remove CR for when sed adds them.
|
||||||
execute([[23,$s/\r$//]])
|
feed_command([[23,$s/\r$//]])
|
||||||
expect([[
|
expect([[
|
||||||
startstart
|
startstart
|
||||||
start of testfile
|
start of testfile
|
||||||
|
|||||||
@@ -3,12 +3,19 @@
|
|||||||
-- - "./dir", in directory relative to file
|
-- - "./dir", in directory relative to file
|
||||||
-- - "dir", in directory relative to current dir
|
-- - "dir", in directory relative to current dir
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local lfs = require('lfs')
|
local lfs = require('lfs')
|
||||||
local insert, eq = helpers.insert, helpers.eq
|
|
||||||
local neq, eval = helpers.neq, helpers.eval
|
local eq = helpers.eq
|
||||||
local clear, execute = helpers.clear, helpers.execute
|
local neq = helpers.neq
|
||||||
local wait, write_file = helpers.wait, helpers.write_file
|
local wait = helpers.wait
|
||||||
|
local funcs = helpers.funcs
|
||||||
|
local meths = helpers.meths
|
||||||
|
local clear = helpers.clear
|
||||||
|
local insert = helpers.insert
|
||||||
|
local command = helpers.command
|
||||||
|
local write_file = helpers.write_file
|
||||||
|
local curbufmeths = helpers.curbufmeths
|
||||||
|
|
||||||
local function ls_dir_sorted(dirname)
|
local function ls_dir_sorted(dirname)
|
||||||
local files = {}
|
local files = {}
|
||||||
@@ -36,7 +43,7 @@ describe("'directory' option", function()
|
|||||||
clear()
|
clear()
|
||||||
end)
|
end)
|
||||||
teardown(function()
|
teardown(function()
|
||||||
execute('qall!')
|
command('qall!')
|
||||||
helpers.rmdir('Xtest.je')
|
helpers.rmdir('Xtest.je')
|
||||||
helpers.rmdir('Xtest2')
|
helpers.rmdir('Xtest2')
|
||||||
os.remove('Xtest1')
|
os.remove('Xtest1')
|
||||||
@@ -49,21 +56,22 @@ describe("'directory' option", function()
|
|||||||
line 3 Abcdefghij
|
line 3 Abcdefghij
|
||||||
end of testfile]])
|
end of testfile]])
|
||||||
|
|
||||||
execute('set swapfile')
|
meths.set_option('swapfile', true)
|
||||||
execute('set dir=.,~')
|
curbufmeths.set_option('swapfile', true)
|
||||||
|
meths.set_option('directory', '.')
|
||||||
|
|
||||||
-- sanity check: files should not exist yet.
|
-- sanity check: files should not exist yet.
|
||||||
eq(nil, lfs.attributes('.Xtest1.swp'))
|
eq(nil, lfs.attributes('.Xtest1.swp'))
|
||||||
|
|
||||||
execute('e! Xtest1')
|
command('edit! Xtest1')
|
||||||
wait()
|
wait()
|
||||||
eq('Xtest1', eval('buffer_name("%")'))
|
eq('Xtest1', funcs.buffer_name('%'))
|
||||||
-- Verify that the swapfile exists. In the legacy test this was done by
|
-- Verify that the swapfile exists. In the legacy test this was done by
|
||||||
-- reading the output from :!ls.
|
-- reading the output from :!ls.
|
||||||
neq(nil, lfs.attributes('.Xtest1.swp'))
|
neq(nil, lfs.attributes('.Xtest1.swp'))
|
||||||
|
|
||||||
execute('set dir=./Xtest2,.,~')
|
meths.set_option('directory', './Xtest2,.')
|
||||||
execute('e Xtest1')
|
command('edit Xtest1')
|
||||||
wait()
|
wait()
|
||||||
|
|
||||||
-- swapfile should no longer exist in CWD.
|
-- swapfile should no longer exist in CWD.
|
||||||
@@ -71,9 +79,9 @@ describe("'directory' option", function()
|
|||||||
|
|
||||||
eq({ "Xtest1.swp", "Xtest3" }, ls_dir_sorted("Xtest2"))
|
eq({ "Xtest1.swp", "Xtest3" }, ls_dir_sorted("Xtest2"))
|
||||||
|
|
||||||
execute('set dir=Xtest.je,~')
|
meths.set_option('directory', 'Xtest.je')
|
||||||
execute('e Xtest2/Xtest3')
|
command('edit Xtest2/Xtest3')
|
||||||
eq(1, eval('&swapfile'))
|
eq(true, curbufmeths.get_option('swapfile'))
|
||||||
wait()
|
wait()
|
||||||
|
|
||||||
eq({ "Xtest3" }, ls_dir_sorted("Xtest2"))
|
eq({ "Xtest3" }, ls_dir_sorted("Xtest2"))
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, insert = helpers.feed, helpers.insert
|
local feed, insert = helpers.feed, helpers.insert
|
||||||
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe('alignment', function()
|
describe('alignment', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -19,7 +19,7 @@ describe('alignment', function()
|
|||||||
asdfa a
|
asdfa a
|
||||||
xasdfa a
|
xasdfa a
|
||||||
asxxdfa a
|
asxxdfa a
|
||||||
|
|
||||||
test for :center
|
test for :center
|
||||||
a a
|
a a
|
||||||
fa afd asdf
|
fa afd asdf
|
||||||
@@ -28,7 +28,7 @@ describe('alignment', function()
|
|||||||
asdfa a
|
asdfa a
|
||||||
xasdfa asdfasdfasdfasdfasdf
|
xasdfa asdfasdfasdfasdfasdf
|
||||||
asxxdfa a
|
asxxdfa a
|
||||||
|
|
||||||
test for :right
|
test for :right
|
||||||
a a
|
a a
|
||||||
fa a
|
fa a
|
||||||
@@ -111,34 +111,34 @@ describe('alignment', function()
|
|||||||
asxxdfa axxxoikey
|
asxxdfa axxxoikey
|
||||||
asxa;ofa axxxoikey
|
asxa;ofa axxxoikey
|
||||||
asdfaqwer axxxoikey
|
asdfaqwer axxxoikey
|
||||||
|
|
||||||
xxxxx xx xxxxxx
|
xxxxx xx xxxxxx
|
||||||
xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx
|
xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx
|
||||||
xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx
|
xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx
|
||||||
xx xxxxxxx. xxxx xxxx.
|
xx xxxxxxx. xxxx xxxx.
|
||||||
|
|
||||||
> xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx
|
> xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx
|
||||||
> xxxxxx xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx
|
> xxxxxx xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx
|
||||||
|
|
||||||
aa aa aa aa
|
aa aa aa aa
|
||||||
bb bb bb bb
|
bb bb bb bb
|
||||||
cc cc cc cc]])
|
cc cc cc cc]])
|
||||||
|
|
||||||
execute('set tw=65')
|
feed_command('set tw=65')
|
||||||
|
|
||||||
feed([[:/^\s*test for :left/,/^\s*test for :center/ left<cr>]])
|
feed([[:/^\s*test for :left/,/^\s*test for :center/ left<cr>]])
|
||||||
feed([[:/^\s*test for :center/,/^\s*test for :right/ center<cr>]])
|
feed([[:/^\s*test for :center/,/^\s*test for :right/ center<cr>]])
|
||||||
feed([[:/^\s*test for :right/,/^xxx/-1 right<cr>]])
|
feed([[:/^\s*test for :right/,/^xxx/-1 right<cr>]])
|
||||||
|
|
||||||
execute('set fo+=tcroql tw=72')
|
feed_command('set fo+=tcroql tw=72')
|
||||||
|
|
||||||
feed('/xxxxxxxx$<cr>')
|
feed('/xxxxxxxx$<cr>')
|
||||||
feed('0gq6kk<cr>')
|
feed('0gq6kk<cr>')
|
||||||
|
|
||||||
-- Undo/redo here to make the next undo only work on the following changes.
|
-- Undo/redo here to make the next undo only work on the following changes.
|
||||||
feed('u<cr>')
|
feed('u<cr>')
|
||||||
execute('map gg :.,.+2s/^/x/<CR>kk:set tw=3<CR>gqq')
|
feed_command('map gg :.,.+2s/^/x/<CR>kk:set tw=3<CR>gqq')
|
||||||
execute('/^aa')
|
feed_command('/^aa')
|
||||||
feed('ggu<cr>')
|
feed('ggu<cr>')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
@@ -151,7 +151,7 @@ describe('alignment', function()
|
|||||||
asdfa a
|
asdfa a
|
||||||
xasdfa a
|
xasdfa a
|
||||||
asxxdfa a
|
asxxdfa a
|
||||||
|
|
||||||
test for :center
|
test for :center
|
||||||
a a
|
a a
|
||||||
fa afd asdf
|
fa afd asdf
|
||||||
@@ -160,7 +160,7 @@ describe('alignment', function()
|
|||||||
asdfa a
|
asdfa a
|
||||||
xasdfa asdfasdfasdfasdfasdf
|
xasdfa asdfasdfasdfasdfasdf
|
||||||
asxxdfa a
|
asxxdfa a
|
||||||
|
|
||||||
test for :right
|
test for :right
|
||||||
a a
|
a a
|
||||||
fa a
|
fa a
|
||||||
@@ -243,14 +243,14 @@ describe('alignment', function()
|
|||||||
asxxdfa axxxoikey
|
asxxdfa axxxoikey
|
||||||
asxa;ofa axxxoikey
|
asxa;ofa axxxoikey
|
||||||
asdfaqwer axxxoikey
|
asdfaqwer axxxoikey
|
||||||
|
|
||||||
xxxxx xx xxxxxx xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx
|
xxxxx xx xxxxxx xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx
|
||||||
xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx xx xxxxxxx.
|
xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx xx xxxxxxx.
|
||||||
xxxx xxxx.
|
xxxx xxxx.
|
||||||
|
|
||||||
> xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx xxxxxx
|
> xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx xxxxxx
|
||||||
> xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx
|
> xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx
|
||||||
|
|
||||||
aa aa aa aa
|
aa aa aa aa
|
||||||
bb bb bb bb
|
bb bb bb bb
|
||||||
cc cc cc cc]])
|
cc cc cc cc]])
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
-- Tests for not doing smart indenting when it isn't set.
|
-- Tests for not doing smart indenting when it isn't set.
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
|
|
||||||
local execute, expect = helpers.execute, helpers.expect
|
local feed = helpers.feed
|
||||||
|
local clear = helpers.clear
|
||||||
|
local insert = helpers.insert
|
||||||
|
local expect = helpers.expect
|
||||||
|
local feed_command = helpers.feed_command
|
||||||
|
|
||||||
describe('unset smart indenting', function()
|
describe('unset smart indenting', function()
|
||||||
setup(clear)
|
before_each(clear)
|
||||||
|
|
||||||
it('is working', function()
|
it('is working', function()
|
||||||
insert([[
|
insert([[
|
||||||
@@ -15,8 +19,8 @@ describe('unset smart indenting', function()
|
|||||||
test text
|
test text
|
||||||
test text]])
|
test text]])
|
||||||
|
|
||||||
execute('set nocin nosi ai')
|
feed_command('set nocin nosi ai')
|
||||||
execute('/some')
|
feed_command('/some')
|
||||||
feed('2cc#test<Esc>')
|
feed('2cc#test<Esc>')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, insert = helpers.feed, helpers.insert
|
local feed, insert = helpers.feed, helpers.insert
|
||||||
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe([[performing "r<Tab>" with 'smarttab' and 'expandtab' set/not set, and "dv_"]], function()
|
describe([[performing "r<Tab>" with 'smarttab' and 'expandtab' set/not set, and "dv_"]], function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -19,24 +19,24 @@ describe([[performing "r<Tab>" with 'smarttab' and 'expandtab' set/not set, and
|
|||||||
test text
|
test text
|
||||||
Second line beginning with whitespace]])
|
Second line beginning with whitespace]])
|
||||||
|
|
||||||
execute('set smarttab expandtab ts=8 sw=4')
|
feed_command('set smarttab expandtab ts=8 sw=4')
|
||||||
-- Make sure that backspace works, no matter what termcap is used.
|
-- Make sure that backspace works, no matter what termcap is used.
|
||||||
execute('set t_kD=x7f t_kb=x08')
|
feed_command('set t_kD=x7f t_kb=x08')
|
||||||
|
|
||||||
execute('/some')
|
feed_command('/some')
|
||||||
feed('r ')
|
feed('r ')
|
||||||
execute('set noexpandtab')
|
feed_command('set noexpandtab')
|
||||||
execute('/other')
|
feed_command('/other')
|
||||||
feed('r <cr>')
|
feed('r <cr>')
|
||||||
-- Test replacing with Tabs and then backspacing to undo it.
|
-- Test replacing with Tabs and then backspacing to undo it.
|
||||||
feed('0wR <bs><bs><bs><esc><cr>')
|
feed('0wR <bs><bs><bs><esc><cr>')
|
||||||
-- Test replacing with Tabs.
|
-- Test replacing with Tabs.
|
||||||
feed('0wR <esc><cr>')
|
feed('0wR <esc><cr>')
|
||||||
-- Test that copyindent works with expandtab set.
|
-- Test that copyindent works with expandtab set.
|
||||||
execute('set expandtab smartindent copyindent ts=8 sw=8 sts=8')
|
feed_command('set expandtab smartindent copyindent ts=8 sw=8 sts=8')
|
||||||
feed('o{<cr>x<esc>')
|
feed('o{<cr>x<esc>')
|
||||||
execute('set nosol')
|
feed_command('set nosol')
|
||||||
execute('/Second line/')
|
feed_command('/Second line/')
|
||||||
-- Test "dv_"
|
-- Test "dv_"
|
||||||
feed('fwdv_')
|
feed('fwdv_')
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
-- vim: set foldmethod=marker foldmarker=[[,]] :
|
|
||||||
-- Tests Blockwise Visual when there are TABs before the text.
|
-- Tests Blockwise Visual when there are TABs before the text.
|
||||||
-- First test for undo working properly when executing commands from a register.
|
-- First test for undo working properly when executing commands from a register.
|
||||||
-- Also test this in an empty buffer.
|
-- Also test this in an empty buffer.
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
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 execute, expect = helpers.execute, helpers.expect
|
local feed_command, expect = helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe('blockwise visual', function()
|
describe('blockwise visual', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -26,15 +25,15 @@ Ox jAy kdd]])
|
|||||||
|
|
||||||
feed(":let @a = 'Ox<C-v><Esc>jAy<C-v><Esc>kdd'<cr>")
|
feed(":let @a = 'Ox<C-v><Esc>jAy<C-v><Esc>kdd'<cr>")
|
||||||
feed('G0k@au')
|
feed('G0k@au')
|
||||||
execute('new')
|
feed_command('new')
|
||||||
feed('@auY')
|
feed('@auY')
|
||||||
execute('quit')
|
feed_command('quit')
|
||||||
feed('GP')
|
feed('GP')
|
||||||
execute('/start here')
|
feed_command('/start here')
|
||||||
feed('"by$<C-v>jjlld')
|
feed('"by$<C-v>jjlld')
|
||||||
execute('/456')
|
feed_command('/456')
|
||||||
feed('<C-v>jj"bP')
|
feed('<C-v>jj"bP')
|
||||||
execute('$-3,$d')
|
feed_command('$-3,$d')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
123start here56
|
123start here56
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
-- vim: set foldmethod=marker foldmarker=[[,]] :
|
|
||||||
-- Tests for [ CTRL-I with a count and CTRL-W CTRL-I with a count
|
-- Tests for [ CTRL-I with a count and CTRL-W CTRL-I with a count
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
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 execute, expect = helpers.execute, helpers.expect
|
local feed_command, expect = helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe('CTRL-W CTRL-I', function()
|
describe('CTRL-W CTRL-I', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -20,18 +19,18 @@ describe('CTRL-W CTRL-I', function()
|
|||||||
test text]])
|
test text]])
|
||||||
|
|
||||||
-- Search for the second occurence of start and append to register
|
-- Search for the second occurence of start and append to register
|
||||||
execute('/start')
|
feed_command('/start')
|
||||||
feed('2[<C-i>')
|
feed('2[<C-i>')
|
||||||
execute('yank A')
|
feed_command('yank A')
|
||||||
|
|
||||||
-- Same as above but using different keystrokes.
|
-- Same as above but using different keystrokes.
|
||||||
feed('?start<cr>')
|
feed('?start<cr>')
|
||||||
feed('2<C-w><Tab>')
|
feed('2<C-w><Tab>')
|
||||||
execute('yank A')
|
feed_command('yank A')
|
||||||
|
|
||||||
-- Clean buffer and put register
|
-- Clean buffer and put register
|
||||||
feed('ggdG"ap')
|
feed('ggdG"ap')
|
||||||
execute('1d')
|
feed_command('1d')
|
||||||
|
|
||||||
-- The buffer should now contain:
|
-- The buffer should now contain:
|
||||||
expect([[
|
expect([[
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear, feed = helpers.clear, helpers.feed
|
local clear, feed = helpers.clear, helpers.feed
|
||||||
local execute, expect = helpers.execute, helpers.expect
|
local feed_command, expect = helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe('line ending', function()
|
describe('line ending', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -14,8 +14,8 @@ describe('line ending', function()
|
|||||||
this one does<C-V><C-M>
|
this one does<C-V><C-M>
|
||||||
and the last one doesn't]], '<ESC>')
|
and the last one doesn't]], '<ESC>')
|
||||||
|
|
||||||
execute('set ta tx')
|
feed_command('set ta tx')
|
||||||
execute('e!')
|
feed_command('e!')
|
||||||
|
|
||||||
expect("this lines ends in a\r\n"..
|
expect("this lines ends in a\r\n"..
|
||||||
"this one doesn't\n"..
|
"this one doesn't\n"..
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear, insert = helpers.clear, helpers.insert
|
local clear, insert = helpers.clear, helpers.insert
|
||||||
local execute, expect = helpers.execute, helpers.expect
|
local command, expect = helpers.command, helpers.expect
|
||||||
|
local wait = helpers.wait
|
||||||
|
|
||||||
describe(':edit', function()
|
describe(':edit', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -12,31 +13,32 @@ describe(':edit', function()
|
|||||||
The result should be in Xfile1: "fooPIPEbar", in Xfile2: "fooSLASHbar"
|
The result should be in Xfile1: "fooPIPEbar", in Xfile2: "fooSLASHbar"
|
||||||
foo|bar
|
foo|bar
|
||||||
foo/bar]])
|
foo/bar]])
|
||||||
|
wait()
|
||||||
|
|
||||||
-- Prepare some test files
|
-- Prepare some test files
|
||||||
execute('$-1w! Xfile1')
|
command('$-1w! Xfile1')
|
||||||
execute('$w! Xfile2')
|
command('$w! Xfile2')
|
||||||
execute('w! Xfile0')
|
command('w! Xfile0')
|
||||||
|
|
||||||
-- Open Xfile using '+' range
|
-- Open Xfile using '+' range
|
||||||
execute('edit +1 Xfile1')
|
command('edit +1 Xfile1')
|
||||||
execute('s/|/PIPE/')
|
command('s/|/PIPE/')
|
||||||
execute('yank A')
|
command('yank A')
|
||||||
execute('w! Xfile1')
|
command('w! Xfile1')
|
||||||
|
|
||||||
-- Open Xfile2 using '|' range
|
-- Open Xfile2 using '|' range
|
||||||
execute('edit Xfile2|1')
|
command('edit Xfile2|1')
|
||||||
execute("s/\\//SLASH/")
|
command("s/\\//SLASH/")
|
||||||
execute('yank A')
|
command('yank A')
|
||||||
execute('w! Xfile2')
|
command('w! Xfile2')
|
||||||
|
|
||||||
-- Clean first buffer and put @a
|
-- Clean first buffer and put @a
|
||||||
execute('bf')
|
command('bf')
|
||||||
execute('%d')
|
command('%d')
|
||||||
execute('0put a')
|
command('0put a')
|
||||||
|
|
||||||
-- Remove empty line
|
-- Remove empty line
|
||||||
execute('$d')
|
command('$d')
|
||||||
|
|
||||||
-- The buffer should now contain
|
-- The buffer should now contain
|
||||||
expect([[
|
expect([[
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
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 execute, expect = helpers.execute, helpers.expect
|
local feed_command, expect = helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
if helpers.pending_win32(pending) then return end
|
if helpers.pending_win32(pending) then return end
|
||||||
|
|
||||||
@@ -21,30 +21,30 @@ describe('jump to a tag with hidden set', function()
|
|||||||
|
|
||||||
SECTION_OFF]])
|
SECTION_OFF]])
|
||||||
|
|
||||||
execute('w! Xxx')
|
feed_command('w! Xxx')
|
||||||
execute('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.
|
||||||
execute('!rm -f test25.dir')
|
feed_command('!rm -f test25.dir')
|
||||||
execute('!ln -s . test25.dir')
|
feed_command('!ln -s . test25.dir')
|
||||||
|
|
||||||
-- Create tags.text, with the current directory name inserted.
|
-- Create tags.text, with the current directory name inserted.
|
||||||
execute('/tags line')
|
feed_command('/tags line')
|
||||||
execute('r !pwd')
|
feed_command('r !pwd')
|
||||||
feed('d$/test<cr>')
|
feed('d$/test<cr>')
|
||||||
feed('hP:.w! tags.test<cr>')
|
feed('hP:.w! tags.test<cr>')
|
||||||
|
|
||||||
-- Try jumping to a tag in the current file, but with a path that contains a
|
-- Try jumping to a tag in the current file, but with a path that contains a
|
||||||
-- symbolic link. When wrong, this will give the ATTENTION message. The next
|
-- symbolic link. When wrong, this will give the ATTENTION message. The next
|
||||||
-- 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'.
|
||||||
execute('set tags=tags.test')
|
feed_command('set tags=tags.test')
|
||||||
feed('G<C-]> x:yank a<cr>')
|
feed('G<C-]> x:yank a<cr>')
|
||||||
execute('!rm -f Xxx test25.dir tags.test')
|
feed_command('!rm -f Xxx test25.dir tags.test')
|
||||||
|
|
||||||
-- Put @a and remove empty line
|
-- Put @a and remove empty line
|
||||||
execute('%d')
|
feed_command('%d')
|
||||||
execute('0put a')
|
feed_command('0put a')
|
||||||
execute('$d')
|
feed_command('$d')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect("#efine SECTION_OFF 3")
|
expect("#efine SECTION_OFF 3")
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
-- Test for :execute, :while and :if
|
-- Test for :execute, :while and :if
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local execute, expect = helpers.execute, helpers.expect
|
local expect = helpers.expect
|
||||||
local source = helpers.source
|
local source = helpers.source
|
||||||
|
local command = helpers.command
|
||||||
|
|
||||||
describe(':execute, :while and :if', function()
|
describe(':execute, :while and :if', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -37,7 +39,7 @@ describe(':execute, :while and :if', function()
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
-- Remove empty line
|
-- Remove empty line
|
||||||
execute('1d')
|
command('1d')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([[
|
expect([[
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
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 execute, expect = helpers.execute, helpers.expect
|
local feed_command, expect = helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe('CTRL-V at the end of the line', function()
|
describe('CTRL-V at the end of the line', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -24,8 +24,8 @@ describe('CTRL-V at the end of the line', function()
|
|||||||
|
|
||||||
feed(':%s/X/<C-v><C-v>/g<cr>')
|
feed(':%s/X/<C-v><C-v>/g<cr>')
|
||||||
feed(':/firstline/+1,/lastline/-1w! Xtestfile<cr>')
|
feed(':/firstline/+1,/lastline/-1w! Xtestfile<cr>')
|
||||||
execute('so Xtestfile')
|
feed_command('so Xtestfile')
|
||||||
execute('%d')
|
feed_command('%d')
|
||||||
feed('Gmm__1<Esc><Esc>__2<Esc>__3<Esc><Esc>__4<Esc>__5<Esc>')
|
feed('Gmm__1<Esc><Esc>__2<Esc>__3<Esc><Esc>__4<Esc>__5<Esc>')
|
||||||
feed(":'m,$s/<C-v><C-@>/0/g<cr>")
|
feed(":'m,$s/<C-v><C-@>/0/g<cr>")
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
-- Test for joining lines with marks in them (and with 'joinspaces' set/reset)
|
-- Test for joining lines with marks in them (and with 'joinspaces' set/reset)
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, insert = helpers.feed, helpers.insert
|
|
||||||
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
local feed = helpers.feed
|
||||||
|
local clear = helpers.clear
|
||||||
|
local insert = helpers.insert
|
||||||
|
local expect = helpers.expect
|
||||||
|
local feed_command = helpers.feed_command
|
||||||
|
|
||||||
describe('joining lines', function()
|
describe('joining lines', function()
|
||||||
before_each(clear)
|
before_each(clear)
|
||||||
@@ -46,19 +50,19 @@ describe('joining lines', function()
|
|||||||
|
|
||||||
-- Switch off 'joinspaces', then join some lines in the buffer using "J".
|
-- Switch off 'joinspaces', then join some lines in the buffer using "J".
|
||||||
-- Also set a few marks and record their movement when joining lines.
|
-- Also set a few marks and record their movement when joining lines.
|
||||||
execute('set nojoinspaces')
|
feed_command('set nojoinspaces')
|
||||||
execute('/firstline/')
|
feed_command('/firstline/')
|
||||||
feed('j"td/^$/<cr>')
|
feed('j"td/^$/<cr>')
|
||||||
feed('PJjJjJjJjJjJjJjJjJjJjJjJjJjJ')
|
feed('PJjJjJjJjJjJjJjJjJjJjJjJjJjJ')
|
||||||
feed('j05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p')
|
feed('j05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p')
|
||||||
|
|
||||||
-- Do the same with 'joinspaces' on.
|
-- Do the same with 'joinspaces' on.
|
||||||
execute('set joinspaces')
|
feed_command('set joinspaces')
|
||||||
feed('j"tp')
|
feed('j"tp')
|
||||||
feed('JjJjJjJjJjJjJjJjJjJjJjJjJjJ')
|
feed('JjJjJjJjJjJjJjJjJjJjJjJjJjJ')
|
||||||
feed('j05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$po<esc>')
|
feed('j05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$po<esc>')
|
||||||
|
|
||||||
execute('1d')
|
feed_command('1d')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
@@ -129,20 +133,20 @@ describe('joining lines', function()
|
|||||||
}
|
}
|
||||||
]])
|
]])
|
||||||
|
|
||||||
execute('/^{/+1')
|
feed_command('/^{/+1')
|
||||||
execute('set comments=s1:/*,mb:*,ex:*/,://')
|
feed_command('set comments=s1:/*,mb:*,ex:*/,://')
|
||||||
execute('set nojoinspaces')
|
feed_command('set nojoinspaces')
|
||||||
execute('set backspace=eol,start')
|
feed_command('set backspace=eol,start')
|
||||||
|
|
||||||
-- With 'joinspaces' switched off, join lines using both "J" and :join and
|
-- With 'joinspaces' switched off, join lines using both "J" and :join and
|
||||||
-- verify that comment leaders are stripped or kept as appropriate.
|
-- verify that comment leaders are stripped or kept as appropriate.
|
||||||
execute('.,+3join')
|
feed_command('.,+3join')
|
||||||
feed('j4J<cr>')
|
feed('j4J<cr>')
|
||||||
execute('.,+2join')
|
feed_command('.,+2join')
|
||||||
feed('j3J<cr>')
|
feed('j3J<cr>')
|
||||||
execute('.,+2join')
|
feed_command('.,+2join')
|
||||||
feed('j3J<cr>')
|
feed('j3J<cr>')
|
||||||
execute('.,+2join')
|
feed_command('.,+2join')
|
||||||
feed('jj3J<cr>')
|
feed('jj3J<cr>')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
@@ -180,22 +184,22 @@ describe('joining lines', function()
|
|||||||
|
|
||||||
-- As mentioned above, we mimic the wrong initial cursor position in the old
|
-- As mentioned above, we mimic the wrong initial cursor position in the old
|
||||||
-- test by advancing one line further.
|
-- test by advancing one line further.
|
||||||
execute([[/^\d\+ this]], '+1')
|
feed_command([[/^\d\+ this]], '+1')
|
||||||
|
|
||||||
-- Test with the default 'backspace' setting.
|
-- Test with the default 'backspace' setting.
|
||||||
feed('Avim1<c-u><esc><cr>')
|
feed('Avim1<c-u><esc><cr>')
|
||||||
feed('Avim2<c-g>u<c-u><esc><cr>')
|
feed('Avim2<c-g>u<c-u><esc><cr>')
|
||||||
execute('set cpo-=<')
|
feed_command('set cpo-=<')
|
||||||
execute('inoremap <c-u> <left><c-u>')
|
feed_command('inoremap <c-u> <left><c-u>')
|
||||||
feed('Avim3<c-u><esc><cr>')
|
feed('Avim3<c-u><esc><cr>')
|
||||||
execute('iunmap <c-u>')
|
feed_command('iunmap <c-u>')
|
||||||
feed('Avim4<c-u><c-u><esc><cr>')
|
feed('Avim4<c-u><c-u><esc><cr>')
|
||||||
|
|
||||||
-- Test with 'backspace' set to the compatible setting.
|
-- Test with 'backspace' set to the compatible setting.
|
||||||
execute('set backspace=')
|
feed_command('set backspace=')
|
||||||
feed('A vim5<esc>A<c-u><c-u><esc><cr>')
|
feed('A vim5<esc>A<c-u><c-u><esc><cr>')
|
||||||
feed('A vim6<esc>Azwei<c-g>u<c-u><esc><cr>')
|
feed('A vim6<esc>Azwei<c-g>u<c-u><esc><cr>')
|
||||||
execute('inoremap <c-u> <left><c-u>')
|
feed_command('inoremap <c-u> <left><c-u>')
|
||||||
feed('A vim7<c-u><c-u><esc><cr>')
|
feed('A vim7<c-u><c-u><esc><cr>')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
@@ -283,29 +287,29 @@ describe('joining lines', function()
|
|||||||
}
|
}
|
||||||
]])
|
]])
|
||||||
|
|
||||||
execute('/^{/+1')
|
feed_command('/^{/+1')
|
||||||
execute([[set comments=sO:*\ -,mO:*\ \ ,exO:*/]])
|
feed_command([[set comments=sO:*\ -,mO:*\ \ ,exO:*/]])
|
||||||
execute('set comments+=s1:/*,mb:*,ex:*/,://')
|
feed_command('set comments+=s1:/*,mb:*,ex:*/,://')
|
||||||
execute('set comments+=s1:>#,mb:#,ex:#<,:<')
|
feed_command('set comments+=s1:>#,mb:#,ex:#<,:<')
|
||||||
execute('set backspace=eol,start')
|
feed_command('set backspace=eol,start')
|
||||||
|
|
||||||
-- With 'joinspaces' on (the default setting), again join lines and verify
|
-- With 'joinspaces' on (the default setting), again join lines and verify
|
||||||
-- that comment leaders are stripped or kept as appropriate.
|
-- that comment leaders are stripped or kept as appropriate.
|
||||||
execute('.,+3join')
|
feed_command('.,+3join')
|
||||||
feed('j4J<cr>')
|
feed('j4J<cr>')
|
||||||
execute('.,+8join')
|
feed_command('.,+8join')
|
||||||
feed('j9J<cr>')
|
feed('j9J<cr>')
|
||||||
execute('.,+2join')
|
feed_command('.,+2join')
|
||||||
feed('j3J<cr>')
|
feed('j3J<cr>')
|
||||||
execute('.,+2join')
|
feed_command('.,+2join')
|
||||||
feed('j3J<cr>')
|
feed('j3J<cr>')
|
||||||
execute('.,+2join')
|
feed_command('.,+2join')
|
||||||
feed('jj3J<cr>')
|
feed('jj3J<cr>')
|
||||||
feed('j')
|
feed('j')
|
||||||
execute('.,+2join')
|
feed_command('.,+2join')
|
||||||
feed('jj3J<cr>')
|
feed('jj3J<cr>')
|
||||||
feed('j')
|
feed('j')
|
||||||
execute('.,+5join')
|
feed_command('.,+5join')
|
||||||
feed('j6J<cr>')
|
feed('j6J<cr>')
|
||||||
feed('oSome code!<cr>// Make sure backspacing does not remove this comment leader.<esc>0i<bs><esc>')
|
feed('oSome code!<cr>// Make sure backspacing does not remove this comment leader.<esc>0i<bs><esc>')
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
-- Test for a lot of variations of the 'fileformats' option
|
-- Test for a lot of variations of the 'fileformats' option
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, clear, execute = helpers.feed, helpers.clear, helpers.execute
|
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
|
||||||
|
|
||||||
if helpers.pending_win32(pending) then return end
|
if helpers.pending_win32(pending) then return end
|
||||||
|
|
||||||
@@ -45,198 +46,214 @@ describe('fileformats option', function()
|
|||||||
it('is working', function()
|
it('is working', function()
|
||||||
|
|
||||||
-- Try reading and writing with 'fileformats' empty.
|
-- Try reading and writing with 'fileformats' empty.
|
||||||
execute('set fileformats=')
|
command('set fileformats=')
|
||||||
execute('set fileformat=unix')
|
command('set fileformat=unix')
|
||||||
execute('e! XXUnix')
|
command('e! XXUnix')
|
||||||
execute('w! test.out')
|
command('w! test.out')
|
||||||
execute('e! XXDos')
|
command('e! XXDos')
|
||||||
execute('w! XXtt01')
|
command('w! XXtt01')
|
||||||
execute('e! XXMac')
|
command('e! XXMac')
|
||||||
execute('w! XXtt02')
|
command('w! XXtt02')
|
||||||
execute('bwipe XXUnix XXDos XXMac')
|
command('bwipe XXUnix XXDos XXMac')
|
||||||
execute('set fileformat=dos')
|
command('set fileformat=dos')
|
||||||
execute('e! XXUnix')
|
command('e! XXUnix')
|
||||||
execute('w! XXtt11')
|
command('w! XXtt11')
|
||||||
execute('e! XXDos')
|
command('e! XXDos')
|
||||||
execute('w! XXtt12')
|
command('w! XXtt12')
|
||||||
execute('e! XXMac')
|
command('e! XXMac')
|
||||||
execute('w! XXtt13')
|
command('w! XXtt13')
|
||||||
execute('bwipe XXUnix XXDos XXMac')
|
command('bwipe XXUnix XXDos XXMac')
|
||||||
execute('set fileformat=mac')
|
command('set fileformat=mac')
|
||||||
execute('e! XXUnix')
|
command('e! XXUnix')
|
||||||
execute('w! XXtt21')
|
command('w! XXtt21')
|
||||||
execute('e! XXDos')
|
command('e! XXDos')
|
||||||
execute('w! XXtt22')
|
command('w! XXtt22')
|
||||||
execute('e! XXMac')
|
command('e! XXMac')
|
||||||
execute('w! XXtt23')
|
command('w! XXtt23')
|
||||||
execute('bwipe XXUnix XXDos XXMac')
|
command('bwipe XXUnix XXDos XXMac')
|
||||||
|
|
||||||
-- Try reading and writing with 'fileformats' set to one format.
|
-- Try reading and writing with 'fileformats' set to one format.
|
||||||
execute('set fileformats=unix')
|
command('set fileformats=unix')
|
||||||
execute('e! XXUxDsMc')
|
command('e! XXUxDsMc')
|
||||||
execute('w! XXtt31')
|
command('w! XXtt31')
|
||||||
execute('bwipe XXUxDsMc')
|
command('bwipe XXUxDsMc')
|
||||||
execute('set fileformats=dos')
|
command('set fileformats=dos')
|
||||||
execute('e! XXUxDsMc')
|
command('e! XXUxDsMc')
|
||||||
execute('w! XXtt32')
|
command('w! XXtt32')
|
||||||
execute('bwipe XXUxDsMc')
|
command('bwipe XXUxDsMc')
|
||||||
execute('set fileformats=mac')
|
command('set fileformats=mac')
|
||||||
execute('e! XXUxDsMc')
|
command('e! XXUxDsMc')
|
||||||
execute('w! XXtt33')
|
command('w! XXtt33')
|
||||||
execute('bwipe XXUxDsMc')
|
command('bwipe XXUxDsMc')
|
||||||
|
|
||||||
-- Try reading and writing with 'fileformats' set to two formats.
|
-- Try reading and writing with 'fileformats' set to two formats.
|
||||||
execute('set fileformats=unix,dos')
|
command('set fileformats=unix,dos')
|
||||||
execute('e! XXUxDsMc')
|
command('e! XXUxDsMc')
|
||||||
execute('w! XXtt41')
|
command('w! XXtt41')
|
||||||
execute('bwipe XXUxDsMc')
|
command('bwipe XXUxDsMc')
|
||||||
execute('e! XXUxMac')
|
command('e! XXUxMac')
|
||||||
execute('w! XXtt42')
|
command('w! XXtt42')
|
||||||
execute('bwipe XXUxMac')
|
command('bwipe XXUxMac')
|
||||||
execute('e! XXDosMac')
|
command('e! XXDosMac')
|
||||||
execute('w! XXtt43')
|
command('w! XXtt43')
|
||||||
execute('bwipe XXDosMac')
|
command('bwipe XXDosMac')
|
||||||
execute('set fileformats=unix,mac')
|
command('set fileformats=unix,mac')
|
||||||
execute('e! XXUxDs')
|
command('e! XXUxDs')
|
||||||
execute('w! XXtt51')
|
command('w! XXtt51')
|
||||||
execute('bwipe XXUxDs')
|
command('bwipe XXUxDs')
|
||||||
execute('e! XXUxDsMc')
|
command('e! XXUxDsMc')
|
||||||
execute('w! XXtt52')
|
command('w! XXtt52')
|
||||||
execute('bwipe XXUxDsMc')
|
command('bwipe XXUxDsMc')
|
||||||
execute('e! XXDosMac')
|
command('e! XXDosMac')
|
||||||
execute('w! XXtt53')
|
command('w! XXtt53')
|
||||||
execute('bwipe XXDosMac')
|
command('bwipe XXDosMac')
|
||||||
execute('e! XXEol')
|
command('e! XXEol')
|
||||||
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
|
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
|
||||||
execute('w! XXtt54')
|
wait()
|
||||||
execute('bwipe XXEol')
|
command('w! XXtt54')
|
||||||
execute('set fileformats=dos,mac')
|
command('bwipeout! XXEol')
|
||||||
execute('e! XXUxDs')
|
command('set fileformats=dos,mac')
|
||||||
execute('w! XXtt61')
|
command('e! XXUxDs')
|
||||||
execute('bwipe XXUxDs')
|
command('w! XXtt61')
|
||||||
execute('e! XXUxMac')
|
command('bwipe XXUxDs')
|
||||||
|
command('e! XXUxMac')
|
||||||
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
|
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
|
||||||
execute('w! XXtt62')
|
wait()
|
||||||
execute('bwipe XXUxMac')
|
command('w! XXtt62')
|
||||||
execute('e! XXUxDsMc')
|
command('bwipeout! XXUxMac')
|
||||||
execute('w! XXtt63')
|
command('e! XXUxDsMc')
|
||||||
execute('bwipe XXUxDsMc')
|
command('w! XXtt63')
|
||||||
execute('e! XXMacEol')
|
command('bwipe XXUxDsMc')
|
||||||
|
command('e! XXMacEol')
|
||||||
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
|
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
|
||||||
execute('w! XXtt64')
|
wait()
|
||||||
execute('bwipe XXMacEol')
|
command('w! XXtt64')
|
||||||
|
command('bwipeout! XXMacEol')
|
||||||
|
|
||||||
-- Try reading and writing with 'fileformats' set to three formats.
|
-- Try reading and writing with 'fileformats' set to three formats.
|
||||||
execute('set fileformats=unix,dos,mac')
|
command('set fileformats=unix,dos,mac')
|
||||||
execute('e! XXUxDsMc')
|
command('e! XXUxDsMc')
|
||||||
execute('w! XXtt71')
|
command('w! XXtt71')
|
||||||
execute('bwipe XXUxDsMc')
|
command('bwipe XXUxDsMc')
|
||||||
execute('e! XXEol')
|
command('e! XXEol')
|
||||||
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
|
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
|
||||||
execute('w! XXtt72')
|
wait()
|
||||||
execute('bwipe XXEol')
|
command('w! XXtt72')
|
||||||
execute('set fileformats=mac,dos,unix')
|
command('bwipeout! XXEol')
|
||||||
execute('e! XXUxDsMc')
|
command('set fileformats=mac,dos,unix')
|
||||||
execute('w! XXtt81')
|
command('e! XXUxDsMc')
|
||||||
execute('bwipe XXUxDsMc')
|
command('w! XXtt81')
|
||||||
execute('e! XXEol')
|
command('bwipe XXUxDsMc')
|
||||||
|
command('e! XXEol')
|
||||||
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
|
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
|
||||||
execute('w! XXtt82')
|
wait()
|
||||||
execute('bwipe XXEol')
|
command('w! XXtt82')
|
||||||
|
command('bwipeout! XXEol')
|
||||||
-- Try with 'binary' set.
|
-- Try with 'binary' set.
|
||||||
execute('set fileformats=mac,unix,dos')
|
command('set fileformats=mac,unix,dos')
|
||||||
execute('set binary')
|
command('set binary')
|
||||||
execute('e! XXUxDsMc')
|
command('e! XXUxDsMc')
|
||||||
execute('w! XXtt91')
|
command('w! XXtt91')
|
||||||
execute('bwipe XXUxDsMc')
|
command('bwipe XXUxDsMc')
|
||||||
execute('set fileformats=mac')
|
command('set fileformats=mac')
|
||||||
execute('e! XXUxDsMc')
|
command('e! XXUxDsMc')
|
||||||
execute('w! XXtt92')
|
command('w! XXtt92')
|
||||||
execute('bwipe XXUxDsMc')
|
command('bwipe XXUxDsMc')
|
||||||
execute('set fileformats=dos')
|
command('set fileformats=dos')
|
||||||
execute('e! XXUxDsMc')
|
command('e! XXUxDsMc')
|
||||||
execute('w! XXtt93')
|
command('w! XXtt93')
|
||||||
|
|
||||||
-- Append "END" to each file so that we can see what the last written
|
-- Append "END" to each file so that we can see what the last written
|
||||||
-- char was.
|
-- char was.
|
||||||
execute('set fileformat=unix nobin')
|
command('set fileformat=unix nobin')
|
||||||
feed('ggdGaEND<esc>')
|
feed('ggdGaEND<esc>')
|
||||||
execute('w >>XXtt01')
|
wait()
|
||||||
execute('w >>XXtt02')
|
command('w >>XXtt01')
|
||||||
execute('w >>XXtt11')
|
command('w >>XXtt02')
|
||||||
execute('w >>XXtt12')
|
command('w >>XXtt11')
|
||||||
execute('w >>XXtt13')
|
command('w >>XXtt12')
|
||||||
execute('w >>XXtt21')
|
command('w >>XXtt13')
|
||||||
execute('w >>XXtt22')
|
command('w >>XXtt21')
|
||||||
execute('w >>XXtt23')
|
command('w >>XXtt22')
|
||||||
execute('w >>XXtt31')
|
command('w >>XXtt23')
|
||||||
execute('w >>XXtt32')
|
command('w >>XXtt31')
|
||||||
execute('w >>XXtt33')
|
command('w >>XXtt32')
|
||||||
execute('w >>XXtt41')
|
command('w >>XXtt33')
|
||||||
execute('w >>XXtt42')
|
command('w >>XXtt41')
|
||||||
execute('w >>XXtt43')
|
command('w >>XXtt42')
|
||||||
execute('w >>XXtt51')
|
command('w >>XXtt43')
|
||||||
execute('w >>XXtt52')
|
command('w >>XXtt51')
|
||||||
execute('w >>XXtt53')
|
command('w >>XXtt52')
|
||||||
execute('w >>XXtt54')
|
command('w >>XXtt53')
|
||||||
execute('w >>XXtt61')
|
command('w >>XXtt54')
|
||||||
execute('w >>XXtt62')
|
command('w >>XXtt61')
|
||||||
execute('w >>XXtt63')
|
command('w >>XXtt62')
|
||||||
execute('w >>XXtt64')
|
command('w >>XXtt63')
|
||||||
execute('w >>XXtt71')
|
command('w >>XXtt64')
|
||||||
execute('w >>XXtt72')
|
command('w >>XXtt71')
|
||||||
execute('w >>XXtt81')
|
command('w >>XXtt72')
|
||||||
execute('w >>XXtt82')
|
command('w >>XXtt81')
|
||||||
execute('w >>XXtt91')
|
command('w >>XXtt82')
|
||||||
execute('w >>XXtt92')
|
command('w >>XXtt91')
|
||||||
execute('w >>XXtt93')
|
command('w >>XXtt92')
|
||||||
|
command('w >>XXtt93')
|
||||||
|
|
||||||
-- Concatenate the results.
|
-- Concatenate the results.
|
||||||
-- Make fileformat of test.out the native fileformat.
|
-- Make fileformat of test.out the native fileformat.
|
||||||
-- Add a newline at the end.
|
-- Add a newline at the end.
|
||||||
execute('set binary')
|
command('set binary')
|
||||||
execute('e! test.out')
|
command('e! test.out')
|
||||||
execute('$r XXtt01')
|
command('$r XXtt01')
|
||||||
execute('$r XXtt02')
|
command('$r XXtt02')
|
||||||
feed('Go1<esc>')
|
feed('Go1<esc>')
|
||||||
execute('$r XXtt11')
|
wait()
|
||||||
execute('$r XXtt12')
|
command('$r XXtt11')
|
||||||
execute('$r XXtt13')
|
command('$r XXtt12')
|
||||||
|
command('$r XXtt13')
|
||||||
feed('Go2<esc>')
|
feed('Go2<esc>')
|
||||||
execute('$r XXtt21')
|
wait()
|
||||||
execute('$r XXtt22')
|
command('$r XXtt21')
|
||||||
execute('$r XXtt23')
|
command('$r XXtt22')
|
||||||
|
command('$r XXtt23')
|
||||||
feed('Go3<esc>')
|
feed('Go3<esc>')
|
||||||
execute('$r XXtt31')
|
wait()
|
||||||
execute('$r XXtt32')
|
command('$r XXtt31')
|
||||||
execute('$r XXtt33')
|
command('$r XXtt32')
|
||||||
|
command('$r XXtt33')
|
||||||
feed('Go4<esc>')
|
feed('Go4<esc>')
|
||||||
execute('$r XXtt41')
|
wait()
|
||||||
execute('$r XXtt42')
|
command('$r XXtt41')
|
||||||
execute('$r XXtt43')
|
command('$r XXtt42')
|
||||||
|
command('$r XXtt43')
|
||||||
feed('Go5<esc>')
|
feed('Go5<esc>')
|
||||||
execute('$r XXtt51')
|
wait()
|
||||||
execute('$r XXtt52')
|
command('$r XXtt51')
|
||||||
execute('$r XXtt53')
|
command('$r XXtt52')
|
||||||
execute('$r XXtt54')
|
command('$r XXtt53')
|
||||||
|
command('$r XXtt54')
|
||||||
feed('Go6<esc>')
|
feed('Go6<esc>')
|
||||||
execute('$r XXtt61')
|
wait()
|
||||||
execute('$r XXtt62')
|
command('$r XXtt61')
|
||||||
execute('$r XXtt63')
|
command('$r XXtt62')
|
||||||
execute('$r XXtt64')
|
command('$r XXtt63')
|
||||||
|
command('$r XXtt64')
|
||||||
feed('Go7<esc>')
|
feed('Go7<esc>')
|
||||||
execute('$r XXtt71')
|
wait()
|
||||||
execute('$r XXtt72')
|
command('$r XXtt71')
|
||||||
|
command('$r XXtt72')
|
||||||
feed('Go8<esc>')
|
feed('Go8<esc>')
|
||||||
execute('$r XXtt81')
|
wait()
|
||||||
execute('$r XXtt82')
|
command('$r XXtt81')
|
||||||
|
command('$r XXtt82')
|
||||||
feed('Go9<esc>')
|
feed('Go9<esc>')
|
||||||
execute('$r XXtt91')
|
wait()
|
||||||
execute('$r XXtt92')
|
command('$r XXtt91')
|
||||||
execute('$r XXtt93')
|
command('$r XXtt92')
|
||||||
|
command('$r XXtt93')
|
||||||
feed('Go10<esc>')
|
feed('Go10<esc>')
|
||||||
execute('$r XXUnix')
|
wait()
|
||||||
execute('set nobinary ff&')
|
command('$r XXUnix')
|
||||||
|
command('set nobinary ff&')
|
||||||
|
|
||||||
-- Assert buffer contents. This has to be done manually as
|
-- Assert buffer contents. This has to be done manually as
|
||||||
-- helpers.expect() calls helpers.dedent() which messes up the white space
|
-- helpers.expect() calls helpers.dedent() which messes up the white space
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ local clear = helpers.clear
|
|||||||
local source = helpers.source
|
local source = helpers.source
|
||||||
local insert = helpers.insert
|
local insert = helpers.insert
|
||||||
local expect = helpers.expect
|
local expect = helpers.expect
|
||||||
local execute = helpers.execute
|
local feed_command = helpers.feed_command
|
||||||
|
|
||||||
describe('Commands that close windows and/or buffers', function()
|
describe('Commands that close windows and/or buffers', function()
|
||||||
local function cleanup()
|
local function cleanup()
|
||||||
@@ -38,40 +38,40 @@ describe('Commands that close windows and/or buffers', function()
|
|||||||
feed('GA 1<Esc>:$w! Xtest1<CR>')
|
feed('GA 1<Esc>:$w! Xtest1<CR>')
|
||||||
feed('$r2:$w! Xtest2<CR>')
|
feed('$r2:$w! Xtest2<CR>')
|
||||||
feed('$r3:$w! Xtest3<CR>')
|
feed('$r3:$w! Xtest3<CR>')
|
||||||
execute('n! Xtest1 Xtest2')
|
feed_command('n! Xtest1 Xtest2')
|
||||||
feed('A 1<Esc>:set hidden<CR>')
|
feed('A 1<Esc>:set hidden<CR>')
|
||||||
|
|
||||||
-- Test for working :n when hidden set
|
-- Test for working :n when hidden set
|
||||||
execute('n')
|
feed_command('n')
|
||||||
expect('testtext 2')
|
expect('testtext 2')
|
||||||
|
|
||||||
-- Test for failing :rew when hidden not set
|
-- Test for failing :rew when hidden not set
|
||||||
execute('set nohidden')
|
feed_command('set nohidden')
|
||||||
feed('A 2<Esc>:rew<CR>')
|
feed('A 2<Esc>:rew<CR>')
|
||||||
expect('testtext 2 2')
|
expect('testtext 2 2')
|
||||||
|
|
||||||
-- Test for working :rew when hidden set
|
-- Test for working :rew when hidden set
|
||||||
execute('set hidden')
|
feed_command('set hidden')
|
||||||
execute('rew')
|
feed_command('rew')
|
||||||
expect('testtext 1 1')
|
expect('testtext 1 1')
|
||||||
|
|
||||||
-- Test for :all keeping a buffer when it's modified
|
-- Test for :all keeping a buffer when it's modified
|
||||||
execute('set nohidden')
|
feed_command('set nohidden')
|
||||||
feed('A 1<Esc>:sp<CR>')
|
feed('A 1<Esc>:sp<CR>')
|
||||||
execute('n Xtest2 Xtest3')
|
feed_command('n Xtest2 Xtest3')
|
||||||
execute('all')
|
feed_command('all')
|
||||||
execute('1wincmd w')
|
feed_command('1wincmd w')
|
||||||
expect('testtext 1 1 1')
|
expect('testtext 1 1 1')
|
||||||
|
|
||||||
-- Test abandoning changed buffer, should be unloaded even when 'hidden' set
|
-- Test abandoning changed buffer, should be unloaded even when 'hidden' set
|
||||||
execute('set hidden')
|
feed_command('set hidden')
|
||||||
feed('A 1<Esc>:q!<CR>')
|
feed('A 1<Esc>:q!<CR>')
|
||||||
expect('testtext 2 2')
|
expect('testtext 2 2')
|
||||||
execute('unhide')
|
feed_command('unhide')
|
||||||
expect('testtext 2 2')
|
expect('testtext 2 2')
|
||||||
|
|
||||||
-- Test ":hide" hides anyway when 'hidden' not set
|
-- Test ":hide" hides anyway when 'hidden' not set
|
||||||
execute('set nohidden')
|
feed_command('set nohidden')
|
||||||
feed('A 2<Esc>:hide<CR>')
|
feed('A 2<Esc>:hide<CR>')
|
||||||
expect('testtext 3')
|
expect('testtext 3')
|
||||||
|
|
||||||
@@ -80,42 +80,42 @@ describe('Commands that close windows and/or buffers', function()
|
|||||||
expect('testtext 3 3')
|
expect('testtext 3 3')
|
||||||
|
|
||||||
-- Test ":edit" working in modified buffer when 'hidden' set
|
-- Test ":edit" working in modified buffer when 'hidden' set
|
||||||
execute('set hidden')
|
feed_command('set hidden')
|
||||||
execute('e Xtest1')
|
feed_command('e Xtest1')
|
||||||
expect('testtext 1')
|
expect('testtext 1')
|
||||||
|
|
||||||
-- Test ":close" not hiding when 'hidden' not set in modified buffer
|
-- Test ":close" not hiding when 'hidden' not set in modified buffer
|
||||||
execute('sp Xtest3')
|
feed_command('sp Xtest3')
|
||||||
execute('set nohidden')
|
feed_command('set nohidden')
|
||||||
feed('A 3<Esc>:close<CR>')
|
feed('A 3<Esc>:close<CR>')
|
||||||
expect('testtext 3 3 3')
|
expect('testtext 3 3 3')
|
||||||
|
|
||||||
-- Test ":close!" does hide when 'hidden' not set in modified buffer
|
-- Test ":close!" does hide when 'hidden' not set in modified buffer
|
||||||
feed('A 3<Esc>:close!<CR>')
|
feed('A 3<Esc>:close!<CR>')
|
||||||
execute('set nohidden')
|
feed_command('set nohidden')
|
||||||
expect('testtext 1')
|
expect('testtext 1')
|
||||||
|
|
||||||
-- Test ":all!" hides changed buffer
|
-- Test ":all!" hides changed buffer
|
||||||
execute('sp Xtest4')
|
feed_command('sp Xtest4')
|
||||||
feed('GA 4<Esc>:all!<CR>')
|
feed('GA 4<Esc>:all!<CR>')
|
||||||
execute('1wincmd w')
|
feed_command('1wincmd w')
|
||||||
expect('testtext 2 2 2')
|
expect('testtext 2 2 2')
|
||||||
|
|
||||||
-- Test ":q!" and hidden buffer.
|
-- Test ":q!" and hidden buffer.
|
||||||
execute('bw! Xtest1 Xtest2 Xtest3 Xtest4')
|
feed_command('bw! Xtest1 Xtest2 Xtest3 Xtest4')
|
||||||
execute('sp Xtest1')
|
feed_command('sp Xtest1')
|
||||||
execute('wincmd w')
|
feed_command('wincmd w')
|
||||||
execute('bw!')
|
feed_command('bw!')
|
||||||
execute('set modified')
|
feed_command('set modified')
|
||||||
execute('bot sp Xtest2')
|
feed_command('bot sp Xtest2')
|
||||||
execute('set modified')
|
feed_command('set modified')
|
||||||
execute('bot sp Xtest3')
|
feed_command('bot sp Xtest3')
|
||||||
execute('set modified')
|
feed_command('set modified')
|
||||||
execute('wincmd t')
|
feed_command('wincmd t')
|
||||||
execute('hide')
|
feed_command('hide')
|
||||||
execute('q!')
|
feed_command('q!')
|
||||||
expect('testtext 3')
|
expect('testtext 3')
|
||||||
execute('q!')
|
feed_command('q!')
|
||||||
feed('<CR>')
|
feed('<CR>')
|
||||||
expect('testtext 1')
|
expect('testtext 1')
|
||||||
source([[
|
source([[
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
-- vim: set foldmethod=marker foldmarker=[[,]] :
|
|
||||||
-- Test for 'lisp'
|
-- Test for 'lisp'
|
||||||
-- If the lisp feature is not enabled, this will fail!
|
-- If the lisp feature is not enabled, this will fail!
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
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 execute, expect = helpers.execute, helpers.expect
|
local command, expect = helpers.command, helpers.expect
|
||||||
|
local wait = helpers.wait
|
||||||
|
|
||||||
describe('lisp indent', function()
|
describe('lisp indent', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -13,7 +13,7 @@ describe('lisp indent', function()
|
|||||||
insert([[
|
insert([[
|
||||||
(defun html-file (base)
|
(defun html-file (base)
|
||||||
(format nil "~(~A~).html" base))
|
(format nil "~(~A~).html" base))
|
||||||
|
|
||||||
(defmacro page (name title &rest body)
|
(defmacro page (name title &rest body)
|
||||||
(let ((ti (gensym)))
|
(let ((ti (gensym)))
|
||||||
`(with-open-file (*standard-output*
|
`(with-open-file (*standard-output*
|
||||||
@@ -26,29 +26,30 @@ describe('lisp indent', function()
|
|||||||
(as h2 (string-upcase ,ti)))
|
(as h2 (string-upcase ,ti)))
|
||||||
(brs 3)
|
(brs 3)
|
||||||
,@body))))
|
,@body))))
|
||||||
|
|
||||||
;;; Utilities for generating links
|
;;; Utilities for generating links
|
||||||
|
|
||||||
(defmacro with-link (dest &rest body)
|
(defmacro with-link (dest &rest body)
|
||||||
`(progn
|
`(progn
|
||||||
(format t "<a href=\"~A\">" (html-file ,dest))
|
(format t "<a href=\"~A\">" (html-file ,dest))
|
||||||
,@body
|
,@body
|
||||||
(princ "</a>")))]])
|
(princ "</a>")))]])
|
||||||
|
|
||||||
execute('set lisp')
|
command('set lisp')
|
||||||
execute('/^(defun')
|
command('/^(defun')
|
||||||
feed('=G:/^(defun/,$yank A<cr>')
|
feed('=G:/^(defun/,$yank A<cr>')
|
||||||
|
wait()
|
||||||
|
|
||||||
-- Put @a and clean empty line
|
-- Put @a and clean empty line
|
||||||
execute('%d')
|
command('%d')
|
||||||
execute('0put a')
|
command('0put a')
|
||||||
execute('$d')
|
command('$d')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([[
|
expect([[
|
||||||
(defun html-file (base)
|
(defun html-file (base)
|
||||||
(format nil "~(~A~).html" base))
|
(format nil "~(~A~).html" base))
|
||||||
|
|
||||||
(defmacro page (name title &rest body)
|
(defmacro page (name title &rest body)
|
||||||
(let ((ti (gensym)))
|
(let ((ti (gensym)))
|
||||||
`(with-open-file (*standard-output*
|
`(with-open-file (*standard-output*
|
||||||
@@ -61,9 +62,9 @@ describe('lisp indent', function()
|
|||||||
(as h2 (string-upcase ,ti)))
|
(as h2 (string-upcase ,ti)))
|
||||||
(brs 3)
|
(brs 3)
|
||||||
,@body))))
|
,@body))))
|
||||||
|
|
||||||
;;; Utilities for generating links
|
;;; Utilities for generating links
|
||||||
|
|
||||||
(defmacro with-link (dest &rest body)
|
(defmacro with-link (dest &rest body)
|
||||||
`(progn
|
`(progn
|
||||||
(format t "<a href=\"~A\">" (html-file ,dest))
|
(format t "<a href=\"~A\">" (html-file ,dest))
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
|
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
|
||||||
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe('user functions, expr-mappings, overwrite protected builtin functions and regression on calling expressions', function()
|
describe('user functions, expr-mappings, overwrite protected builtin functions and regression on calling expressions', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -72,19 +72,19 @@ describe('user functions, expr-mappings, overwrite protected builtin functions a
|
|||||||
feed('(one<cr>')
|
feed('(one<cr>')
|
||||||
feed('(two<cr>')
|
feed('(two<cr>')
|
||||||
feed('[(one again<esc>')
|
feed('[(one again<esc>')
|
||||||
execute('call append(line("$"), max([1, 2, 3]))')
|
feed_command('call append(line("$"), max([1, 2, 3]))')
|
||||||
execute('call extend(g:, {"max": function("min")})')
|
feed_command('call extend(g:, {"max": function("min")})')
|
||||||
execute('call append(line("$"), max([1, 2, 3]))')
|
feed_command('call append(line("$"), max([1, 2, 3]))')
|
||||||
execute('try')
|
feed_command('try')
|
||||||
-- Regression: the first line below used to throw "E110: Missing ')'"
|
-- Regression: the first line below used to throw "E110: Missing ')'"
|
||||||
-- Second is here just to prove that this line is correct when not
|
-- Second is here just to prove that this line is correct when not
|
||||||
-- skipping rhs of &&.
|
-- skipping rhs of &&.
|
||||||
execute([[ $put =(0&&(function('tr'))(1, 2, 3))]])
|
feed_command([[ $put =(0&&(function('tr'))(1, 2, 3))]])
|
||||||
execute([[ $put =(1&&(function('tr'))(1, 2, 3))]])
|
feed_command([[ $put =(1&&(function('tr'))(1, 2, 3))]])
|
||||||
execute('catch')
|
feed_command('catch')
|
||||||
execute([[ $put ='!!! Unexpected exception:']])
|
feed_command([[ $put ='!!! Unexpected exception:']])
|
||||||
execute(' $put =v:exception')
|
feed_command(' $put =v:exception')
|
||||||
execute('endtry')
|
feed_command('endtry')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([[
|
expect([[
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
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 execute, expect = helpers.execute, helpers.expect
|
local feed_command, expect = helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe('increment and decrement commands', function()
|
describe('increment and decrement commands', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -19,25 +19,25 @@ describe('increment and decrement commands', function()
|
|||||||
|
|
||||||
-- Increment and decrement numbers in the first row, interpreting the
|
-- Increment and decrement numbers in the first row, interpreting the
|
||||||
-- numbers as decimal, octal or hexadecimal.
|
-- numbers as decimal, octal or hexadecimal.
|
||||||
execute('set nrformats=bin,octal,hex', '1')
|
feed_command('set nrformats=bin,octal,hex', '1')
|
||||||
feed('63l102ll64128$')
|
feed('63l102ll64128$')
|
||||||
|
|
||||||
-- For the second row, treat the numbers as decimal or octal.
|
-- For the second row, treat the numbers as decimal or octal.
|
||||||
-- 0x100 should be interpreted as decimal 0, the character x, and decimal 100.
|
-- 0x100 should be interpreted as decimal 0, the character x, and decimal 100.
|
||||||
execute('set nrformats=octal', '2')
|
feed_command('set nrformats=octal', '2')
|
||||||
feed('0w102l2w65129blx6lD')
|
feed('0w102l2w65129blx6lD')
|
||||||
|
|
||||||
-- For the third row, treat the numbers as decimal or hexadecimal.
|
-- For the third row, treat the numbers as decimal or hexadecimal.
|
||||||
-- 077 should be interpreted as decimal 77.
|
-- 077 should be interpreted as decimal 77.
|
||||||
execute('set nrformats=hex', '3')
|
feed_command('set nrformats=hex', '3')
|
||||||
feed('0101l257Txldt ')
|
feed('0101l257Txldt ')
|
||||||
|
|
||||||
-- For the fourth row, interpret all numbers as decimal.
|
-- For the fourth row, interpret all numbers as decimal.
|
||||||
execute('set nrformats=', '4')
|
feed_command('set nrformats=', '4')
|
||||||
feed('0200l100w78')
|
feed('0200l100w78')
|
||||||
|
|
||||||
-- For the last row, interpret as binary and hexadecimal.
|
-- For the last row, interpret as binary and hexadecimal.
|
||||||
execute('set nrformats=bin,hex', '5')
|
feed_command('set nrformats=bin,hex', '5')
|
||||||
feed('010065l6432')
|
feed('010065l6432')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
-- Test character classes in regexp using regexpengine 0, 1, 2.
|
-- Test character classes in regexp using regexpengine 0, 1, 2.
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
local clear, command, expect = helpers.clear, helpers.command, helpers.expect
|
||||||
local source, write_file = helpers.source, helpers.write_file
|
local source, write_file = helpers.source, helpers.write_file
|
||||||
|
|
||||||
local function sixlines(text)
|
local function sixlines(text)
|
||||||
@@ -14,7 +14,7 @@ end
|
|||||||
|
|
||||||
local function diff(text, nodedent)
|
local function diff(text, nodedent)
|
||||||
local fname = helpers.tmpname()
|
local fname = helpers.tmpname()
|
||||||
execute('w! '..fname)
|
command('w! '..fname)
|
||||||
helpers.wait()
|
helpers.wait()
|
||||||
local data = io.open(fname):read('*all')
|
local data = io.open(fname):read('*all')
|
||||||
if nodedent then
|
if nodedent then
|
||||||
@@ -45,7 +45,7 @@ describe('character classes in regexp', function()
|
|||||||
end)
|
end)
|
||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
execute('e test36.in')
|
command('e test36.in')
|
||||||
end)
|
end)
|
||||||
teardown(function()
|
teardown(function()
|
||||||
os.remove('test36.in')
|
os.remove('test36.in')
|
||||||
|
|||||||
@@ -2,31 +2,31 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed = helpers.feed
|
local feed = helpers.feed
|
||||||
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe('Virtual replace mode', function()
|
describe('Virtual replace mode', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
|
|
||||||
it('is working', function()
|
it('is working', function()
|
||||||
-- Make sure that backspace works, no matter what termcap is used.
|
-- Make sure that backspace works, no matter what termcap is used.
|
||||||
execute('set t_kD=x7f t_kb=x08')
|
feed_command('set t_kD=x7f t_kb=x08')
|
||||||
-- Use vi default for 'smarttab'
|
-- Use vi default for 'smarttab'
|
||||||
execute('set nosmarttab')
|
feed_command('set nosmarttab')
|
||||||
feed('ggdGa<cr>')
|
feed('ggdGa<cr>')
|
||||||
feed('abcdefghi<cr>')
|
feed('abcdefghi<cr>')
|
||||||
feed('jk<tab>lmn<cr>')
|
feed('jk<tab>lmn<cr>')
|
||||||
feed('<Space><Space><Space><Space>opq<tab>rst<cr>')
|
feed('<Space><Space><Space><Space>opq<tab>rst<cr>')
|
||||||
feed('<C-d>uvwxyz<cr>')
|
feed('<C-d>uvwxyz<cr>')
|
||||||
feed('<esc>gg')
|
feed('<esc>gg')
|
||||||
execute('set ai')
|
feed_command('set ai')
|
||||||
execute('set bs=2')
|
feed_command('set bs=2')
|
||||||
feed('gR0<C-d> 1<cr>')
|
feed('gR0<C-d> 1<cr>')
|
||||||
feed('A<cr>')
|
feed('A<cr>')
|
||||||
feed('BCDEFGHIJ<cr>')
|
feed('BCDEFGHIJ<cr>')
|
||||||
feed('<tab>KL<cr>')
|
feed('<tab>KL<cr>')
|
||||||
feed('MNO<cr>')
|
feed('MNO<cr>')
|
||||||
feed('PQR<esc>G')
|
feed('PQR<esc>G')
|
||||||
execute('ka')
|
feed_command('ka')
|
||||||
feed('o0<C-d><cr>')
|
feed('o0<C-d><cr>')
|
||||||
feed('abcdefghi<cr>')
|
feed('abcdefghi<cr>')
|
||||||
feed('jk<tab>lmn<cr>')
|
feed('jk<tab>lmn<cr>')
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ local helpers = require('test.functional.helpers')(after_each)
|
|||||||
local nvim, eq = helpers.meths, helpers.eq
|
local nvim, eq = helpers.meths, helpers.eq
|
||||||
local insert, feed = helpers.insert, helpers.feed
|
local insert, feed = helpers.insert, helpers.feed
|
||||||
local clear, expect = helpers.clear, helpers.expect
|
local clear, expect = helpers.clear, helpers.expect
|
||||||
local execute = helpers.execute
|
local feed_command = helpers.feed_command
|
||||||
|
|
||||||
describe('Visual block mode', function()
|
describe('Visual block mode', function()
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
|
|
||||||
execute('set ts&vi sw&vi sts&vi noet') -- Vim compatible
|
feed_command('set ts&vi sw&vi sts&vi noet') -- Vim compatible
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('should shift, insert, replace and change a block', function()
|
it('should shift, insert, replace and change a block', function()
|
||||||
@@ -55,9 +55,9 @@ describe('Visual block mode', function()
|
|||||||
cccc
|
cccc
|
||||||
dddd]])
|
dddd]])
|
||||||
|
|
||||||
execute('/^aa')
|
feed_command('/^aa')
|
||||||
feed('l<C-v>jjjlllI<Right><Right> <ESC>')
|
feed('l<C-v>jjjlllI<Right><Right> <ESC>')
|
||||||
execute('/xaaa$')
|
feed_command('/xaaa$')
|
||||||
feed('<C-v>jjjI<lt>><Left>p<ESC>')
|
feed('<C-v>jjjI<lt>><Left>p<ESC>')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
@@ -84,13 +84,13 @@ describe('Visual block mode', function()
|
|||||||
4567]])
|
4567]])
|
||||||
|
|
||||||
-- Test for Visual block was created with the last <C-v>$.
|
-- Test for Visual block was created with the last <C-v>$.
|
||||||
execute('/^A23$/')
|
feed_command('/^A23$/')
|
||||||
feed('l<C-v>j$Aab<ESC>')
|
feed('l<C-v>j$Aab<ESC>')
|
||||||
-- Test for Visual block was created with the middle <C-v>$ (1).
|
-- Test for Visual block was created with the middle <C-v>$ (1).
|
||||||
execute('/^B23$/')
|
feed_command('/^B23$/')
|
||||||
feed('l<C-v>j$hAab<ESC>')
|
feed('l<C-v>j$hAab<ESC>')
|
||||||
-- Test for Visual block was created with the middle <C-v>$ (2).
|
-- Test for Visual block was created with the middle <C-v>$ (2).
|
||||||
execute('/^C23$/')
|
feed_command('/^C23$/')
|
||||||
feed('l<C-v>j$hhAab<ESC>')
|
feed('l<C-v>j$hhAab<ESC>')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
@@ -112,8 +112,8 @@ describe('Visual block mode', function()
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
-- Test for Visual block insert when virtualedit=all and utf-8 encoding.
|
-- Test for Visual block insert when virtualedit=all and utf-8 encoding.
|
||||||
execute('set ve=all')
|
feed_command('set ve=all')
|
||||||
execute('/\t\tline')
|
feed_command('/\t\tline')
|
||||||
feed('07l<C-v>jjIx<ESC>')
|
feed('07l<C-v>jjIx<ESC>')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
@@ -199,10 +199,10 @@ describe('Visual block mode', function()
|
|||||||
98765]])
|
98765]])
|
||||||
|
|
||||||
-- Test cursor position. When virtualedit=block and Visual block mode and $gj.
|
-- Test cursor position. When virtualedit=block and Visual block mode and $gj.
|
||||||
execute('set ve=block')
|
feed_command('set ve=block')
|
||||||
feed('G2l')
|
feed('G2l')
|
||||||
feed('2k<C-v>$gj<ESC>')
|
feed('2k<C-v>$gj<ESC>')
|
||||||
execute([[let cpos=getpos("'>")]])
|
feed_command([[let cpos=getpos("'>")]])
|
||||||
local cpos = nvim.get_var('cpos')
|
local cpos = nvim.get_var('cpos')
|
||||||
local expected = {
|
local expected = {
|
||||||
col = 4,
|
col = 4,
|
||||||
@@ -223,7 +223,7 @@ describe('Visual block mode', function()
|
|||||||
#define BO_CRSR 0x0004]])
|
#define BO_CRSR 0x0004]])
|
||||||
|
|
||||||
-- Block_insert when replacing spaces in front of the block with tabs.
|
-- Block_insert when replacing spaces in front of the block with tabs.
|
||||||
execute('set ts=8 sts=4 sw=4')
|
feed_command('set ts=8 sts=4 sw=4')
|
||||||
feed('ggf0<C-v>2jI<TAB><ESC>')
|
feed('ggf0<C-v>2jI<TAB><ESC>')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
-- Test for writing and reading a file of over 100 Kbyte
|
-- Test for writing and reading a file of over 100 Kbyte
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
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 execute, expect = helpers.execute, helpers.expect
|
local command, expect = helpers.command, helpers.expect
|
||||||
|
local wait = helpers.wait
|
||||||
|
|
||||||
describe('writing and reading a file of over 100 Kbyte', function()
|
describe('writing and reading a file of over 100 Kbyte', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -16,17 +18,18 @@ describe('writing and reading a file of over 100 Kbyte', function()
|
|||||||
This is the end]])
|
This is the end]])
|
||||||
|
|
||||||
feed('kY3000p2GY3000p')
|
feed('kY3000p2GY3000p')
|
||||||
|
wait()
|
||||||
|
|
||||||
execute('w! test.out')
|
command('w! test.out')
|
||||||
execute('%d')
|
command('%d')
|
||||||
execute('e! test.out')
|
command('e! test.out')
|
||||||
execute('yank A')
|
command('yank A')
|
||||||
execute('3003yank A')
|
command('3003yank A')
|
||||||
execute('6005yank A')
|
command('6005yank A')
|
||||||
execute('%d')
|
command('%d')
|
||||||
execute('0put a')
|
command('0put a')
|
||||||
execute('$d')
|
command('$d')
|
||||||
execute('w!')
|
command('w!')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
This is the start
|
This is the start
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
-- vim: set foldmethod=marker foldmarker=[[,]] :
|
|
||||||
-- Tests for regexp with various magic settings.
|
-- Tests for regexp with various magic settings.
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
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 execute, expect = helpers.execute, helpers.expect
|
local feed_command, expect = helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe('regexp with magic settings', function()
|
describe('regexp with magic settings', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -21,27 +20,27 @@ describe('regexp with magic settings', function()
|
|||||||
9 foobar
|
9 foobar
|
||||||
]])
|
]])
|
||||||
|
|
||||||
execute('/^1')
|
feed_command('/^1')
|
||||||
execute([[/a*b\{2}c\+/e]])
|
feed_command([[/a*b\{2}c\+/e]])
|
||||||
feed([[x/\Md\*e\{2}f\+/e<cr>]])
|
feed([[x/\Md\*e\{2}f\+/e<cr>]])
|
||||||
feed('x:set nomagic<cr>')
|
feed('x:set nomagic<cr>')
|
||||||
execute([[/g\*h\{2}i\+/e]])
|
feed_command([[/g\*h\{2}i\+/e]])
|
||||||
feed([[x/\mj*k\{2}l\+/e<cr>]])
|
feed([[x/\mj*k\{2}l\+/e<cr>]])
|
||||||
feed([[x/\vm*n{2}o+/e<cr>]])
|
feed([[x/\vm*n{2}o+/e<cr>]])
|
||||||
feed([[x/\V^aa$<cr>]])
|
feed([[x/\V^aa$<cr>]])
|
||||||
feed('x:set magic<cr>')
|
feed('x:set magic<cr>')
|
||||||
execute([[/\v(a)(b)\2\1\1/e]])
|
feed_command([[/\v(a)(b)\2\1\1/e]])
|
||||||
feed([[x/\V[ab]\(\[xy]\)\1<cr>]])
|
feed([[x/\V[ab]\(\[xy]\)\1<cr>]])
|
||||||
feed('x:$<cr>')
|
feed('x:$<cr>')
|
||||||
execute('set undolevels=100')
|
feed_command('set undolevels=100')
|
||||||
feed('dv?bar?<cr>')
|
feed('dv?bar?<cr>')
|
||||||
feed('Yup:<cr>')
|
feed('Yup:<cr>')
|
||||||
execute('?^1?,$yank A')
|
feed_command('?^1?,$yank A')
|
||||||
|
|
||||||
-- Put @a and clean empty line
|
-- Put @a and clean empty line
|
||||||
execute('%d')
|
feed_command('%d')
|
||||||
execute('0put a')
|
feed_command('0put a')
|
||||||
execute('$d')
|
feed_command('$d')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([[
|
expect([[
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, insert = helpers.feed, helpers.insert
|
local feed, insert = helpers.feed, helpers.insert
|
||||||
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
-- Runs the test protocol with the given 'regexpengine' setting. In the old test
|
-- Runs the test protocol with the given 'regexpengine' setting. In the old test
|
||||||
-- suite the test protocol was duplicated in test44 and test99, the only
|
-- suite the test protocol was duplicated in test44 and test99, the only
|
||||||
@@ -32,19 +32,19 @@ local function run_test_with_regexpengine(regexpengine)
|
|||||||
k combinations
|
k combinations
|
||||||
l ä ö ü ᾱ̆́]])
|
l ä ö ü ᾱ̆́]])
|
||||||
|
|
||||||
execute('set re=' .. regexpengine)
|
feed_command('set re=' .. regexpengine)
|
||||||
|
|
||||||
-- Lines 1-8. Exercise regexp search with various magic settings. On each
|
-- Lines 1-8. Exercise regexp search with various magic settings. On each
|
||||||
-- line the character on which the cursor is expected to land is deleted.
|
-- line the character on which the cursor is expected to land is deleted.
|
||||||
feed('/^1<cr>')
|
feed('/^1<cr>')
|
||||||
feed([[/a*b\{2}c\+/e<cr>x]])
|
feed([[/a*b\{2}c\+/e<cr>x]])
|
||||||
feed([[/\Md\*e\{2}f\+/e<cr>x]])
|
feed([[/\Md\*e\{2}f\+/e<cr>x]])
|
||||||
execute('set nomagic')
|
feed_command('set nomagic')
|
||||||
feed([[/g\*h\{2}i\+/e<cr>x]])
|
feed([[/g\*h\{2}i\+/e<cr>x]])
|
||||||
feed([[/\mj*k\{2}l\+/e<cr>x]])
|
feed([[/\mj*k\{2}l\+/e<cr>x]])
|
||||||
feed([[/\vm*n{2}o+/e<cr>x]])
|
feed([[/\vm*n{2}o+/e<cr>x]])
|
||||||
feed([[/\V^aa$<cr>x]])
|
feed([[/\V^aa$<cr>x]])
|
||||||
execute('set magic')
|
feed_command('set magic')
|
||||||
feed([[/\v(a)(b)\2\1\1/e<cr>x]])
|
feed([[/\v(a)(b)\2\1\1/e<cr>x]])
|
||||||
feed([[/\V[ab]\(\[xy]\)\1<cr>x]])
|
feed([[/\V[ab]\(\[xy]\)\1<cr>x]])
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ local function run_test_with_regexpengine(regexpengine)
|
|||||||
-- Line b. Find word by change of word class.
|
-- Line b. Find word by change of word class.
|
||||||
-- (The "<" character in this test step seemed to confuse our "feed" test
|
-- (The "<" character in this test step seemed to confuse our "feed" test
|
||||||
-- helper, which is why we've resorted to "execute" here.)
|
-- helper, which is why we've resorted to "execute" here.)
|
||||||
execute([[/ち\<カヨ\>は]])
|
feed_command([[/ち\<カヨ\>は]])
|
||||||
feed('x')
|
feed('x')
|
||||||
|
|
||||||
-- Lines c-i. Test \%u, [\u], and friends.
|
-- Lines c-i. Test \%u, [\u], and friends.
|
||||||
@@ -73,28 +73,28 @@ local function run_test_with_regexpengine(regexpengine)
|
|||||||
|
|
||||||
-- Line k. Test substitution with combining characters by executing register
|
-- Line k. Test substitution with combining characters by executing register
|
||||||
-- contents.
|
-- contents.
|
||||||
execute([[let @w=':%s#comb[i]nations#œ̄ṣ́m̥̄ᾱ̆́#g']])
|
feed_command([[let @w=':%s#comb[i]nations#œ̄ṣ́m̥̄ᾱ̆́#g']])
|
||||||
execute('@w')
|
feed_command('@w')
|
||||||
|
|
||||||
-- Line l. Ex command ":s/ \?/ /g" should NOT split multi-byte characters
|
-- Line l. Ex command ":s/ \?/ /g" should NOT split multi-byte characters
|
||||||
-- into bytes (fixed by vim-7.3.192).
|
-- into bytes (fixed by vim-7.3.192).
|
||||||
execute([[/^l]])
|
feed_command([[/^l]])
|
||||||
execute([[s/ \?/ /g]])
|
feed_command([[s/ \?/ /g]])
|
||||||
|
|
||||||
-- Additional tests. Test matchstr() with multi-byte characters.
|
-- Additional tests. Test matchstr() with multi-byte characters.
|
||||||
feed('G')
|
feed('G')
|
||||||
execute([[put =matchstr(\"אבגד\", \".\", 0, 2)]]) -- ב
|
feed_command([[put =matchstr(\"אבגד\", \".\", 0, 2)]]) -- ב
|
||||||
execute([[put =matchstr(\"אבגד\", \"..\", 0, 2)]]) -- בג
|
feed_command([[put =matchstr(\"אבגד\", \"..\", 0, 2)]]) -- בג
|
||||||
execute([[put =matchstr(\"אבגד\", \".\", 0, 0)]]) -- א
|
feed_command([[put =matchstr(\"אבגד\", \".\", 0, 0)]]) -- א
|
||||||
execute([[put =matchstr(\"אבגד\", \".\", 4, -1)]]) -- ג
|
feed_command([[put =matchstr(\"אבגד\", \".\", 4, -1)]]) -- ג
|
||||||
|
|
||||||
-- Test that a search with "/e" offset wraps around at the end of the buffer.
|
-- Test that a search with "/e" offset wraps around at the end of the buffer.
|
||||||
execute('new')
|
feed_command('new')
|
||||||
execute([[$put =['dog(a', 'cat('] ]])
|
feed_command([[$put =['dog(a', 'cat('] ]])
|
||||||
feed('/(/e+<cr>')
|
feed('/(/e+<cr>')
|
||||||
feed('"ayn')
|
feed('"ayn')
|
||||||
execute('bd!')
|
feed_command('bd!')
|
||||||
execute([[$put ='']])
|
feed_command([[$put ='']])
|
||||||
feed('G"ap')
|
feed('G"ap')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, insert, execute, expect_any =
|
local feed, insert, feed_command, expect_any =
|
||||||
helpers.feed, helpers.insert, helpers.execute, helpers.expect_any
|
helpers.feed, helpers.insert, helpers.feed_command, helpers.expect_any
|
||||||
|
|
||||||
describe('folding', function()
|
describe('folding', function()
|
||||||
local screen
|
local screen
|
||||||
@@ -28,15 +28,15 @@ describe('folding', function()
|
|||||||
|
|
||||||
-- Basic test if a fold can be created, opened, moving to the end and
|
-- Basic test if a fold can be created, opened, moving to the end and
|
||||||
-- closed.
|
-- closed.
|
||||||
execute('1')
|
feed_command('1')
|
||||||
feed('zf2j')
|
feed('zf2j')
|
||||||
execute('call append("$", "manual " . getline(foldclosed(".")))')
|
feed_command('call append("$", "manual " . getline(foldclosed(".")))')
|
||||||
feed('zo')
|
feed('zo')
|
||||||
execute('call append("$", foldclosed("."))')
|
feed_command('call append("$", foldclosed("."))')
|
||||||
feed(']z')
|
feed(']z')
|
||||||
execute('call append("$", getline("."))')
|
feed_command('call append("$", getline("."))')
|
||||||
feed('zc')
|
feed('zc')
|
||||||
execute('call append("$", getline(foldclosed(".")))')
|
feed_command('call append("$", getline(foldclosed(".")))')
|
||||||
|
|
||||||
expect_any([[
|
expect_any([[
|
||||||
manual 1 aa
|
manual 1 aa
|
||||||
@@ -52,15 +52,15 @@ describe('folding', function()
|
|||||||
ee {{{ }}}
|
ee {{{ }}}
|
||||||
ff }}}
|
ff }}}
|
||||||
]])
|
]])
|
||||||
execute('set fdm=marker fdl=1')
|
feed_command('set fdm=marker fdl=1')
|
||||||
execute('2')
|
feed_command('2')
|
||||||
execute('call append("$", "line 2 foldlevel=" . foldlevel("."))')
|
feed_command('call append("$", "line 2 foldlevel=" . foldlevel("."))')
|
||||||
feed('[z')
|
feed('[z')
|
||||||
execute('call append("$", foldlevel("."))')
|
feed_command('call append("$", foldlevel("."))')
|
||||||
feed('jo{{ <esc>r{jj') -- writes '{{{' and moves 2 lines bot
|
feed('jo{{ <esc>r{jj') -- writes '{{{' and moves 2 lines bot
|
||||||
execute('call append("$", foldlevel("."))')
|
feed_command('call append("$", foldlevel("."))')
|
||||||
feed('kYpj')
|
feed('kYpj')
|
||||||
execute('call append("$", foldlevel("."))')
|
feed_command('call append("$", foldlevel("."))')
|
||||||
|
|
||||||
helpers.wait()
|
helpers.wait()
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
@@ -80,15 +80,15 @@ describe('folding', function()
|
|||||||
|
|
||||||
it("foldmethod=indent", function()
|
it("foldmethod=indent", function()
|
||||||
screen:try_resize(20, 8)
|
screen:try_resize(20, 8)
|
||||||
execute('set fdm=indent sw=2')
|
feed_command('set fdm=indent sw=2')
|
||||||
insert([[
|
insert([[
|
||||||
aa
|
aa
|
||||||
bb
|
bb
|
||||||
cc
|
cc
|
||||||
last
|
last
|
||||||
]])
|
]])
|
||||||
execute('call append("$", "foldlevel line3=" . foldlevel(3))')
|
feed_command('call append("$", "foldlevel line3=" . foldlevel(3))')
|
||||||
execute('call append("$", foldlevel(2))')
|
feed_command('call append("$", foldlevel(2))')
|
||||||
feed('zR')
|
feed('zR')
|
||||||
|
|
||||||
helpers.wait()
|
helpers.wait()
|
||||||
@@ -119,23 +119,23 @@ describe('folding', function()
|
|||||||
a jj
|
a jj
|
||||||
b kk
|
b kk
|
||||||
last]])
|
last]])
|
||||||
execute('set fdm=syntax fdl=0')
|
feed_command('set fdm=syntax fdl=0')
|
||||||
execute('syn region Hup start="dd" end="ii" fold contains=Fd1,Fd2,Fd3')
|
feed_command('syn region Hup start="dd" end="ii" fold contains=Fd1,Fd2,Fd3')
|
||||||
execute('syn region Fd1 start="ee" end="ff" fold contained')
|
feed_command('syn region Fd1 start="ee" end="ff" fold contained')
|
||||||
execute('syn region Fd2 start="gg" end="hh" fold contained')
|
feed_command('syn region Fd2 start="gg" end="hh" fold contained')
|
||||||
execute('syn region Fd3 start="commentstart" end="commentend" fold contained')
|
feed_command('syn region Fd3 start="commentstart" end="commentend" fold contained')
|
||||||
feed('Gzk')
|
feed('Gzk')
|
||||||
execute('call append("$", "folding " . getline("."))')
|
feed_command('call append("$", "folding " . getline("."))')
|
||||||
feed('k')
|
feed('k')
|
||||||
execute('call append("$", getline("."))')
|
feed_command('call append("$", getline("."))')
|
||||||
feed('jAcommentstart <esc>Acommentend<esc>')
|
feed('jAcommentstart <esc>Acommentend<esc>')
|
||||||
execute('set fdl=1')
|
feed_command('set fdl=1')
|
||||||
feed('3j')
|
feed('3j')
|
||||||
execute('call append("$", getline("."))')
|
feed_command('call append("$", getline("."))')
|
||||||
execute('set fdl=0')
|
feed_command('set fdl=0')
|
||||||
feed('zO<C-L>j') -- <C-L> redraws screen
|
feed('zO<C-L>j') -- <C-L> redraws screen
|
||||||
execute('call append("$", getline("."))')
|
feed_command('call append("$", getline("."))')
|
||||||
execute('set fdl=0')
|
feed_command('set fdl=0')
|
||||||
expect_any([[
|
expect_any([[
|
||||||
folding 9 ii
|
folding 9 ii
|
||||||
3 cc
|
3 cc
|
||||||
@@ -158,7 +158,7 @@ describe('folding', function()
|
|||||||
b kk
|
b kk
|
||||||
last ]])
|
last ]])
|
||||||
|
|
||||||
execute([[
|
feed_command([[
|
||||||
fun Flvl()
|
fun Flvl()
|
||||||
let l = getline(v:lnum)
|
let l = getline(v:lnum)
|
||||||
if l =~ "bb$"
|
if l =~ "bb$"
|
||||||
@@ -173,15 +173,15 @@ describe('folding', function()
|
|||||||
return "="
|
return "="
|
||||||
endfun
|
endfun
|
||||||
]])
|
]])
|
||||||
execute('set fdm=expr fde=Flvl()')
|
feed_command('set fdm=expr fde=Flvl()')
|
||||||
execute('/bb$')
|
feed_command('/bb$')
|
||||||
execute('call append("$", "expr " . foldlevel("."))')
|
feed_command('call append("$", "expr " . foldlevel("."))')
|
||||||
execute('/hh$')
|
feed_command('/hh$')
|
||||||
execute('call append("$", foldlevel("."))')
|
feed_command('call append("$", foldlevel("."))')
|
||||||
execute('/ii$')
|
feed_command('/ii$')
|
||||||
execute('call append("$", foldlevel("."))')
|
feed_command('call append("$", foldlevel("."))')
|
||||||
execute('/kk$')
|
feed_command('/kk$')
|
||||||
execute('call append("$", foldlevel("."))')
|
feed_command('call append("$", foldlevel("."))')
|
||||||
|
|
||||||
expect_any([[
|
expect_any([[
|
||||||
expr 2
|
expr 2
|
||||||
@@ -199,11 +199,11 @@ describe('folding', function()
|
|||||||
Test fdm=indent START
|
Test fdm=indent START
|
||||||
line3
|
line3
|
||||||
line4]])
|
line4]])
|
||||||
execute('set noai nosta ')
|
feed_command('set noai nosta ')
|
||||||
execute('set fdm=indent')
|
feed_command('set fdm=indent')
|
||||||
execute('1m1')
|
feed_command('1m1')
|
||||||
feed('2jzc')
|
feed('2jzc')
|
||||||
execute('m0')
|
feed_command('m0')
|
||||||
feed('zR')
|
feed('zR')
|
||||||
|
|
||||||
expect_any([[
|
expect_any([[
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
-- vim: set foldmethod=marker foldmarker=[[,]] :
|
|
||||||
-- Tests for ":highlight".
|
-- Tests for ":highlight".
|
||||||
|
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear, feed = helpers.clear, helpers.feed
|
local clear, feed = helpers.clear, helpers.feed
|
||||||
local execute, expect = helpers.execute, helpers.expect
|
local command, expect = helpers.command, helpers.expect
|
||||||
|
local eq = helpers.eq
|
||||||
local wait = helpers.wait
|
local wait = helpers.wait
|
||||||
|
local exc_exec = helpers.exc_exec
|
||||||
|
|
||||||
if helpers.pending_win32(pending) then return end
|
if helpers.pending_win32(pending) then return end
|
||||||
|
|
||||||
@@ -16,7 +17,8 @@ describe(':highlight', function()
|
|||||||
local screen = Screen.new(35, 10)
|
local screen = Screen.new(35, 10)
|
||||||
screen:attach()
|
screen:attach()
|
||||||
-- Basic test if ":highlight" doesn't crash
|
-- Basic test if ":highlight" doesn't crash
|
||||||
execute('set more', 'highlight')
|
command('set more')
|
||||||
|
feed(':highlight<CR>')
|
||||||
-- FIXME(tarruda): We need to be sure the prompt is displayed before
|
-- FIXME(tarruda): We need to be sure the prompt is displayed before
|
||||||
-- continuing, or risk a race condition where some of the following input
|
-- continuing, or risk a race condition where some of the following input
|
||||||
-- is discarded resulting in test failure
|
-- is discarded resulting in test failure
|
||||||
@@ -34,65 +36,51 @@ describe(':highlight', function()
|
|||||||
]])
|
]])
|
||||||
feed('q')
|
feed('q')
|
||||||
wait() -- wait until we're back to normal
|
wait() -- wait until we're back to normal
|
||||||
execute('hi Search')
|
command('hi Search')
|
||||||
|
|
||||||
-- Test setting colors.
|
-- Test setting colors.
|
||||||
-- Test clearing one color and all doesn't generate error or warning
|
-- Test clearing one color and all doesn't generate error or warning
|
||||||
execute('hi NewGroup cterm=italic ctermfg=DarkBlue ctermbg=Grey gui=NONE guifg=#00ff00 guibg=Cyan')
|
command('hi NewGroup cterm=italic ctermfg=DarkBlue ctermbg=Grey gui=NONE guifg=#00ff00 guibg=Cyan')
|
||||||
execute('hi Group2 cterm=NONE')
|
command('hi Group2 cterm=NONE')
|
||||||
execute('hi Group3 cterm=bold')
|
command('hi Group3 cterm=bold')
|
||||||
execute('redir! @a')
|
command('redir! @a')
|
||||||
execute('hi NewGroup')
|
command('hi NewGroup')
|
||||||
execute('hi Group2')
|
command('hi Group2')
|
||||||
execute('hi Group3')
|
command('hi Group3')
|
||||||
execute('hi clear NewGroup')
|
command('hi clear NewGroup')
|
||||||
execute('hi NewGroup')
|
command('hi NewGroup')
|
||||||
execute('hi Group2')
|
command('hi Group2')
|
||||||
execute('hi Group2 NONE')
|
command('hi Group2 NONE')
|
||||||
execute('hi Group2')
|
command('hi Group2')
|
||||||
execute('hi clear')
|
command('hi clear')
|
||||||
execute('hi Group3')
|
command('hi Group3')
|
||||||
execute([[hi Crash cterm='asdf]])
|
eq('Vim(highlight):E475: Invalid argument: cterm=\'asdf',
|
||||||
execute('redir END')
|
exc_exec([[hi Crash cterm='asdf]]))
|
||||||
|
command('redir END')
|
||||||
|
|
||||||
-- Filter ctermfg and ctermbg, the numbers depend on the terminal
|
-- Filter ctermfg and ctermbg, the numbers depend on the terminal
|
||||||
execute('0put a')
|
command('0put a')
|
||||||
execute([[%s/ctermfg=\d*/ctermfg=2/]])
|
command([[%s/ctermfg=\d*/ctermfg=2/]])
|
||||||
execute([[%s/ctermbg=\d*/ctermbg=3/]])
|
command([[%s/ctermbg=\d*/ctermbg=3/]])
|
||||||
|
|
||||||
-- Filter out possibly translated error message
|
|
||||||
execute('%s/E475: [^:]*:/E475:/')
|
|
||||||
|
|
||||||
-- Fix the fileformat
|
-- Fix the fileformat
|
||||||
execute('set ff&')
|
command('set ff&')
|
||||||
execute('$d')
|
command('$d')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
|
|
||||||
NewGroup xxx cterm=italic
|
NewGroup xxx cterm=italic
|
||||||
ctermfg=2
|
ctermfg=2
|
||||||
ctermbg=3
|
ctermbg=3
|
||||||
guifg=#00ff00
|
guifg=#00ff00
|
||||||
guibg=Cyan
|
guibg=Cyan
|
||||||
|
|
||||||
Group2 xxx cleared
|
Group2 xxx cleared
|
||||||
|
|
||||||
Group3 xxx cterm=bold
|
Group3 xxx cterm=bold
|
||||||
|
|
||||||
|
|
||||||
NewGroup xxx cleared
|
NewGroup xxx cleared
|
||||||
|
|
||||||
Group2 xxx cleared
|
Group2 xxx cleared
|
||||||
|
|
||||||
|
|
||||||
Group2 xxx cleared
|
Group2 xxx cleared
|
||||||
|
Group3 xxx cleared]])
|
||||||
|
|
||||||
Group3 xxx cleared
|
|
||||||
|
|
||||||
E475: cterm='asdf]])
|
|
||||||
screen:detach()
|
screen:detach()
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1,33 +1,37 @@
|
|||||||
-- Some tests for buffer-local autocommands
|
-- Some tests for buffer-local autocommands
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear, execute, eq = helpers.clear, helpers.execute, helpers.eq
|
|
||||||
local curbuf_contents = helpers.curbuf_contents
|
local clear = helpers.clear
|
||||||
|
local expect = helpers.expect
|
||||||
|
local command = helpers.command
|
||||||
|
|
||||||
|
local fname = 'Xtest-functional-legacy-054'
|
||||||
|
|
||||||
describe('BufLeave <buffer>', function()
|
describe('BufLeave <buffer>', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
|
|
||||||
it('is working', function()
|
it('is working', function()
|
||||||
execute('w! xx')
|
command('write! ' .. fname)
|
||||||
execute('au BufLeave <buffer> norm Ibuffer-local autocommand')
|
command('autocmd BufLeave <buffer> normal! Ibuffer-local autocommand')
|
||||||
execute('au BufLeave <buffer> update')
|
command('autocmd BufLeave <buffer> update')
|
||||||
|
|
||||||
-- Here, autocommand for xx shall append a line
|
-- Here, autocommand for xx shall append a line
|
||||||
-- But autocommand shall not apply to buffer named <buffer>
|
-- But autocommand shall not apply to buffer named <buffer>
|
||||||
execute('e somefile')
|
command('edit somefile')
|
||||||
|
|
||||||
-- Here, autocommand shall be auto-deleted
|
-- Here, autocommand shall be auto-deleted
|
||||||
execute('bwipe xx')
|
command('bwipeout ' .. fname)
|
||||||
|
|
||||||
-- Nothing shall be written
|
|
||||||
execute('e xx')
|
|
||||||
execute('e somefile')
|
|
||||||
execute('e xx')
|
|
||||||
|
|
||||||
eq('buffer-local autocommand', curbuf_contents())
|
-- Nothing shall be written
|
||||||
|
command('edit ' .. fname)
|
||||||
|
command('edit somefile')
|
||||||
|
command('edit ' .. fname)
|
||||||
|
|
||||||
|
expect('buffer-local autocommand')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
teardown(function()
|
teardown(function()
|
||||||
os.remove('xx')
|
os.remove(fname)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, source = helpers.feed, helpers.source
|
local feed, source = helpers.feed, helpers.source
|
||||||
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe('list and dictionary types', function()
|
describe('list and dictionary types', function()
|
||||||
before_each(clear)
|
before_each(clear)
|
||||||
@@ -20,7 +20,7 @@ describe('list and dictionary types', function()
|
|||||||
$put =v:exception[:14]
|
$put =v:exception[:14]
|
||||||
endtry]])
|
endtry]])
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
[1, 'as''d', [1, 2, function('strlen')], {'a': 1}]
|
[1, 'as''d', [1, 2, function('strlen')], {'a': 1}]
|
||||||
{'a': 1}
|
{'a': 1}
|
||||||
1
|
1
|
||||||
@@ -38,7 +38,7 @@ describe('list and dictionary types', function()
|
|||||||
$put =string(l[0:8])
|
$put =string(l[0:8])
|
||||||
$put =string(l[8:-1])]])
|
$put =string(l[8:-1])]])
|
||||||
expect([=[
|
expect([=[
|
||||||
|
|
||||||
[1, 'as''d', [1, 2, function('strlen')], {'a': 1}]
|
[1, 'as''d', [1, 2, function('strlen')], {'a': 1}]
|
||||||
['as''d', [1, 2, function('strlen')], {'a': 1}]
|
['as''d', [1, 2, function('strlen')], {'a': 1}]
|
||||||
[1, 'as''d', [1, 2, function('strlen')]]
|
[1, 'as''d', [1, 2, function('strlen')]]
|
||||||
@@ -84,7 +84,7 @@ describe('list and dictionary types', function()
|
|||||||
call filter(d, 'v:key =~ ''[ac391]''')
|
call filter(d, 'v:key =~ ''[ac391]''')
|
||||||
$put =string(d)]])
|
$put =string(d)]])
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
{'1': 'asd', 'b': [1, 2, function('strlen')], '-1': {'a': 1}}asd
|
{'1': 'asd', 'b': [1, 2, function('strlen')], '-1': {'a': 1}}asd
|
||||||
['-1', '1', 'b']
|
['-1', '1', 'b']
|
||||||
['asd', [1, 2, function('strlen')], {'a': 1}]
|
['asd', [1, 2, function('strlen')], {'a': 1}]
|
||||||
@@ -134,7 +134,7 @@ describe('list and dictionary types', function()
|
|||||||
unlet d[-1]
|
unlet d[-1]
|
||||||
$put =string(d)]])
|
$put =string(d)]])
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
[1, 'as''d', {'a': 1}]
|
[1, 'as''d', {'a': 1}]
|
||||||
[4]
|
[4]
|
||||||
{'1': 99, '3': 33}]])
|
{'1': 99, '3': 33}]])
|
||||||
@@ -142,42 +142,42 @@ describe('list and dictionary types', function()
|
|||||||
|
|
||||||
it("removing items out of range: silently skip items that don't exist", function()
|
it("removing items out of range: silently skip items that don't exist", function()
|
||||||
-- We can not use source() here as we want to ignore all errors.
|
-- We can not use source() here as we want to ignore all errors.
|
||||||
execute('lang C')
|
feed_command('lang C')
|
||||||
execute('let l = [0, 1, 2, 3]')
|
feed_command('let l = [0, 1, 2, 3]')
|
||||||
execute('unlet l[2:1]')
|
feed_command('unlet l[2:1]')
|
||||||
execute('$put =string(l)')
|
feed_command('$put =string(l)')
|
||||||
execute('let l = [0, 1, 2, 3]')
|
feed_command('let l = [0, 1, 2, 3]')
|
||||||
execute('unlet l[2:2]')
|
feed_command('unlet l[2:2]')
|
||||||
execute('$put =string(l)')
|
feed_command('$put =string(l)')
|
||||||
execute('let l = [0, 1, 2, 3]')
|
feed_command('let l = [0, 1, 2, 3]')
|
||||||
execute('unlet l[2:3]')
|
feed_command('unlet l[2:3]')
|
||||||
execute('$put =string(l)')
|
feed_command('$put =string(l)')
|
||||||
execute('let l = [0, 1, 2, 3]')
|
feed_command('let l = [0, 1, 2, 3]')
|
||||||
execute('unlet l[2:4]')
|
feed_command('unlet l[2:4]')
|
||||||
execute('$put =string(l)')
|
feed_command('$put =string(l)')
|
||||||
execute('let l = [0, 1, 2, 3]')
|
feed_command('let l = [0, 1, 2, 3]')
|
||||||
execute('unlet l[2:5]')
|
feed_command('unlet l[2:5]')
|
||||||
execute('$put =string(l)')
|
feed_command('$put =string(l)')
|
||||||
execute('let l = [0, 1, 2, 3]')
|
feed_command('let l = [0, 1, 2, 3]')
|
||||||
execute('unlet l[-1:2]')
|
feed_command('unlet l[-1:2]')
|
||||||
execute('$put =string(l)')
|
feed_command('$put =string(l)')
|
||||||
execute('let l = [0, 1, 2, 3]')
|
feed_command('let l = [0, 1, 2, 3]')
|
||||||
execute('unlet l[-2:2]')
|
feed_command('unlet l[-2:2]')
|
||||||
execute('$put =string(l)')
|
feed_command('$put =string(l)')
|
||||||
execute('let l = [0, 1, 2, 3]')
|
feed_command('let l = [0, 1, 2, 3]')
|
||||||
execute('unlet l[-3:2]')
|
feed_command('unlet l[-3:2]')
|
||||||
execute('$put =string(l)')
|
feed_command('$put =string(l)')
|
||||||
execute('let l = [0, 1, 2, 3]')
|
feed_command('let l = [0, 1, 2, 3]')
|
||||||
execute('unlet l[-4:2]')
|
feed_command('unlet l[-4:2]')
|
||||||
execute('$put =string(l)')
|
feed_command('$put =string(l)')
|
||||||
execute('let l = [0, 1, 2, 3]')
|
feed_command('let l = [0, 1, 2, 3]')
|
||||||
execute('unlet l[-5:2]')
|
feed_command('unlet l[-5:2]')
|
||||||
execute('$put =string(l)')
|
feed_command('$put =string(l)')
|
||||||
execute('let l = [0, 1, 2, 3]')
|
feed_command('let l = [0, 1, 2, 3]')
|
||||||
execute('unlet l[-6:2]')
|
feed_command('unlet l[-6:2]')
|
||||||
execute('$put =string(l)')
|
feed_command('$put =string(l)')
|
||||||
expect([=[
|
expect([=[
|
||||||
|
|
||||||
[0, 1, 2, 3]
|
[0, 1, 2, 3]
|
||||||
[0, 1, 3]
|
[0, 1, 3]
|
||||||
[0, 1]
|
[0, 1]
|
||||||
@@ -208,7 +208,7 @@ describe('list and dictionary types', function()
|
|||||||
$put =v:exception[:14]
|
$put =v:exception[:14]
|
||||||
endtry]])
|
endtry]])
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
2
|
2
|
||||||
3
|
3
|
||||||
Vim(let):E687:
|
Vim(let):E687:
|
||||||
@@ -257,7 +257,7 @@ describe('list and dictionary types', function()
|
|||||||
" Must be almost empty now.
|
" Must be almost empty now.
|
||||||
$put =string(d)]])
|
$put =string(d)]])
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
3000 2900 2001 1600 1501
|
3000 2900 2001 1600 1501
|
||||||
Vim(let):E716: 1500
|
Vim(let):E716: 1500
|
||||||
NONE 2999
|
NONE 2999
|
||||||
@@ -277,7 +277,7 @@ describe('list and dictionary types', function()
|
|||||||
let Fn = dict.func
|
let Fn = dict.func
|
||||||
call Fn('xxx')]])
|
call Fn('xxx')]])
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
len: 3
|
len: 3
|
||||||
again: 3
|
again: 3
|
||||||
xxx3]])
|
xxx3]])
|
||||||
@@ -324,7 +324,7 @@ describe('list and dictionary types', function()
|
|||||||
let l3 = deepcopy(l2)
|
let l3 = deepcopy(l2)
|
||||||
$put ='same list: ' . (l3[1] is l3[2])]])
|
$put ='same list: ' . (l3[1] is l3[2])]])
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
Vim(let):E698:
|
Vim(let):E698:
|
||||||
same list: 1]])
|
same list: 1]])
|
||||||
end)
|
end)
|
||||||
@@ -394,7 +394,7 @@ describe('list and dictionary types', function()
|
|||||||
endfor
|
endfor
|
||||||
endfor]=])
|
endfor]=])
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
depth is 0
|
depth is 0
|
||||||
0000-000
|
0000-000
|
||||||
ppppppp
|
ppppppp
|
||||||
@@ -499,7 +499,7 @@ describe('list and dictionary types', function()
|
|||||||
endfor
|
endfor
|
||||||
endfor]=])
|
endfor]=])
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
depth is 0
|
depth is 0
|
||||||
0000-000
|
0000-000
|
||||||
ppppppp
|
ppppppp
|
||||||
@@ -647,7 +647,7 @@ describe('list and dictionary types', function()
|
|||||||
$put =string(l)]])
|
$put =string(l)]])
|
||||||
|
|
||||||
expect([=[
|
expect([=[
|
||||||
|
|
||||||
Locks and commands or functions:
|
Locks and commands or functions:
|
||||||
No :unlet after lock on dict:
|
No :unlet after lock on dict:
|
||||||
Vim(unlet):E741:
|
Vim(unlet):E741:
|
||||||
@@ -676,7 +676,7 @@ describe('list and dictionary types', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('locked variables (part 2)', function()
|
it('locked variables (part 2)', function()
|
||||||
execute(
|
feed_command(
|
||||||
'let l = [1, 2, 3, 4]',
|
'let l = [1, 2, 3, 4]',
|
||||||
'lockvar! l',
|
'lockvar! l',
|
||||||
'$put =string(l)',
|
'$put =string(l)',
|
||||||
@@ -691,7 +691,7 @@ describe('list and dictionary types', function()
|
|||||||
'let l[1:2] = [0, 1]',
|
'let l[1:2] = [0, 1]',
|
||||||
'$put =string(l)')
|
'$put =string(l)')
|
||||||
expect([=[
|
expect([=[
|
||||||
|
|
||||||
[1, 2, 3, 4]
|
[1, 2, 3, 4]
|
||||||
[1, 2, 3, 4]
|
[1, 2, 3, 4]
|
||||||
[1, 2, 3, 4]
|
[1, 2, 3, 4]
|
||||||
@@ -708,7 +708,7 @@ describe('list and dictionary types', function()
|
|||||||
$put ='exists g:footest#x:'.exists('g:footest#x')
|
$put ='exists g:footest#x:'.exists('g:footest#x')
|
||||||
$put ='g:footest#x: '.g:footest#x]])
|
$put ='g:footest#x: '.g:footest#x]])
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
locked g:footest#x:-1
|
locked g:footest#x:-1
|
||||||
exists g:footest#x:0
|
exists g:footest#x:0
|
||||||
g:footest#x: 1]])
|
g:footest#x: 1]])
|
||||||
@@ -749,9 +749,9 @@ describe('list and dictionary types', function()
|
|||||||
$put ='caught ' . v:exception
|
$put ='caught ' . v:exception
|
||||||
endtry
|
endtry
|
||||||
endfunction]])
|
endfunction]])
|
||||||
execute('call Test(1, 2, [3, 4], {5: 6})')
|
feed_command('call Test(1, 2, [3, 4], {5: 6})')
|
||||||
expect([=[
|
expect([=[
|
||||||
|
|
||||||
caught a:000
|
caught a:000
|
||||||
caught a:000[0]
|
caught a:000[0]
|
||||||
caught a:000[2]
|
caught a:000[2]
|
||||||
@@ -779,7 +779,7 @@ describe('list and dictionary types', function()
|
|||||||
$put =string(sort(copy(l), 'i'))
|
$put =string(sort(copy(l), 'i'))
|
||||||
$put =string(sort(copy(l)))]=])
|
$put =string(sort(copy(l)))]=])
|
||||||
expect([=[
|
expect([=[
|
||||||
|
|
||||||
['-0', 'A11', 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2], 'x8', [0, 1, 2], 1.5]
|
['-0', 'A11', 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2], 'x8', [0, 1, 2], 1.5]
|
||||||
[1.5, [0, 1, 2], 'x8', [0, 1, 2], 'foo', 'foo6', 'foo', 4, 'xaaa', 2, 2, 'A11', '-0']
|
[1.5, [0, 1, 2], 'x8', [0, 1, 2], 'foo', 'foo6', 'foo', 4, 'xaaa', 2, 2, 'A11', '-0']
|
||||||
[1.5, [0, 1, 2], 'x8', [0, 1, 2], 'foo', 'foo6', 'foo', 4, 'xaaa', 2, 2, 'A11', '-0']
|
[1.5, [0, 1, 2], 'x8', [0, 1, 2], 'foo', 'foo6', 'foo', 4, 'xaaa', 2, 2, 'A11', '-0']
|
||||||
@@ -805,7 +805,7 @@ describe('list and dictionary types', function()
|
|||||||
$put =string(split('abc', '\zs'))
|
$put =string(split('abc', '\zs'))
|
||||||
$put =string(split('abc', '\zs', 1))]])
|
$put =string(split('abc', '\zs', 1))]])
|
||||||
expect([=[
|
expect([=[
|
||||||
|
|
||||||
['aa', 'bb']
|
['aa', 'bb']
|
||||||
['aa', 'bb']
|
['aa', 'bb']
|
||||||
['', 'aa', 'bb', '']
|
['', 'aa', 'bb', '']
|
||||||
@@ -827,7 +827,7 @@ describe('list and dictionary types', function()
|
|||||||
$put =(l != deepcopy(l))
|
$put =(l != deepcopy(l))
|
||||||
$put =(d != deepcopy(d))]])
|
$put =(d != deepcopy(d))]])
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
1
|
1
|
||||||
1
|
1
|
||||||
0
|
0
|
||||||
@@ -845,7 +845,7 @@ describe('list and dictionary types', function()
|
|||||||
$put =(l == lcopy)
|
$put =(l == lcopy)
|
||||||
$put =(dict4 == dict4copy)]])
|
$put =(dict4 == dict4copy)]])
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
1
|
1
|
||||||
1]])
|
1]])
|
||||||
end)
|
end)
|
||||||
@@ -856,7 +856,7 @@ describe('list and dictionary types', function()
|
|||||||
call extend(l, l)
|
call extend(l, l)
|
||||||
$put =string(l)]])
|
$put =string(l)]])
|
||||||
expect([=[
|
expect([=[
|
||||||
|
|
||||||
[1, 2, 3, 4, 5, 1, 2, 3, 4, 5]]=])
|
[1, 2, 3, 4, 5, 1, 2, 3, 4, 5]]=])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -866,7 +866,7 @@ describe('list and dictionary types', function()
|
|||||||
call extend(d, d)
|
call extend(d, d)
|
||||||
$put =string(d)]])
|
$put =string(d)]])
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
{'a': {'b': 'B'}}]])
|
{'a': {'b': 'B'}}]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -881,7 +881,7 @@ describe('list and dictionary types', function()
|
|||||||
endtry
|
endtry
|
||||||
$put =string(d)]])
|
$put =string(d)]])
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
Vim(call):E737: a
|
Vim(call):E737: a
|
||||||
{'a': {'b': 'B'}}]])
|
{'a': {'b': 'B'}}]])
|
||||||
end)
|
end)
|
||||||
@@ -892,29 +892,29 @@ describe('list and dictionary types', function()
|
|||||||
let l[:] = [1, 2]
|
let l[:] = [1, 2]
|
||||||
$put =string(l)]])
|
$put =string(l)]])
|
||||||
expect([=[
|
expect([=[
|
||||||
|
|
||||||
[1, 2]]=])
|
[1, 2]]=])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('vim patch 7.3.637', function()
|
it('vim patch 7.3.637', function()
|
||||||
execute('let a = "No error caught"')
|
feed_command('let a = "No error caught"')
|
||||||
execute('try')
|
feed_command('try')
|
||||||
execute(' foldopen')
|
feed_command(' foldopen')
|
||||||
execute('catch')
|
feed_command('catch')
|
||||||
execute(" let a = matchstr(v:exception,'^[^ ]*')")
|
feed_command(" let a = matchstr(v:exception,'^[^ ]*')")
|
||||||
execute('endtry')
|
feed_command('endtry')
|
||||||
feed('o<C-R>=a<CR><esc>')
|
feed('o<C-R>=a<CR><esc>')
|
||||||
execute('lang C')
|
feed_command('lang C')
|
||||||
execute('redir => a')
|
feed_command('redir => a')
|
||||||
-- The test failes if this is not in one line.
|
-- The test failes if this is not in one line.
|
||||||
execute("try|foobar|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry")
|
feed_command("try|foobar|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry")
|
||||||
execute('redir END')
|
feed_command('redir END')
|
||||||
feed('o<C-R>=a<CR><esc>')
|
feed('o<C-R>=a<CR><esc>')
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
Vim(foldopen):E490:
|
Vim(foldopen):E490:
|
||||||
|
|
||||||
|
|
||||||
Error detected while processing :
|
Error detected while processing :
|
||||||
E492: Not an editor command: foobar|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry
|
E492: Not an editor command: foobar|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry
|
||||||
]])
|
]])
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
-- Tests for :sort command.
|
-- Tests for :sort command.
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local insert, execute, clear, expect, eq, eval, source = helpers.insert,
|
|
||||||
helpers.execute, helpers.clear, helpers.expect, helpers.eq, helpers.eval,
|
local insert, command, clear, expect, eq, wait = helpers.insert,
|
||||||
helpers.source
|
helpers.command, helpers.clear, helpers.expect, helpers.eq, helpers.wait
|
||||||
|
local exc_exec = helpers.exc_exec
|
||||||
|
|
||||||
describe(':sort', function()
|
describe(':sort', function()
|
||||||
local text = [[
|
local text = [[
|
||||||
@@ -26,9 +27,10 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('alphabetical', function()
|
it('alphabetical', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute('sort')
|
wait()
|
||||||
|
command('sort')
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
123b
|
123b
|
||||||
a
|
a
|
||||||
a122
|
a122
|
||||||
@@ -65,12 +67,13 @@ describe(':sort', function()
|
|||||||
b321
|
b321
|
||||||
b321b
|
b321b
|
||||||
]])
|
]])
|
||||||
execute('sort n')
|
wait()
|
||||||
|
command('sort n')
|
||||||
expect([[
|
expect([[
|
||||||
abc
|
abc
|
||||||
ab
|
ab
|
||||||
a
|
a
|
||||||
|
|
||||||
-24
|
-24
|
||||||
x-22
|
x-22
|
||||||
0
|
0
|
||||||
@@ -89,9 +92,10 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('hexadecimal', function()
|
it('hexadecimal', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute('sort x')
|
wait()
|
||||||
|
command('sort x')
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
a
|
a
|
||||||
ab
|
ab
|
||||||
abc
|
abc
|
||||||
@@ -110,9 +114,10 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('alphabetical, unique', function()
|
it('alphabetical, unique', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute('sort u')
|
wait()
|
||||||
|
command('sort u')
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
123b
|
123b
|
||||||
a
|
a
|
||||||
a122
|
a122
|
||||||
@@ -130,7 +135,8 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('alphabetical, reverse', function()
|
it('alphabetical, reverse', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute('sort!')
|
wait()
|
||||||
|
command('sort!')
|
||||||
expect([[
|
expect([[
|
||||||
c321d
|
c321d
|
||||||
c123d
|
c123d
|
||||||
@@ -151,7 +157,8 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('numerical, reverse', function()
|
it('numerical, reverse', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute('sort! n')
|
wait()
|
||||||
|
command('sort! n')
|
||||||
expect([[
|
expect([[
|
||||||
b322b
|
b322b
|
||||||
b321b
|
b321b
|
||||||
@@ -164,7 +171,7 @@ describe(':sort', function()
|
|||||||
b123
|
b123
|
||||||
a123
|
a123
|
||||||
a122
|
a122
|
||||||
|
|
||||||
a
|
a
|
||||||
ab
|
ab
|
||||||
abc]])
|
abc]])
|
||||||
@@ -172,7 +179,8 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('unique, reverse', function()
|
it('unique, reverse', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute('sort! u')
|
wait()
|
||||||
|
command('sort! u')
|
||||||
expect([[
|
expect([[
|
||||||
c321d
|
c321d
|
||||||
c123d
|
c123d
|
||||||
@@ -192,12 +200,13 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('octal', function()
|
it('octal', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute('sort o')
|
wait()
|
||||||
|
command('sort o')
|
||||||
expect([[
|
expect([[
|
||||||
abc
|
abc
|
||||||
ab
|
ab
|
||||||
a
|
a
|
||||||
|
|
||||||
a122
|
a122
|
||||||
a123
|
a123
|
||||||
b123
|
b123
|
||||||
@@ -213,7 +222,8 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('reverse, hexadecimal', function()
|
it('reverse, hexadecimal', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute('sort! x')
|
wait()
|
||||||
|
command('sort! x')
|
||||||
expect([[
|
expect([[
|
||||||
c321d
|
c321d
|
||||||
c123d
|
c123d
|
||||||
@@ -234,10 +244,11 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('alphabetical, skip first character', function()
|
it('alphabetical, skip first character', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute('sort/./')
|
wait()
|
||||||
|
command('sort/./')
|
||||||
expect([[
|
expect([[
|
||||||
a
|
a
|
||||||
|
|
||||||
a122
|
a122
|
||||||
a123
|
a123
|
||||||
b123
|
b123
|
||||||
@@ -255,11 +266,12 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('alphabetical, skip first 2 characters', function()
|
it('alphabetical, skip first 2 characters', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute('sort/../')
|
wait()
|
||||||
|
command('sort/../')
|
||||||
expect([[
|
expect([[
|
||||||
ab
|
ab
|
||||||
a
|
a
|
||||||
|
|
||||||
a321
|
a321
|
||||||
b321
|
b321
|
||||||
b321
|
b321
|
||||||
@@ -276,11 +288,12 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('alphabetical, unique, skip first 2 characters', function()
|
it('alphabetical, unique, skip first 2 characters', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute('sort/../u')
|
wait()
|
||||||
|
command('sort/../u')
|
||||||
expect([[
|
expect([[
|
||||||
ab
|
ab
|
||||||
a
|
a
|
||||||
|
|
||||||
a321
|
a321
|
||||||
b321
|
b321
|
||||||
b321b
|
b321b
|
||||||
@@ -296,12 +309,13 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('numerical, skip first character', function()
|
it('numerical, skip first character', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute('sort/./n')
|
wait()
|
||||||
|
command('sort/./n')
|
||||||
expect([[
|
expect([[
|
||||||
abc
|
abc
|
||||||
ab
|
ab
|
||||||
a
|
a
|
||||||
|
|
||||||
a122
|
a122
|
||||||
a123
|
a123
|
||||||
b123
|
b123
|
||||||
@@ -317,9 +331,10 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('alphabetical, sort on first character', function()
|
it('alphabetical, sort on first character', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute('sort/./r')
|
wait()
|
||||||
|
command('sort/./r')
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
123b
|
123b
|
||||||
abc
|
abc
|
||||||
ab
|
ab
|
||||||
@@ -338,10 +353,11 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('alphabetical, sort on first 2 characters', function()
|
it('alphabetical, sort on first 2 characters', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute('sort/../r')
|
wait()
|
||||||
|
command('sort/../r')
|
||||||
expect([[
|
expect([[
|
||||||
a
|
a
|
||||||
|
|
||||||
123b
|
123b
|
||||||
a123
|
a123
|
||||||
a122
|
a122
|
||||||
@@ -359,7 +375,8 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('numerical, sort on first character', function()
|
it('numerical, sort on first character', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute('sort/./rn')
|
wait()
|
||||||
|
command('sort/./rn')
|
||||||
expect([[
|
expect([[
|
||||||
abc
|
abc
|
||||||
ab
|
ab
|
||||||
@@ -380,12 +397,13 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('alphabetical, skip past first digit', function()
|
it('alphabetical, skip past first digit', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute([[sort/\d/]])
|
wait()
|
||||||
|
command([[sort/\d/]])
|
||||||
expect([[
|
expect([[
|
||||||
abc
|
abc
|
||||||
ab
|
ab
|
||||||
a
|
a
|
||||||
|
|
||||||
a321
|
a321
|
||||||
b321
|
b321
|
||||||
b321
|
b321
|
||||||
@@ -401,12 +419,13 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('alphabetical, sort on first digit', function()
|
it('alphabetical, sort on first digit', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute([[sort/\d/r]])
|
wait()
|
||||||
|
command([[sort/\d/r]])
|
||||||
expect([[
|
expect([[
|
||||||
abc
|
abc
|
||||||
ab
|
ab
|
||||||
a
|
a
|
||||||
|
|
||||||
a123
|
a123
|
||||||
a122
|
a122
|
||||||
b123
|
b123
|
||||||
@@ -422,12 +441,13 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('numerical, skip past first digit', function()
|
it('numerical, skip past first digit', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute([[sort/\d/n]])
|
wait()
|
||||||
|
command([[sort/\d/n]])
|
||||||
expect([[
|
expect([[
|
||||||
abc
|
abc
|
||||||
ab
|
ab
|
||||||
a
|
a
|
||||||
|
|
||||||
a321
|
a321
|
||||||
b321
|
b321
|
||||||
c321d
|
c321d
|
||||||
@@ -443,12 +463,13 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('numerical, sort on first digit', function()
|
it('numerical, sort on first digit', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute([[sort/\d/rn]])
|
wait()
|
||||||
|
command([[sort/\d/rn]])
|
||||||
expect([[
|
expect([[
|
||||||
abc
|
abc
|
||||||
ab
|
ab
|
||||||
a
|
a
|
||||||
|
|
||||||
a123
|
a123
|
||||||
a122
|
a122
|
||||||
b123
|
b123
|
||||||
@@ -464,12 +485,13 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('alphabetical, skip past first 2 digits', function()
|
it('alphabetical, skip past first 2 digits', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute([[sort/\d\d/]])
|
wait()
|
||||||
|
command([[sort/\d\d/]])
|
||||||
expect([[
|
expect([[
|
||||||
abc
|
abc
|
||||||
ab
|
ab
|
||||||
a
|
a
|
||||||
|
|
||||||
a321
|
a321
|
||||||
b321
|
b321
|
||||||
b321
|
b321
|
||||||
@@ -485,12 +507,13 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('numerical, skip past first 2 digits', function()
|
it('numerical, skip past first 2 digits', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute([[sort/\d\d/n]])
|
wait()
|
||||||
|
command([[sort/\d\d/n]])
|
||||||
expect([[
|
expect([[
|
||||||
abc
|
abc
|
||||||
ab
|
ab
|
||||||
a
|
a
|
||||||
|
|
||||||
a321
|
a321
|
||||||
b321
|
b321
|
||||||
c321d
|
c321d
|
||||||
@@ -506,12 +529,13 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('hexadecimal, skip past first 2 digits', function()
|
it('hexadecimal, skip past first 2 digits', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute([[sort/\d\d/x]])
|
wait()
|
||||||
|
command([[sort/\d\d/x]])
|
||||||
expect([[
|
expect([[
|
||||||
abc
|
abc
|
||||||
ab
|
ab
|
||||||
a
|
a
|
||||||
|
|
||||||
a321
|
a321
|
||||||
b321
|
b321
|
||||||
b321
|
b321
|
||||||
@@ -527,12 +551,13 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('alpha, on first 2 digits', function()
|
it('alpha, on first 2 digits', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute([[sort/\d\d/r]])
|
wait()
|
||||||
|
command([[sort/\d\d/r]])
|
||||||
expect([[
|
expect([[
|
||||||
abc
|
abc
|
||||||
ab
|
ab
|
||||||
a
|
a
|
||||||
|
|
||||||
a123
|
a123
|
||||||
a122
|
a122
|
||||||
b123
|
b123
|
||||||
@@ -548,12 +573,13 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('numeric, on first 2 digits', function()
|
it('numeric, on first 2 digits', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute([[sort/\d\d/rn]])
|
wait()
|
||||||
|
command([[sort/\d\d/rn]])
|
||||||
expect([[
|
expect([[
|
||||||
abc
|
abc
|
||||||
ab
|
ab
|
||||||
a
|
a
|
||||||
|
|
||||||
a123
|
a123
|
||||||
a122
|
a122
|
||||||
b123
|
b123
|
||||||
@@ -569,12 +595,13 @@ describe(':sort', function()
|
|||||||
|
|
||||||
it('hexadecimal, on first 2 digits', function()
|
it('hexadecimal, on first 2 digits', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
execute([[sort/\d\d/rx]])
|
wait()
|
||||||
|
command([[sort/\d\d/rx]])
|
||||||
expect([[
|
expect([[
|
||||||
abc
|
abc
|
||||||
ab
|
ab
|
||||||
a
|
a
|
||||||
|
|
||||||
a123
|
a123
|
||||||
a122
|
a122
|
||||||
b123
|
b123
|
||||||
@@ -591,13 +618,7 @@ describe(':sort', function()
|
|||||||
it('fails with wrong arguments', function()
|
it('fails with wrong arguments', function()
|
||||||
insert(text)
|
insert(text)
|
||||||
-- This should fail with "E474: Invalid argument".
|
-- This should fail with "E474: Invalid argument".
|
||||||
source([[
|
eq('Vim(sort):E474: Invalid argument', exc_exec('sort no'))
|
||||||
try
|
|
||||||
sort no
|
|
||||||
catch
|
|
||||||
let tmpvar = v:exception
|
|
||||||
endtry]])
|
|
||||||
eq('Vim(sort):E474: Invalid argument', eval('tmpvar'))
|
|
||||||
expect(text)
|
expect(text)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -617,7 +638,8 @@ describe(':sort', function()
|
|||||||
0b100010
|
0b100010
|
||||||
0b100100
|
0b100100
|
||||||
0b100010]])
|
0b100010]])
|
||||||
execute([[sort b]])
|
wait()
|
||||||
|
command([[sort b]])
|
||||||
expect([[
|
expect([[
|
||||||
0b000000
|
0b000000
|
||||||
0b001000
|
0b001000
|
||||||
@@ -651,7 +673,8 @@ describe(':sort', function()
|
|||||||
0b101010
|
0b101010
|
||||||
0b000000
|
0b000000
|
||||||
b0b111000]])
|
b0b111000]])
|
||||||
execute([[sort b]])
|
wait()
|
||||||
|
command([[sort b]])
|
||||||
expect([[
|
expect([[
|
||||||
0b000000
|
0b000000
|
||||||
a0b001000
|
a0b001000
|
||||||
@@ -677,7 +700,8 @@ describe(':sort', function()
|
|||||||
1.15e-6
|
1.15e-6
|
||||||
-1.1e3
|
-1.1e3
|
||||||
-1.01e3]])
|
-1.01e3]])
|
||||||
execute([[sort f]])
|
wait()
|
||||||
|
command([[sort f]])
|
||||||
expect([[
|
expect([[
|
||||||
-1.1e3
|
-1.1e3
|
||||||
-1.01e3
|
-1.01e3
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
|
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
|
||||||
local clear, execute, expect = helpers.clear, helpers.execute, 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
|
if helpers.pending_win32(pending) then return end
|
||||||
@@ -15,44 +15,44 @@ end
|
|||||||
describe("spell checking with 'encoding' set to utf-8", function()
|
describe("spell checking with 'encoding' set to utf-8", function()
|
||||||
setup(function()
|
setup(function()
|
||||||
clear()
|
clear()
|
||||||
execute("syntax off")
|
feed_command("syntax off")
|
||||||
write_latin1('Xtest1.aff',[[
|
write_latin1('Xtest1.aff',[[
|
||||||
SET ISO8859-1
|
SET ISO8859-1
|
||||||
TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ
|
TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ
|
||||||
|
|
||||||
FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
||||||
LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
||||||
UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
|
UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
|
||||||
|
|
||||||
SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ¿
|
SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ¿
|
||||||
SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep?
|
SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep?
|
||||||
|
|
||||||
MIDWORD '-
|
MIDWORD '-
|
||||||
|
|
||||||
KEP =
|
KEP =
|
||||||
RAR ?
|
RAR ?
|
||||||
BAD !
|
BAD !
|
||||||
|
|
||||||
PFX I N 1
|
PFX I N 1
|
||||||
PFX I 0 in .
|
PFX I 0 in .
|
||||||
|
|
||||||
PFX O Y 1
|
PFX O Y 1
|
||||||
PFX O 0 out .
|
PFX O 0 out .
|
||||||
|
|
||||||
SFX S Y 2
|
SFX S Y 2
|
||||||
SFX S 0 s [^s]
|
SFX S 0 s [^s]
|
||||||
SFX S 0 es s
|
SFX S 0 es s
|
||||||
|
|
||||||
SFX N N 3
|
SFX N N 3
|
||||||
SFX N 0 en [^n]
|
SFX N 0 en [^n]
|
||||||
SFX N 0 nen n
|
SFX N 0 nen n
|
||||||
SFX N 0 n .
|
SFX N 0 n .
|
||||||
|
|
||||||
REP 3
|
REP 3
|
||||||
REP g ch
|
REP g ch
|
||||||
REP ch g
|
REP ch g
|
||||||
REP svp s.v.p.
|
REP svp s.v.p.
|
||||||
|
|
||||||
MAP 9
|
MAP 9
|
||||||
MAP aàáâãäå
|
MAP aàáâãäå
|
||||||
MAP eèéêë
|
MAP eèéêë
|
||||||
@@ -79,39 +79,39 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
]])
|
]])
|
||||||
write_latin1('Xtest2.aff', [[
|
write_latin1('Xtest2.aff', [[
|
||||||
SET ISO8859-1
|
SET ISO8859-1
|
||||||
|
|
||||||
FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
||||||
LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
||||||
UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
|
UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
|
||||||
|
|
||||||
PFXPOSTPONE
|
PFXPOSTPONE
|
||||||
|
|
||||||
MIDWORD '-
|
MIDWORD '-
|
||||||
|
|
||||||
KEP =
|
KEP =
|
||||||
RAR ?
|
RAR ?
|
||||||
BAD !
|
BAD !
|
||||||
|
|
||||||
PFX I N 1
|
PFX I N 1
|
||||||
PFX I 0 in .
|
PFX I 0 in .
|
||||||
|
|
||||||
PFX O Y 1
|
PFX O Y 1
|
||||||
PFX O 0 out [a-z]
|
PFX O 0 out [a-z]
|
||||||
|
|
||||||
SFX S Y 2
|
SFX S Y 2
|
||||||
SFX S 0 s [^s]
|
SFX S 0 s [^s]
|
||||||
SFX S 0 es s
|
SFX S 0 es s
|
||||||
|
|
||||||
SFX N N 3
|
SFX N N 3
|
||||||
SFX N 0 en [^n]
|
SFX N 0 en [^n]
|
||||||
SFX N 0 nen n
|
SFX N 0 nen n
|
||||||
SFX N 0 n .
|
SFX N 0 n .
|
||||||
|
|
||||||
REP 3
|
REP 3
|
||||||
REP g ch
|
REP g ch
|
||||||
REP ch g
|
REP ch g
|
||||||
REP svp s.v.p.
|
REP svp s.v.p.
|
||||||
|
|
||||||
MAP 9
|
MAP 9
|
||||||
MAP aàáâãäå
|
MAP aàáâãäå
|
||||||
MAP eèéêë
|
MAP eèéêë
|
||||||
@@ -125,7 +125,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
]])
|
]])
|
||||||
write_latin1('Xtest3.aff', [[
|
write_latin1('Xtest3.aff', [[
|
||||||
SET ISO8859-1
|
SET ISO8859-1
|
||||||
|
|
||||||
COMPOUNDMIN 3
|
COMPOUNDMIN 3
|
||||||
COMPOUNDRULE m*
|
COMPOUNDRULE m*
|
||||||
NEEDCOMPOUND x
|
NEEDCOMPOUND x
|
||||||
@@ -139,21 +139,21 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
]])
|
]])
|
||||||
write_latin1('Xtest4.aff', [[
|
write_latin1('Xtest4.aff', [[
|
||||||
SET ISO8859-1
|
SET ISO8859-1
|
||||||
|
|
||||||
FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
||||||
LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
||||||
UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
|
UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
|
||||||
|
|
||||||
COMPOUNDRULE m+
|
COMPOUNDRULE m+
|
||||||
COMPOUNDRULE sm*e
|
COMPOUNDRULE sm*e
|
||||||
COMPOUNDRULE sm+
|
COMPOUNDRULE sm+
|
||||||
COMPOUNDMIN 3
|
COMPOUNDMIN 3
|
||||||
COMPOUNDWORDMAX 3
|
COMPOUNDWORDMAX 3
|
||||||
COMPOUNDFORBIDFLAG t
|
COMPOUNDFORBIDFLAG t
|
||||||
|
|
||||||
COMPOUNDSYLMAX 5
|
COMPOUNDSYLMAX 5
|
||||||
SYLLABLE aáeéiíoóöõuúüûy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui
|
SYLLABLE aáeéiíoóöõuúüûy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui
|
||||||
|
|
||||||
MAP 9
|
MAP 9
|
||||||
MAP aàáâãäå
|
MAP aàáâãäå
|
||||||
MAP eèéêë
|
MAP eèéêë
|
||||||
@@ -164,23 +164,23 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
MAP cç
|
MAP cç
|
||||||
MAP yÿý
|
MAP yÿý
|
||||||
MAP sß
|
MAP sß
|
||||||
|
|
||||||
NEEDAFFIX x
|
NEEDAFFIX x
|
||||||
|
|
||||||
PFXPOSTPONE
|
PFXPOSTPONE
|
||||||
|
|
||||||
MIDWORD '-
|
MIDWORD '-
|
||||||
|
|
||||||
SFX q N 1
|
SFX q N 1
|
||||||
SFX q 0 -ok .
|
SFX q 0 -ok .
|
||||||
|
|
||||||
SFX a Y 2
|
SFX a Y 2
|
||||||
SFX a 0 s .
|
SFX a 0 s .
|
||||||
SFX a 0 ize/t .
|
SFX a 0 ize/t .
|
||||||
|
|
||||||
PFX p N 1
|
PFX p N 1
|
||||||
PFX p 0 pre .
|
PFX p 0 pre .
|
||||||
|
|
||||||
PFX P N 1
|
PFX P N 1
|
||||||
PFX P 0 nou .
|
PFX P 0 nou .
|
||||||
]])
|
]])
|
||||||
@@ -196,28 +196,28 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
]])
|
]])
|
||||||
write_latin1('Xtest5.aff', [[
|
write_latin1('Xtest5.aff', [[
|
||||||
SET ISO8859-1
|
SET ISO8859-1
|
||||||
|
|
||||||
FLAG long
|
FLAG long
|
||||||
|
|
||||||
NEEDAFFIX !!
|
NEEDAFFIX !!
|
||||||
|
|
||||||
COMPOUNDRULE ssmm*ee
|
COMPOUNDRULE ssmm*ee
|
||||||
|
|
||||||
NEEDCOMPOUND xx
|
NEEDCOMPOUND xx
|
||||||
COMPOUNDPERMITFLAG pp
|
COMPOUNDPERMITFLAG pp
|
||||||
|
|
||||||
SFX 13 Y 1
|
SFX 13 Y 1
|
||||||
SFX 13 0 bork .
|
SFX 13 0 bork .
|
||||||
|
|
||||||
SFX a1 Y 1
|
SFX a1 Y 1
|
||||||
SFX a1 0 a1 .
|
SFX a1 0 a1 .
|
||||||
|
|
||||||
SFX aé Y 1
|
SFX aé Y 1
|
||||||
SFX aé 0 aé .
|
SFX aé 0 aé .
|
||||||
|
|
||||||
PFX zz Y 1
|
PFX zz Y 1
|
||||||
PFX zz 0 pre/pp .
|
PFX zz 0 pre/pp .
|
||||||
|
|
||||||
PFX yy Y 1
|
PFX yy Y 1
|
||||||
PFX yy 0 nou .
|
PFX yy 0 nou .
|
||||||
]])
|
]])
|
||||||
@@ -231,26 +231,26 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
]])
|
]])
|
||||||
write_latin1('Xtest6.aff', [[
|
write_latin1('Xtest6.aff', [[
|
||||||
SET ISO8859-1
|
SET ISO8859-1
|
||||||
|
|
||||||
FLAG caplong
|
FLAG caplong
|
||||||
|
|
||||||
NEEDAFFIX A!
|
NEEDAFFIX A!
|
||||||
|
|
||||||
COMPOUNDRULE sMm*Ee
|
COMPOUNDRULE sMm*Ee
|
||||||
|
|
||||||
NEEDCOMPOUND Xx
|
NEEDCOMPOUND Xx
|
||||||
|
|
||||||
COMPOUNDPERMITFLAG p
|
COMPOUNDPERMITFLAG p
|
||||||
|
|
||||||
SFX N3 Y 1
|
SFX N3 Y 1
|
||||||
SFX N3 0 bork .
|
SFX N3 0 bork .
|
||||||
|
|
||||||
SFX A1 Y 1
|
SFX A1 Y 1
|
||||||
SFX A1 0 a1 .
|
SFX A1 0 a1 .
|
||||||
|
|
||||||
SFX Aé Y 1
|
SFX Aé Y 1
|
||||||
SFX Aé 0 aé .
|
SFX Aé 0 aé .
|
||||||
|
|
||||||
PFX Zz Y 1
|
PFX Zz Y 1
|
||||||
PFX Zz 0 pre/p .
|
PFX Zz 0 pre/p .
|
||||||
]])
|
]])
|
||||||
@@ -264,29 +264,29 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
]])
|
]])
|
||||||
write_latin1('Xtest7.aff', [[
|
write_latin1('Xtest7.aff', [[
|
||||||
SET ISO8859-1
|
SET ISO8859-1
|
||||||
|
|
||||||
FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
||||||
LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
||||||
UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
|
UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
|
||||||
|
|
||||||
FLAG num
|
FLAG num
|
||||||
|
|
||||||
NEEDAFFIX 9999
|
NEEDAFFIX 9999
|
||||||
|
|
||||||
COMPOUNDRULE 2,77*123
|
COMPOUNDRULE 2,77*123
|
||||||
|
|
||||||
NEEDCOMPOUND 1
|
NEEDCOMPOUND 1
|
||||||
COMPOUNDPERMITFLAG 432
|
COMPOUNDPERMITFLAG 432
|
||||||
|
|
||||||
SFX 61003 Y 1
|
SFX 61003 Y 1
|
||||||
SFX 61003 0 meat .
|
SFX 61003 0 meat .
|
||||||
|
|
||||||
SFX 391 Y 1
|
SFX 391 Y 1
|
||||||
SFX 391 0 a1 .
|
SFX 391 0 a1 .
|
||||||
|
|
||||||
SFX 111 Y 1
|
SFX 111 Y 1
|
||||||
SFX 111 0 aé .
|
SFX 111 0 aé .
|
||||||
|
|
||||||
PFX 17 Y 1
|
PFX 17 Y 1
|
||||||
PFX 17 0 pre/432 .
|
PFX 17 0 pre/432 .
|
||||||
]])
|
]])
|
||||||
@@ -300,7 +300,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
]])
|
]])
|
||||||
write_latin1('Xtest8.aff', [[
|
write_latin1('Xtest8.aff', [[
|
||||||
SET ISO8859-1
|
SET ISO8859-1
|
||||||
|
|
||||||
NOSPLITSUGS
|
NOSPLITSUGS
|
||||||
]])
|
]])
|
||||||
write_latin1('Xtest8.dic', [[
|
write_latin1('Xtest8.dic', [[
|
||||||
@@ -319,37 +319,37 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
write_latin1('Xtest-sal.aff', [[
|
write_latin1('Xtest-sal.aff', [[
|
||||||
SET ISO8859-1
|
SET ISO8859-1
|
||||||
TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ
|
TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ
|
||||||
|
|
||||||
FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
||||||
LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
|
||||||
UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
|
UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
|
||||||
|
|
||||||
MIDWORD '-
|
MIDWORD '-
|
||||||
|
|
||||||
KEP =
|
KEP =
|
||||||
RAR ?
|
RAR ?
|
||||||
BAD !
|
BAD !
|
||||||
|
|
||||||
PFX I N 1
|
PFX I N 1
|
||||||
PFX I 0 in .
|
PFX I 0 in .
|
||||||
|
|
||||||
PFX O Y 1
|
PFX O Y 1
|
||||||
PFX O 0 out .
|
PFX O 0 out .
|
||||||
|
|
||||||
SFX S Y 2
|
SFX S Y 2
|
||||||
SFX S 0 s [^s]
|
SFX S 0 s [^s]
|
||||||
SFX S 0 es s
|
SFX S 0 es s
|
||||||
|
|
||||||
SFX N N 3
|
SFX N N 3
|
||||||
SFX N 0 en [^n]
|
SFX N 0 en [^n]
|
||||||
SFX N 0 nen n
|
SFX N 0 nen n
|
||||||
SFX N 0 n .
|
SFX N 0 n .
|
||||||
|
|
||||||
REP 3
|
REP 3
|
||||||
REP g ch
|
REP g ch
|
||||||
REP ch g
|
REP ch g
|
||||||
REP svp s.v.p.
|
REP svp s.v.p.
|
||||||
|
|
||||||
MAP 9
|
MAP 9
|
||||||
MAP aàáâãäå
|
MAP aàáâãäå
|
||||||
MAP eèéêë
|
MAP eèéêë
|
||||||
@@ -360,7 +360,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
MAP cç
|
MAP cç
|
||||||
MAP yÿý
|
MAP yÿý
|
||||||
MAP sß
|
MAP sß
|
||||||
|
|
||||||
SAL AH(AEIOUY)-^ *H
|
SAL AH(AEIOUY)-^ *H
|
||||||
SAL AR(AEIOUY)-^ *R
|
SAL AR(AEIOUY)-^ *R
|
||||||
SAL A(HR)^ *
|
SAL A(HR)^ *
|
||||||
@@ -550,60 +550,60 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
1good: wrong OK puts. Test the end
|
1good: wrong OK puts. Test the end
|
||||||
bad: inputs comment ok Ok. test déôl end the
|
bad: inputs comment ok Ok. test déôl end the
|
||||||
badend
|
badend
|
||||||
|
|
||||||
test2:
|
test2:
|
||||||
elequint test elekwint test elekwent asdf
|
elequint test elekwint test elekwent asdf
|
||||||
]])
|
]])
|
||||||
test_one(1, 1)
|
test_one(1, 1)
|
||||||
execute([[$put =soundfold('goobledygoook')]])
|
feed_command([[$put =soundfold('goobledygoook')]])
|
||||||
execute([[$put =soundfold('kóopërÿnôven')]])
|
feed_command([[$put =soundfold('kóopërÿnôven')]])
|
||||||
execute([[$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')
|
os.execute('cp -f Xtest-sal.aff Xtest.aff')
|
||||||
execute('mkspell! Xtest Xtest')
|
feed_command('mkspell! Xtest Xtest')
|
||||||
execute([[$put =soundfold('goobledygoook')]])
|
feed_command([[$put =soundfold('goobledygoook')]])
|
||||||
execute([[$put =soundfold('kóopërÿnôven')]])
|
feed_command([[$put =soundfold('kóopërÿnôven')]])
|
||||||
execute([[$put =soundfold('oeverloos gezwets edale')]])
|
feed_command([[$put =soundfold('oeverloos gezwets edale')]])
|
||||||
-- Also use an addition file.
|
-- Also use an addition file.
|
||||||
execute('mkspell! Xtest.utf-8.add.spl Xtest.utf-8.add')
|
feed_command('mkspell! Xtest.utf-8.add.spl Xtest.utf-8.add')
|
||||||
execute('set spellfile=Xtest.utf-8.add')
|
feed_command('set spellfile=Xtest.utf-8.add')
|
||||||
execute('/^test2:')
|
feed_command('/^test2:')
|
||||||
feed(']s')
|
feed(']s')
|
||||||
execute('let [str, a] = spellbadword()')
|
feed_command('let [str, a] = spellbadword()')
|
||||||
execute('$put =str')
|
feed_command('$put =str')
|
||||||
execute('set spl=Xtest_us.utf-8.spl')
|
feed_command('set spl=Xtest_us.utf-8.spl')
|
||||||
execute('/^test2:')
|
feed_command('/^test2:')
|
||||||
feed(']smm')
|
feed(']smm')
|
||||||
execute('let [str, a] = spellbadword()')
|
feed_command('let [str, a] = spellbadword()')
|
||||||
execute('$put =str')
|
feed_command('$put =str')
|
||||||
feed('`m]s')
|
feed('`m]s')
|
||||||
execute('let [str, a] = spellbadword()')
|
feed_command('let [str, a] = spellbadword()')
|
||||||
execute('$put =str')
|
feed_command('$put =str')
|
||||||
execute('set spl=Xtest_gb.utf-8.spl')
|
feed_command('set spl=Xtest_gb.utf-8.spl')
|
||||||
execute('/^test2:')
|
feed_command('/^test2:')
|
||||||
feed(']smm')
|
feed(']smm')
|
||||||
execute('let [str, a] = spellbadword()')
|
feed_command('let [str, a] = spellbadword()')
|
||||||
execute('$put =str')
|
feed_command('$put =str')
|
||||||
feed('`m]s')
|
feed('`m]s')
|
||||||
execute('let [str, a] = spellbadword()')
|
feed_command('let [str, a] = spellbadword()')
|
||||||
execute('$put =str')
|
feed_command('$put =str')
|
||||||
execute('set spl=Xtest_nz.utf-8.spl')
|
feed_command('set spl=Xtest_nz.utf-8.spl')
|
||||||
execute('/^test2:')
|
feed_command('/^test2:')
|
||||||
feed(']smm')
|
feed(']smm')
|
||||||
execute('let [str, a] = spellbadword()')
|
feed_command('let [str, a] = spellbadword()')
|
||||||
execute('$put =str')
|
feed_command('$put =str')
|
||||||
feed('`m]s')
|
feed('`m]s')
|
||||||
execute('let [str, a] = spellbadword()')
|
feed_command('let [str, a] = spellbadword()')
|
||||||
execute('$put =str')
|
feed_command('$put =str')
|
||||||
execute('set spl=Xtest_ca.utf-8.spl')
|
feed_command('set spl=Xtest_ca.utf-8.spl')
|
||||||
execute('/^test2:')
|
feed_command('/^test2:')
|
||||||
feed(']smm')
|
feed(']smm')
|
||||||
execute('let [str, a] = spellbadword()')
|
feed_command('let [str, a] = spellbadword()')
|
||||||
execute('$put =str')
|
feed_command('$put =str')
|
||||||
feed('`m]s')
|
feed('`m]s')
|
||||||
execute('let [str, a] = spellbadword()')
|
feed_command('let [str, a] = spellbadword()')
|
||||||
execute('$put =str')
|
feed_command('$put =str')
|
||||||
execute('1,/^test 1-1/-1d')
|
feed_command('1,/^test 1-1/-1d')
|
||||||
expect([[
|
expect([[
|
||||||
test 1-1
|
test 1-1
|
||||||
# file: Xtest.utf-8.spl
|
# file: Xtest.utf-8.spl
|
||||||
@@ -667,7 +667,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
]])
|
]])
|
||||||
-- Postponed prefixes.
|
-- Postponed prefixes.
|
||||||
test_one(2, 1)
|
test_one(2, 1)
|
||||||
execute('1,/^test 2-1/-1d')
|
feed_command('1,/^test 2-1/-1d')
|
||||||
expect([=[
|
expect([=[
|
||||||
test 2-1
|
test 2-1
|
||||||
# file: Xtest.utf-8.spl
|
# file: Xtest.utf-8.spl
|
||||||
@@ -711,13 +711,13 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
it('part 3-3', function()
|
it('part 3-3', function()
|
||||||
insert([[
|
insert([[
|
||||||
Test rules for compounding.
|
Test rules for compounding.
|
||||||
|
|
||||||
3good: foo mï foobar foofoobar barfoo barbarfoo
|
3good: foo mï foobar foofoobar barfoo barbarfoo
|
||||||
bad: bar la foomï barmï mïfoo mïbar mïmï lala mïla lamï foola labar
|
bad: bar la foomï barmï mïfoo mïbar mïmï lala mïla lamï foola labar
|
||||||
badend
|
badend
|
||||||
]])
|
]])
|
||||||
test_one(3, 3)
|
test_one(3, 3)
|
||||||
execute('1,/^test 3-3/-1d')
|
feed_command('1,/^test 3-3/-1d')
|
||||||
expect([=[
|
expect([=[
|
||||||
test 3-3
|
test 3-3
|
||||||
# file: Xtest.utf-8.spl
|
# file: Xtest.utf-8.spl
|
||||||
@@ -755,7 +755,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
it('part 4-4', function()
|
it('part 4-4', function()
|
||||||
insert([[
|
insert([[
|
||||||
Tests for compounding.
|
Tests for compounding.
|
||||||
|
|
||||||
4good: word util bork prebork start end wordutil wordutils pro-ok
|
4good: word util bork prebork start end wordutil wordutils pro-ok
|
||||||
bork borkbork borkborkbork borkborkborkbork borkborkborkborkbork
|
bork borkbork borkborkbork borkborkborkbork borkborkborkborkbork
|
||||||
tomato tomatotomato startend startword startwordword startwordend
|
tomato tomatotomato startend startword startwordword startwordend
|
||||||
@@ -770,7 +770,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
badend
|
badend
|
||||||
]])
|
]])
|
||||||
test_one(4, 4)
|
test_one(4, 4)
|
||||||
execute('1,/^test 4-4/-1d')
|
feed_command('1,/^test 4-4/-1d')
|
||||||
expect([=[
|
expect([=[
|
||||||
test 4-4
|
test 4-4
|
||||||
# file: Xtest.utf-8.spl
|
# file: Xtest.utf-8.spl
|
||||||
@@ -823,7 +823,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
it('part 5-5', function()
|
it('part 5-5', function()
|
||||||
insert([[
|
insert([[
|
||||||
Test affix flags with two characters
|
Test affix flags with two characters
|
||||||
|
|
||||||
5good: fooa1 fooaé bar prebar barbork prebarbork startprebar
|
5good: fooa1 fooaé bar prebar barbork prebarbork startprebar
|
||||||
start end startend startmiddleend nouend
|
start end startend startmiddleend nouend
|
||||||
bad: foo fooa2 prabar probarbirk middle startmiddle middleend endstart
|
bad: foo fooa2 prabar probarbirk middle startmiddle middleend endstart
|
||||||
@@ -831,7 +831,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
badend
|
badend
|
||||||
]])
|
]])
|
||||||
test_one(5, 5)
|
test_one(5, 5)
|
||||||
execute('1,/^test 5-5/-1d')
|
feed_command('1,/^test 5-5/-1d')
|
||||||
expect([=[
|
expect([=[
|
||||||
test 5-5
|
test 5-5
|
||||||
# file: Xtest.utf-8.spl
|
# file: Xtest.utf-8.spl
|
||||||
@@ -878,7 +878,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
badend
|
badend
|
||||||
]])
|
]])
|
||||||
test_one(6, 6)
|
test_one(6, 6)
|
||||||
execute('1,/^test 6-6/-1d')
|
feed_command('1,/^test 6-6/-1d')
|
||||||
expect([=[
|
expect([=[
|
||||||
test 6-6
|
test 6-6
|
||||||
# file: Xtest.utf-8.spl
|
# file: Xtest.utf-8.spl
|
||||||
@@ -924,7 +924,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
-- Compound words.
|
-- Compound words.
|
||||||
test_one(7, 7)
|
test_one(7, 7)
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
execute('1,/^test 7-7/-1d')
|
feed_command('1,/^test 7-7/-1d')
|
||||||
expect([=[
|
expect([=[
|
||||||
test 7-7
|
test 7-7
|
||||||
# file: Xtest.utf-8.spl
|
# file: Xtest.utf-8.spl
|
||||||
@@ -968,7 +968,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
-- NOSPLITSUGS
|
-- NOSPLITSUGS
|
||||||
test_one(8, 8)
|
test_one(8, 8)
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
execute('1,/^test 8-8/-1d')
|
feed_command('1,/^test 8-8/-1d')
|
||||||
expect([=[
|
expect([=[
|
||||||
test 8-8
|
test 8-8
|
||||||
# file: Xtest.utf-8.spl
|
# file: Xtest.utf-8.spl
|
||||||
@@ -992,7 +992,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
|
|||||||
-- NOSPLITSUGS
|
-- NOSPLITSUGS
|
||||||
test_one(9, 9)
|
test_one(9, 9)
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
execute('1,/^test 9-9/-1d')
|
feed_command('1,/^test 9-9/-1d')
|
||||||
expect([=[
|
expect([=[
|
||||||
test 9-9
|
test 9-9
|
||||||
# file: Xtest.utf-8.spl
|
# file: Xtest.utf-8.spl
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
-- Tests for undo tree and :earlier and :later.
|
-- Tests for undo tree and :earlier and :later.
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
|
||||||
|
local feed_command = helpers.feed_command
|
||||||
local write_file = helpers.write_file
|
local write_file = helpers.write_file
|
||||||
local execute = helpers.execute
|
|
||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
local source = helpers.source
|
local source = helpers.source
|
||||||
local expect = helpers.expect
|
local expect = helpers.expect
|
||||||
@@ -44,7 +44,7 @@ describe('undo tree:', function()
|
|||||||
-- function to allow multiple attempts.
|
-- function to allow multiple attempts.
|
||||||
local function test_earlier_later()
|
local function test_earlier_later()
|
||||||
clear()
|
clear()
|
||||||
execute('e Xtest')
|
feed_command('e Xtest')
|
||||||
-- Assert that no undo history is present.
|
-- Assert that no undo history is present.
|
||||||
eq({}, eval('undotree().entries'))
|
eq({}, eval('undotree().entries'))
|
||||||
-- Delete three characters and undo.
|
-- Delete three characters and undo.
|
||||||
@@ -88,13 +88,13 @@ describe('undo tree:', function()
|
|||||||
feed('Ab<esc>')
|
feed('Ab<esc>')
|
||||||
feed('Ac<esc>')
|
feed('Ac<esc>')
|
||||||
expect_line('123456abc')
|
expect_line('123456abc')
|
||||||
execute('earlier 1s')
|
feed_command('earlier 1s')
|
||||||
expect_line('123456')
|
expect_line('123456')
|
||||||
execute('earlier 3s')
|
feed_command('earlier 3s')
|
||||||
expect_line('123456789')
|
expect_line('123456789')
|
||||||
execute('later 1s')
|
feed_command('later 1s')
|
||||||
expect_line('123456')
|
expect_line('123456')
|
||||||
execute('later 1h')
|
feed_command('later 1h')
|
||||||
expect_line('123456abc')
|
expect_line('123456abc')
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -103,28 +103,28 @@ describe('undo tree:', function()
|
|||||||
|
|
||||||
it('file-write specifications', function()
|
it('file-write specifications', function()
|
||||||
feed('ione one one<esc>')
|
feed('ione one one<esc>')
|
||||||
execute('w Xtest')
|
feed_command('w Xtest')
|
||||||
feed('otwo<esc>')
|
feed('otwo<esc>')
|
||||||
feed('otwo<esc>')
|
feed('otwo<esc>')
|
||||||
execute('w')
|
feed_command('w')
|
||||||
feed('othree<esc>')
|
feed('othree<esc>')
|
||||||
execute('earlier 1f')
|
feed_command('earlier 1f')
|
||||||
expect([[
|
expect([[
|
||||||
one one one
|
one one one
|
||||||
two
|
two
|
||||||
two]])
|
two]])
|
||||||
execute('earlier 1f')
|
feed_command('earlier 1f')
|
||||||
expect('one one one')
|
expect('one one one')
|
||||||
execute('earlier 1f')
|
feed_command('earlier 1f')
|
||||||
expect_empty_buffer()
|
expect_empty_buffer()
|
||||||
execute('later 1f')
|
feed_command('later 1f')
|
||||||
expect('one one one')
|
expect('one one one')
|
||||||
execute('later 1f')
|
feed_command('later 1f')
|
||||||
expect([[
|
expect([[
|
||||||
one one one
|
one one one
|
||||||
two
|
two
|
||||||
two]])
|
two]])
|
||||||
execute('later 1f')
|
feed_command('later 1f')
|
||||||
expect([[
|
expect([[
|
||||||
one one one
|
one one one
|
||||||
two
|
two
|
||||||
@@ -193,20 +193,20 @@ describe('undo tree:', function()
|
|||||||
feed('ob<esc>')
|
feed('ob<esc>')
|
||||||
feed([[o1<esc>a2<C-R>=setline('.','1234')<cr><esc>]])
|
feed([[o1<esc>a2<C-R>=setline('.','1234')<cr><esc>]])
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
a
|
a
|
||||||
b
|
b
|
||||||
12034]])
|
12034]])
|
||||||
feed('uu')
|
feed('uu')
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
a
|
a
|
||||||
b
|
b
|
||||||
1]])
|
1]])
|
||||||
feed('oc<esc>')
|
feed('oc<esc>')
|
||||||
feed([[o1<esc>a2<C-R>=setline('.','1234')<cr><esc>]])
|
feed([[o1<esc>a2<C-R>=setline('.','1234')<cr><esc>]])
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
a
|
a
|
||||||
b
|
b
|
||||||
1
|
1
|
||||||
@@ -214,16 +214,16 @@ describe('undo tree:', function()
|
|||||||
12034]])
|
12034]])
|
||||||
feed('u')
|
feed('u')
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
a
|
a
|
||||||
b
|
b
|
||||||
1
|
1
|
||||||
c
|
c
|
||||||
12]])
|
12]])
|
||||||
feed('od<esc>')
|
feed('od<esc>')
|
||||||
execute('so! Xtest.source')
|
feed_command('so! Xtest.source')
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
a
|
a
|
||||||
b
|
b
|
||||||
1
|
1
|
||||||
@@ -233,7 +233,7 @@ describe('undo tree:', function()
|
|||||||
12123]])
|
12123]])
|
||||||
feed('u')
|
feed('u')
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
a
|
a
|
||||||
b
|
b
|
||||||
1
|
1
|
||||||
@@ -246,7 +246,7 @@ describe('undo tree:', function()
|
|||||||
-- interactive use (even in Vim; see ":help :undojoin"):
|
-- interactive use (even in Vim; see ":help :undojoin"):
|
||||||
feed(normal_commands)
|
feed(normal_commands)
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
a
|
a
|
||||||
b
|
b
|
||||||
1
|
1
|
||||||
@@ -256,7 +256,7 @@ describe('undo tree:', function()
|
|||||||
12123]])
|
12123]])
|
||||||
feed('u')
|
feed('u')
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
a
|
a
|
||||||
b
|
b
|
||||||
1
|
1
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
-- Tests for tab pages
|
-- Tests for tab pages
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, insert, source, clear, execute, expect, eval, eq =
|
local feed, insert, source, clear, command, expect, eval, eq =
|
||||||
helpers.feed, helpers.insert, helpers.source, helpers.clear,
|
helpers.feed, helpers.insert, helpers.source, helpers.clear,
|
||||||
helpers.execute, helpers.expect, helpers.eval, helpers.eq
|
helpers.command, helpers.expect, helpers.eval, helpers.eq
|
||||||
|
local exc_exec = helpers.exc_exec
|
||||||
|
|
||||||
describe('tab pages', function()
|
describe('tab pages', function()
|
||||||
before_each(clear)
|
before_each(clear)
|
||||||
|
|
||||||
it('can be opened and closed', function()
|
it('can be opened and closed', function()
|
||||||
execute('tabnew')
|
command('tabnew')
|
||||||
eq(2, eval('tabpagenr()'))
|
eq(2, eval('tabpagenr()'))
|
||||||
execute('quit')
|
command('quit')
|
||||||
eq(1, eval('tabpagenr()'))
|
eq(1, eval('tabpagenr()'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ describe('tab pages', function()
|
|||||||
tabrewind
|
tabrewind
|
||||||
]])
|
]])
|
||||||
eq('this is tab page 1', eval("getline('$')"))
|
eq('this is tab page 1', eval("getline('$')"))
|
||||||
execute('tablast')
|
command('tablast')
|
||||||
eq('this is tab page 4', eval("getline('$')"))
|
eq('this is tab page 4', eval("getline('$')"))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -44,7 +45,7 @@ describe('tab pages', function()
|
|||||||
eq(100, eval('gettabvar(2, "val_num")'))
|
eq(100, eval('gettabvar(2, "val_num")'))
|
||||||
eq('SetTabVar test', eval('gettabvar(2, "val_str")'))
|
eq('SetTabVar test', eval('gettabvar(2, "val_str")'))
|
||||||
eq({'red', 'blue', 'green'}, eval('gettabvar(2, "val_list")'))
|
eq({'red', 'blue', 'green'}, eval('gettabvar(2, "val_list")'))
|
||||||
execute('tabnext 2')
|
command('tabnext 2')
|
||||||
eq(100, eval('t:val_num'))
|
eq(100, eval('t:val_num'))
|
||||||
eq('SetTabVar test', eval('t:val_str'))
|
eq('SetTabVar test', eval('t:val_str'))
|
||||||
eq({'red', 'blue', 'green'}, eval('t:val_list'))
|
eq({'red', 'blue', 'green'}, eval('t:val_list'))
|
||||||
@@ -52,8 +53,8 @@ describe('tab pages', function()
|
|||||||
|
|
||||||
it('work together with the drop feature and loaded buffers', function()
|
it('work together with the drop feature and loaded buffers', function()
|
||||||
-- Test for ":tab drop exist-file" to keep current window.
|
-- Test for ":tab drop exist-file" to keep current window.
|
||||||
execute('sp test1')
|
command('sp test1')
|
||||||
execute('tab drop test1')
|
command('tab drop test1')
|
||||||
eq(1, eval('tabpagenr("$")'))
|
eq(1, eval('tabpagenr("$")'))
|
||||||
eq(2, eval('winnr("$")'))
|
eq(2, eval('winnr("$")'))
|
||||||
eq(1, eval('winnr()'))
|
eq(1, eval('winnr()'))
|
||||||
@@ -61,8 +62,8 @@ describe('tab pages', function()
|
|||||||
|
|
||||||
it('work together with the drop feature and new files', function()
|
it('work together with the drop feature and new files', function()
|
||||||
-- Test for ":tab drop new-file" to keep current window of tabpage 1.
|
-- Test for ":tab drop new-file" to keep current window of tabpage 1.
|
||||||
execute('split')
|
command('split')
|
||||||
execute('tab drop newfile')
|
command('tab drop newfile')
|
||||||
eq(2, eval('tabpagenr("$")'))
|
eq(2, eval('tabpagenr("$")'))
|
||||||
eq(2, eval('tabpagewinnr(1, "$")'))
|
eq(2, eval('tabpagewinnr(1, "$")'))
|
||||||
eq(1, eval('tabpagewinnr(1)'))
|
eq(1, eval('tabpagewinnr(1)'))
|
||||||
@@ -71,53 +72,49 @@ describe('tab pages', function()
|
|||||||
it('work together with the drop feature and multi loaded buffers', function()
|
it('work together with the drop feature and multi loaded buffers', function()
|
||||||
-- Test for ":tab drop multi-opend-file" to keep current tabpage and
|
-- Test for ":tab drop multi-opend-file" to keep current tabpage and
|
||||||
-- window.
|
-- window.
|
||||||
execute('new test1')
|
command('new test1')
|
||||||
execute('tabnew')
|
command('tabnew')
|
||||||
execute('new test1')
|
command('new test1')
|
||||||
execute('tab drop test1')
|
command('tab drop test1')
|
||||||
eq(2, eval('tabpagenr()'))
|
eq(2, eval('tabpagenr()'))
|
||||||
eq(2, eval('tabpagewinnr(2, "$")'))
|
eq(2, eval('tabpagewinnr(2, "$")'))
|
||||||
eq(1, eval('tabpagewinnr(2)'))
|
eq(1, eval('tabpagewinnr(2)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can be navigated with :tabmove', function()
|
it('can be navigated with :tabmove', function()
|
||||||
execute('lang C')
|
command('lang C')
|
||||||
execute('for i in range(9) | tabnew | endfor')
|
command('for i in range(9) | tabnew | endfor')
|
||||||
feed('1gt')
|
feed('1gt')
|
||||||
eq(1, eval('tabpagenr()'))
|
eq(1, eval('tabpagenr()'))
|
||||||
execute('tabmove 5')
|
command('tabmove 5')
|
||||||
eq(5, eval('tabpagenr()'))
|
eq(5, eval('tabpagenr()'))
|
||||||
execute('.tabmove')
|
command('.tabmove')
|
||||||
eq(5, eval('tabpagenr()'))
|
eq(5, eval('tabpagenr()'))
|
||||||
execute('tabmove -')
|
command('tabmove -')
|
||||||
eq(4, eval('tabpagenr()'))
|
eq(4, eval('tabpagenr()'))
|
||||||
execute('tabmove +')
|
command('tabmove +')
|
||||||
eq(5, eval('tabpagenr()'))
|
eq(5, eval('tabpagenr()'))
|
||||||
execute('tabmove -2')
|
command('tabmove -2')
|
||||||
eq(3, eval('tabpagenr()'))
|
eq(3, eval('tabpagenr()'))
|
||||||
execute('tabmove +4')
|
command('tabmove +4')
|
||||||
eq(7, eval('tabpagenr()'))
|
eq(7, eval('tabpagenr()'))
|
||||||
execute('tabmove')
|
command('tabmove')
|
||||||
eq(10, eval('tabpagenr()'))
|
eq(10, eval('tabpagenr()'))
|
||||||
execute('0tabmove')
|
command('0tabmove')
|
||||||
eq(1, eval('tabpagenr()'))
|
eq(1, eval('tabpagenr()'))
|
||||||
execute('$tabmove')
|
command('$tabmove')
|
||||||
eq(10, eval('tabpagenr()'))
|
eq(10, eval('tabpagenr()'))
|
||||||
execute('tabmove 0')
|
command('tabmove 0')
|
||||||
eq(1, eval('tabpagenr()'))
|
eq(1, eval('tabpagenr()'))
|
||||||
execute('tabmove $')
|
command('tabmove $')
|
||||||
eq(10, eval('tabpagenr()'))
|
eq(10, eval('tabpagenr()'))
|
||||||
execute('3tabmove')
|
command('3tabmove')
|
||||||
eq(4, eval('tabpagenr()'))
|
eq(4, eval('tabpagenr()'))
|
||||||
execute('7tabmove 5')
|
command('7tabmove 5')
|
||||||
eq(5, eval('tabpagenr()'))
|
eq(5, eval('tabpagenr()'))
|
||||||
execute('let a="No error caught."')
|
command('let a="No error caught."')
|
||||||
execute('try')
|
eq('Vim(tabmove):E474: Invalid argument: tabmove foo',
|
||||||
execute('tabmove foo')
|
exc_exec('tabmove foo'))
|
||||||
execute('catch E474')
|
|
||||||
execute('let a="E474 caught."')
|
|
||||||
execute('endtry')
|
|
||||||
eq('E474 caught.', eval('a'))
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('can trigger certain autocommands', function()
|
it('can trigger certain autocommands', function()
|
||||||
|
|||||||
@@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local feed, insert = helpers.feed, helpers.insert
|
|
||||||
local eval, clear, execute = helpers.eval, helpers.clear, helpers.execute
|
local eval, clear, command = helpers.eval, helpers.clear, helpers.command
|
||||||
local eq, neq = helpers.eq, helpers.neq
|
local eq, neq = helpers.eq, helpers.neq
|
||||||
|
local insert = helpers.insert
|
||||||
|
local redir_exec = helpers.redir_exec
|
||||||
|
|
||||||
describe('063: Test for ":match", "matchadd()" and related functions', function()
|
describe('063: Test for ":match", "matchadd()" and related functions', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -15,12 +17,12 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
|
|||||||
|
|
||||||
-- Check that "matcharg()" returns the correct group and pattern if a match
|
-- Check that "matcharg()" returns the correct group and pattern if a match
|
||||||
-- is defined.
|
-- is defined.
|
||||||
execute("highlight MyGroup1 term=bold ctermbg=red guibg=red")
|
command("highlight MyGroup1 term=bold ctermbg=red guibg=red")
|
||||||
execute("highlight MyGroup2 term=italic ctermbg=green guibg=green")
|
command("highlight MyGroup2 term=italic ctermbg=green guibg=green")
|
||||||
execute("highlight MyGroup3 term=underline ctermbg=blue guibg=blue")
|
command("highlight MyGroup3 term=underline ctermbg=blue guibg=blue")
|
||||||
execute("match MyGroup1 /TODO/")
|
command("match MyGroup1 /TODO/")
|
||||||
execute("2match MyGroup2 /FIXME/")
|
command("2match MyGroup2 /FIXME/")
|
||||||
execute("3match MyGroup3 /XXX/")
|
command("3match MyGroup3 /XXX/")
|
||||||
eq({'MyGroup1', 'TODO'}, eval('matcharg(1)'))
|
eq({'MyGroup1', 'TODO'}, eval('matcharg(1)'))
|
||||||
eq({'MyGroup2', 'FIXME'}, eval('matcharg(2)'))
|
eq({'MyGroup2', 'FIXME'}, eval('matcharg(2)'))
|
||||||
eq({'MyGroup3', 'XXX'}, eval('matcharg(3)'))
|
eq({'MyGroup3', 'XXX'}, eval('matcharg(3)'))
|
||||||
@@ -31,18 +33,18 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
|
|||||||
eq({}, eval('matcharg(4)'))
|
eq({}, eval('matcharg(4)'))
|
||||||
|
|
||||||
-- Check that "matcharg()" returns ['', ''] if a match is not defined.
|
-- Check that "matcharg()" returns ['', ''] if a match is not defined.
|
||||||
execute("match")
|
command("match")
|
||||||
execute("2match")
|
command("2match")
|
||||||
execute("3match")
|
command("3match")
|
||||||
eq({'', ''}, eval('matcharg(1)'))
|
eq({'', ''}, eval('matcharg(1)'))
|
||||||
eq({'', ''}, eval('matcharg(2)'))
|
eq({'', ''}, eval('matcharg(2)'))
|
||||||
eq({'', ''}, eval('matcharg(3)'))
|
eq({'', ''}, eval('matcharg(3)'))
|
||||||
|
|
||||||
-- Check that "matchadd()" and "getmatches()" agree on added matches and
|
-- Check that "matchadd()" and "getmatches()" agree on added matches and
|
||||||
-- that default values apply.
|
-- that default values apply.
|
||||||
execute("let m1 = matchadd('MyGroup1', 'TODO')")
|
command("let m1 = matchadd('MyGroup1', 'TODO')")
|
||||||
execute("let m2 = matchadd('MyGroup2', 'FIXME', 42)")
|
command("let m2 = matchadd('MyGroup2', 'FIXME', 42)")
|
||||||
execute("let m3 = matchadd('MyGroup3', 'XXX', 60, 17)")
|
command("let m3 = matchadd('MyGroup3', 'XXX', 60, 17)")
|
||||||
eq({{group = 'MyGroup1', pattern = 'TODO', priority = 10, id = 4},
|
eq({{group = 'MyGroup1', pattern = 'TODO', priority = 10, id = 4},
|
||||||
{group = 'MyGroup2', pattern = 'FIXME', priority = 42, id = 5},
|
{group = 'MyGroup2', pattern = 'FIXME', priority = 42, id = 5},
|
||||||
{group = 'MyGroup3', pattern = 'XXX', priority = 60, id = 17}},
|
{group = 'MyGroup3', pattern = 'XXX', priority = 60, id = 17}},
|
||||||
@@ -50,56 +52,57 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
|
|||||||
|
|
||||||
-- Check that "matchdelete()" deletes the matches defined in the previous
|
-- Check that "matchdelete()" deletes the matches defined in the previous
|
||||||
-- test correctly.
|
-- test correctly.
|
||||||
execute("call matchdelete(m1)")
|
command("call matchdelete(m1)")
|
||||||
execute("call matchdelete(m2)")
|
command("call matchdelete(m2)")
|
||||||
execute("call matchdelete(m3)")
|
command("call matchdelete(m3)")
|
||||||
eq({}, eval('getmatches()'))
|
eq({}, eval('getmatches()'))
|
||||||
|
|
||||||
--- Check that "matchdelete()" returns 0 if successful and otherwise -1.
|
--- Check that "matchdelete()" returns 0 if successful and otherwise -1.
|
||||||
execute("let m = matchadd('MyGroup1', 'TODO')")
|
command("let m = matchadd('MyGroup1', 'TODO')")
|
||||||
eq(0, eval('matchdelete(m)'))
|
eq(0, eval('matchdelete(m)'))
|
||||||
|
|
||||||
-- matchdelete throws error and returns -1 on failure
|
-- matchdelete throws error and returns -1 on failure
|
||||||
neq(true, pcall(function() eval('matchdelete(42)') end))
|
neq(true, pcall(function() eval('matchdelete(42)') end))
|
||||||
execute("let r2 = matchdelete(42)")
|
eq('\nE803: ID not found: 42',
|
||||||
|
redir_exec("let r2 = matchdelete(42)"))
|
||||||
eq(-1, eval('r2'))
|
eq(-1, eval('r2'))
|
||||||
|
|
||||||
-- Check that "clearmatches()" clears all matches defined by ":match" and
|
-- Check that "clearmatches()" clears all matches defined by ":match" and
|
||||||
-- "matchadd()".
|
-- "matchadd()".
|
||||||
execute("let m1 = matchadd('MyGroup1', 'TODO')")
|
command("let m1 = matchadd('MyGroup1', 'TODO')")
|
||||||
execute("let m2 = matchadd('MyGroup2', 'FIXME', 42)")
|
command("let m2 = matchadd('MyGroup2', 'FIXME', 42)")
|
||||||
execute("let m3 = matchadd('MyGroup3', 'XXX', 60, 17)")
|
command("let m3 = matchadd('MyGroup3', 'XXX', 60, 17)")
|
||||||
execute("match MyGroup1 /COFFEE/")
|
command("match MyGroup1 /COFFEE/")
|
||||||
execute("2match MyGroup2 /HUMPPA/")
|
command("2match MyGroup2 /HUMPPA/")
|
||||||
execute("3match MyGroup3 /VIM/")
|
command("3match MyGroup3 /VIM/")
|
||||||
execute("call clearmatches()")
|
command("call clearmatches()")
|
||||||
eq({}, eval('getmatches()'))
|
eq({}, eval('getmatches()'))
|
||||||
|
|
||||||
-- Check that "setmatches()" restores a list of matches saved by
|
-- Check that "setmatches()" restores a list of matches saved by
|
||||||
-- "getmatches()" without changes. (Matches with equal priority must also
|
-- "getmatches()" without changes. (Matches with equal priority must also
|
||||||
-- remain in the same order.)
|
-- remain in the same order.)
|
||||||
execute("let m1 = matchadd('MyGroup1', 'TODO')")
|
command("let m1 = matchadd('MyGroup1', 'TODO')")
|
||||||
execute("let m2 = matchadd('MyGroup2', 'FIXME', 42)")
|
command("let m2 = matchadd('MyGroup2', 'FIXME', 42)")
|
||||||
execute("let m3 = matchadd('MyGroup3', 'XXX', 60, 17)")
|
command("let m3 = matchadd('MyGroup3', 'XXX', 60, 17)")
|
||||||
execute("match MyGroup1 /COFFEE/")
|
command("match MyGroup1 /COFFEE/")
|
||||||
execute("2match MyGroup2 /HUMPPA/")
|
command("2match MyGroup2 /HUMPPA/")
|
||||||
execute("3match MyGroup3 /VIM/")
|
command("3match MyGroup3 /VIM/")
|
||||||
execute("let ml = getmatches()")
|
command("let ml = getmatches()")
|
||||||
local ml = eval("ml")
|
local ml = eval("ml")
|
||||||
execute("call clearmatches()")
|
command("call clearmatches()")
|
||||||
execute("call setmatches(ml)")
|
command("call setmatches(ml)")
|
||||||
eq(ml, eval('getmatches()'))
|
eq(ml, eval('getmatches()'))
|
||||||
|
|
||||||
-- Check that "setmatches()" can correctly restore the matches from matchaddpos()
|
-- Check that "setmatches()" can correctly restore the matches from matchaddpos()
|
||||||
execute("call clearmatches()")
|
command("call clearmatches()")
|
||||||
execute("call setmatches(ml)")
|
command("call setmatches(ml)")
|
||||||
eq(ml, eval('getmatches()'))
|
eq(ml, eval('getmatches()'))
|
||||||
|
|
||||||
-- Check that "setmatches()" will not add two matches with the same ID. The
|
-- Check that "setmatches()" will not add two matches with the same ID. The
|
||||||
-- expected behaviour (for now) is to add the first match but not the
|
-- expected behaviour (for now) is to add the first match but not the
|
||||||
-- second and to return -1.
|
-- second and to return -1.
|
||||||
execute("let r1 = setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}, {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 10, 'id': 1}])")
|
eq('\nE801: ID already taken: 1',
|
||||||
feed("<cr>")
|
redir_exec("let r1 = setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}, {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 10, 'id': 1}])"))
|
||||||
eq(-1, eval("r1"))
|
eq(-1, eval("r1"))
|
||||||
eq({{group = 'MyGroup1', pattern = 'TODO', priority = 10, id = 1}}, eval('getmatches()'))
|
eq({{group = 'MyGroup1', pattern = 'TODO', priority = 10, id = 1}}, eval('getmatches()'))
|
||||||
|
|
||||||
@@ -108,18 +111,17 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
|
|||||||
-- return values.)
|
-- return values.)
|
||||||
eq(0,eval("setmatches([])"))
|
eq(0,eval("setmatches([])"))
|
||||||
eq(0,eval("setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}])"))
|
eq(0,eval("setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}])"))
|
||||||
execute("call clearmatches()")
|
command("call clearmatches()")
|
||||||
execute("let rf1 = setmatches(0)")
|
eq('\nE714: List required', redir_exec("let rf1 = setmatches(0)"))
|
||||||
eq(-1, eval('rf1'))
|
eq(-1, eval('rf1'))
|
||||||
execute("let rf2 = setmatches([0])")
|
eq('\nE474: Invalid argument', redir_exec("let rf2 = setmatches([0])"))
|
||||||
eq(-1, eval('rf2'))
|
eq(-1, eval('rf2'))
|
||||||
execute("let rf3 = setmatches([{'wrong key': 'wrong value'}])")
|
eq('\nE474: Invalid argument', redir_exec("let rf3 = setmatches([{'wrong key': 'wrong value'}])"))
|
||||||
feed("<cr>")
|
|
||||||
eq(-1, eval('rf3'))
|
eq(-1, eval('rf3'))
|
||||||
|
|
||||||
-- Check that "matchaddpos()" positions matches correctly
|
-- Check that "matchaddpos()" positions matches correctly
|
||||||
insert('abcdefghijklmnopq')
|
insert('abcdefghijklmnopq')
|
||||||
execute("call matchaddpos('MyGroup1', [[1, 5], [1, 8, 3]], 10, 3)")
|
command("call matchaddpos('MyGroup1', [[1, 5], [1, 8, 3]], 10, 3)")
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
abcd{1:e}fg{1:hij}klmnop^q |
|
abcd{1:e}fg{1:hij}klmnop^q |
|
||||||
~ |
|
~ |
|
||||||
@@ -128,9 +130,9 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
|
|||||||
|
|
|
|
||||||
]], {[1] = {background = Screen.colors.Red}}, {{bold = true, foreground = Screen.colors.Blue}})
|
]], {[1] = {background = Screen.colors.Red}}, {{bold = true, foreground = Screen.colors.Blue}})
|
||||||
|
|
||||||
execute("call clearmatches()")
|
command("call clearmatches()")
|
||||||
execute("call setline(1, 'abcdΣabcdef')")
|
command("call setline(1, 'abcdΣabcdef')")
|
||||||
execute("call matchaddpos('MyGroup1', [[1, 4, 2], [1, 9, 2]])")
|
command("call matchaddpos('MyGroup1', [[1, 4, 2], [1, 9, 2]])")
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
abc{1:dΣ}ab{1:cd}e^f |
|
abc{1:dΣ}ab{1:cd}e^f |
|
||||||
~ |
|
~ |
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local insert, source = helpers.insert, helpers.source
|
local insert, source = helpers.insert, helpers.source
|
||||||
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
local clear, expect = helpers.clear, helpers.expect
|
||||||
|
|
||||||
describe('floating point and logical operators', function()
|
describe('floating point and logical operators', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -44,14 +44,7 @@ describe('floating point and logical operators', function()
|
|||||||
$put ='abs'
|
$put ='abs'
|
||||||
$put =printf('%d', abs(1456))
|
$put =printf('%d', abs(1456))
|
||||||
$put =printf('%d', abs(-4))
|
$put =printf('%d', abs(-4))
|
||||||
]])
|
silent! $put =printf('%d', abs([1, 2, 3]))
|
||||||
|
|
||||||
-- The test will throw an error if this line is included in a source()
|
|
||||||
-- call. The vim expression throws a exception "E745: Using a List as a
|
|
||||||
-- Number" which is fatal in a source() call but not in a execute() call.
|
|
||||||
execute([[$put =printf('%d', abs([1, 2, 3]))]])
|
|
||||||
|
|
||||||
source([[
|
|
||||||
$put =printf('%g', abs(14.56))
|
$put =printf('%g', abs(14.56))
|
||||||
$put =printf('%g', abs(-54.32))
|
$put =printf('%g', abs(-54.32))
|
||||||
$put ='ceil'
|
$put ='ceil'
|
||||||
@@ -100,12 +93,9 @@ describe('floating point and logical operators', function()
|
|||||||
$put =and(invert(127), 65535)
|
$put =and(invert(127), 65535)
|
||||||
$put =and(invert(16), 65535)
|
$put =and(invert(16), 65535)
|
||||||
$put =and(invert(128), 65535)
|
$put =and(invert(128), 65535)
|
||||||
|
silent! $put =invert(1.0)
|
||||||
]])
|
]])
|
||||||
|
|
||||||
-- This line can not be included in a source() call. It throws a "E805:
|
|
||||||
-- Using a Float as a Number". Also compare comment above.
|
|
||||||
execute('$put =invert(1.0)')
|
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([=[
|
expect([=[
|
||||||
Results of test65:
|
Results of test65:
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
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 execute, expect = helpers.execute, helpers.expect
|
local feed_command, expect = helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe('visual block shift and tab characters', function()
|
describe('visual block shift and tab characters', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -24,23 +24,23 @@ describe('visual block shift and tab characters', function()
|
|||||||
|
|
||||||
feed('gg')
|
feed('gg')
|
||||||
feed([[fe<C-v>4jR<esc>ugvr1:'<lt>,'>yank A<cr>]])
|
feed([[fe<C-v>4jR<esc>ugvr1:'<lt>,'>yank A<cr>]])
|
||||||
execute('/^abcdefgh')
|
feed_command('/^abcdefgh')
|
||||||
feed('<C-v>4jI <esc>j<lt><lt>11|D')
|
feed('<C-v>4jI <esc>j<lt><lt>11|D')
|
||||||
feed('j7|a <esc>')
|
feed('j7|a <esc>')
|
||||||
feed('j7|a <esc>')
|
feed('j7|a <esc>')
|
||||||
feed('j7|a <esc>4k13|<C-v>4j<lt>')
|
feed('j7|a <esc>4k13|<C-v>4j<lt>')
|
||||||
execute('$-5,$yank A')
|
feed_command('$-5,$yank A')
|
||||||
execute([[$-4,$s/\s\+//g]])
|
feed_command([[$-4,$s/\s\+//g]])
|
||||||
feed('<C-v>4kI <esc>j<lt><lt>')
|
feed('<C-v>4kI <esc>j<lt><lt>')
|
||||||
feed('j7|a <esc>')
|
feed('j7|a <esc>')
|
||||||
feed('j7|a <esc>')
|
feed('j7|a <esc>')
|
||||||
feed('j7|a <esc>4k13|<C-v>4j3<lt>')
|
feed('j7|a <esc>4k13|<C-v>4j3<lt>')
|
||||||
execute('$-4,$yank A')
|
feed_command('$-4,$yank A')
|
||||||
|
|
||||||
-- Put @a and clean empty lines
|
-- Put @a and clean empty lines
|
||||||
execute('%d')
|
feed_command('%d')
|
||||||
execute('0put a')
|
feed_command('0put a')
|
||||||
execute('$d')
|
feed_command('$d')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([[
|
expect([[
|
||||||
|
|||||||
@@ -3,32 +3,34 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local execute, expect = helpers.execute, helpers.expect
|
local command, expect = helpers.command, helpers.expect
|
||||||
|
|
||||||
describe('augroup when calling exists()', function()
|
describe('augroup when calling exists()', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
|
|
||||||
it('is working', function()
|
it('is working', function()
|
||||||
execute('let results=[]')
|
command('let results=[]')
|
||||||
execute('call add(results, "##BufEnter: " . exists("##BufEnter"))')
|
command('call add(results, "##BufEnter: " . exists("##BufEnter"))')
|
||||||
execute('call add(results, "#BufEnter: " . exists("#BufEnter"))')
|
command('call add(results, "#BufEnter: " . exists("#BufEnter"))')
|
||||||
execute('au BufEnter * let g:entered=1')
|
command('au BufEnter * let g:entered=1')
|
||||||
execute('call add(results, "#BufEnter: " . exists("#BufEnter"))')
|
command('call add(results, "#BufEnter: " . exists("#BufEnter"))')
|
||||||
execute('call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter"))')
|
command('call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter"))')
|
||||||
execute('augroup auexists', 'au BufEnter * let g:entered=1', 'augroup END')
|
command('augroup auexists')
|
||||||
execute('call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter"))')
|
command('au BufEnter * let g:entered=1')
|
||||||
execute('call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test"))')
|
command('augroup END')
|
||||||
execute('au BufEnter *.test let g:entered=1')
|
command('call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter"))')
|
||||||
execute('call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test"))')
|
command('call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test"))')
|
||||||
execute('edit testfile.test')
|
command('au BufEnter *.test let g:entered=1')
|
||||||
execute('call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>"))')
|
command('call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test"))')
|
||||||
execute('au BufEnter <buffer> let g:entered=1')
|
command('edit testfile.test')
|
||||||
execute('call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>"))')
|
command('call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>"))')
|
||||||
execute('edit testfile2.test')
|
command('au BufEnter <buffer> let g:entered=1')
|
||||||
execute('call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>"))')
|
command('call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>"))')
|
||||||
execute('bf')
|
command('edit testfile2.test')
|
||||||
execute('call append(0, results)')
|
command('call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>"))')
|
||||||
execute('$d')
|
command('bf')
|
||||||
|
command('call append(0, results)')
|
||||||
|
command('$d')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([[
|
expect([[
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ local helpers = require('test.functional.helpers')(after_each)
|
|||||||
local feed = helpers.feed
|
local feed = helpers.feed
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local insert = helpers.insert
|
local insert = helpers.insert
|
||||||
local execute = helpers.execute
|
local feed_command = helpers.feed_command
|
||||||
local expect = helpers.expect
|
local expect = helpers.expect
|
||||||
|
|
||||||
describe('text formatting', function()
|
describe('text formatting', function()
|
||||||
@@ -15,195 +15,195 @@ describe('text formatting', function()
|
|||||||
-- mode so it has to be escaped with <C-V>.
|
-- mode so it has to be escaped with <C-V>.
|
||||||
insert([[
|
insert([[
|
||||||
Results of test68:
|
Results of test68:
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
a b
|
a b
|
||||||
|
|
||||||
a
|
a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
a
|
a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
a b
|
a b
|
||||||
#a b
|
#a b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
1 a
|
1 a
|
||||||
# 1 a
|
# 1 a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
x a
|
x a
|
||||||
b
|
b
|
||||||
c
|
c
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
# 1 a b
|
# 1 a b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
# x
|
# x
|
||||||
# a b
|
# a b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
1aa
|
1aa
|
||||||
2bb
|
2bb
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* abc def ghi jkl
|
/* abc def ghi jkl
|
||||||
* mno pqr stu
|
* mno pqr stu
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
# 1 xxxxx
|
# 1 xxxxx
|
||||||
]])
|
]])
|
||||||
|
|
||||||
execute('/^{/+1')
|
feed_command('/^{/+1')
|
||||||
execute('set noai tw=2 fo=t')
|
feed_command('set noai tw=2 fo=t')
|
||||||
feed('gRa b<esc>')
|
feed('gRa b<esc>')
|
||||||
|
|
||||||
execute('/^{/+1')
|
feed_command('/^{/+1')
|
||||||
execute('set ai tw=2 fo=tw')
|
feed_command('set ai tw=2 fo=tw')
|
||||||
feed('gqgqjjllab<esc>')
|
feed('gqgqjjllab<esc>')
|
||||||
|
|
||||||
execute('/^{/+1')
|
feed_command('/^{/+1')
|
||||||
execute('set tw=3 fo=t')
|
feed_command('set tw=3 fo=t')
|
||||||
feed('gqgqo<cr>')
|
feed('gqgqo<cr>')
|
||||||
feed('a <C-V><C-A><esc><esc>')
|
feed('a <C-V><C-A><esc><esc>')
|
||||||
|
|
||||||
execute('/^{/+1')
|
feed_command('/^{/+1')
|
||||||
execute('set tw=2 fo=tcq1 comments=:#')
|
feed_command('set tw=2 fo=tcq1 comments=:#')
|
||||||
feed('gqgqjgqgqo<cr>')
|
feed('gqgqjgqgqo<cr>')
|
||||||
feed('a b<cr>')
|
feed('a b<cr>')
|
||||||
feed('#a b<esc>')
|
feed('#a b<esc>')
|
||||||
|
|
||||||
execute('/^{/+1')
|
feed_command('/^{/+1')
|
||||||
execute('set tw=5 fo=tcn comments=:#')
|
feed_command('set tw=5 fo=tcn comments=:#')
|
||||||
feed('A b<esc>jA b<esc>')
|
feed('A b<esc>jA b<esc>')
|
||||||
|
|
||||||
execute('/^{/+3')
|
feed_command('/^{/+3')
|
||||||
execute('set tw=5 fo=t2a si')
|
feed_command('set tw=5 fo=t2a si')
|
||||||
feed('i <esc>A_<esc>')
|
feed('i <esc>A_<esc>')
|
||||||
|
|
||||||
execute('/^{/+1')
|
feed_command('/^{/+1')
|
||||||
execute('set tw=5 fo=qn comments=:#')
|
feed_command('set tw=5 fo=qn comments=:#')
|
||||||
feed('gwap<cr>')
|
feed('gwap<cr>')
|
||||||
|
|
||||||
execute('/^{/+1')
|
feed_command('/^{/+1')
|
||||||
execute('set tw=5 fo=q2 comments=:#')
|
feed_command('set tw=5 fo=q2 comments=:#')
|
||||||
feed('gwap<cr>')
|
feed('gwap<cr>')
|
||||||
|
|
||||||
execute('/^{/+2')
|
feed_command('/^{/+2')
|
||||||
execute('set tw& fo=a')
|
feed_command('set tw& fo=a')
|
||||||
feed('I^^<esc><esc>')
|
feed('I^^<esc><esc>')
|
||||||
|
|
||||||
execute('/mno pqr/')
|
feed_command('/mno pqr/')
|
||||||
execute('setl tw=20 fo=an12wcq comments=s1:/*,mb:*,ex:*/')
|
feed_command('setl tw=20 fo=an12wcq comments=s1:/*,mb:*,ex:*/')
|
||||||
feed('A vwx yz<esc>')
|
feed('A vwx yz<esc>')
|
||||||
|
|
||||||
execute('/^#/')
|
feed_command('/^#/')
|
||||||
execute('setl tw=12 fo=tqnc comments=:#')
|
feed_command('setl tw=12 fo=tqnc comments=:#')
|
||||||
feed('A foobar<esc>')
|
feed('A foobar<esc>')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([[
|
expect([[
|
||||||
Results of test68:
|
Results of test68:
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
a
|
a
|
||||||
b
|
b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
a
|
a
|
||||||
b
|
b
|
||||||
|
|
||||||
a
|
a
|
||||||
b
|
b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
a
|
a
|
||||||
|
|
||||||
|
|
||||||
a
|
a
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
a b
|
a b
|
||||||
#a b
|
#a b
|
||||||
|
|
||||||
a b
|
a b
|
||||||
#a b
|
#a b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
1 a
|
1 a
|
||||||
b
|
b
|
||||||
# 1 a
|
# 1 a
|
||||||
# b
|
# b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
x a
|
x a
|
||||||
b_
|
b_
|
||||||
c
|
c
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
# 1 a
|
# 1 a
|
||||||
# b
|
# b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
# x a
|
# x a
|
||||||
# b
|
# b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{ 1aa ^^2bb }
|
{ 1aa ^^2bb }
|
||||||
|
|
||||||
|
|
||||||
/* abc def ghi jkl
|
/* abc def ghi jkl
|
||||||
* mno pqr stu
|
* mno pqr stu
|
||||||
* vwx yz
|
* vwx yz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
# 1 xxxxx
|
# 1 xxxxx
|
||||||
# foobar
|
# foobar
|
||||||
]])
|
]])
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
-- Also test byteidx() and byteidxcomp()
|
-- Also test byteidx() and byteidxcomp()
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, insert, eq, eval, clear, execute, expect = helpers.feed,
|
local feed, insert, eq, eval, clear, feed_command, expect = helpers.feed,
|
||||||
helpers.insert, helpers.eq, helpers.eval, helpers.clear, helpers.execute,
|
helpers.insert, helpers.eq, helpers.eval, helpers.clear, helpers.feed_command,
|
||||||
helpers.expect
|
helpers.expect
|
||||||
|
|
||||||
describe('multibyte text', function()
|
describe('multibyte text', function()
|
||||||
@@ -17,8 +17,8 @@ describe('multibyte text', function()
|
|||||||
XYZ
|
XYZ
|
||||||
abc XYZ
|
abc XYZ
|
||||||
}]])
|
}]])
|
||||||
execute('/^{/+1')
|
feed_command('/^{/+1')
|
||||||
execute('set tw=2 fo=t')
|
feed_command('set tw=2 fo=t')
|
||||||
feed('gqgqjgqgqo<cr>')
|
feed('gqgqjgqgqo<cr>')
|
||||||
feed('XYZ<cr>')
|
feed('XYZ<cr>')
|
||||||
feed('abc XYZ<esc><esc>')
|
feed('abc XYZ<esc><esc>')
|
||||||
@@ -43,8 +43,8 @@ describe('multibyte text', function()
|
|||||||
XY
|
XY
|
||||||
X Y
|
X Y
|
||||||
}]])
|
}]])
|
||||||
execute('/^{/+1')
|
feed_command('/^{/+1')
|
||||||
execute('set tw=1 fo=tm')
|
feed_command('set tw=1 fo=tm')
|
||||||
feed('gqgqjgqgqjgqgqjgqgqjgqgqo<cr>')
|
feed('gqgqjgqgqjgqgqjgqgqjgqgqo<cr>')
|
||||||
feed('X<cr>')
|
feed('X<cr>')
|
||||||
feed('Xa<cr>')
|
feed('Xa<cr>')
|
||||||
@@ -89,8 +89,8 @@ describe('multibyte text', function()
|
|||||||
abX c
|
abX c
|
||||||
abXY
|
abXY
|
||||||
}]])
|
}]])
|
||||||
execute('/^{/+1')
|
feed_command('/^{/+1')
|
||||||
execute('set tw=2 fo=tm')
|
feed_command('set tw=2 fo=tm')
|
||||||
feed('gqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqo<cr>')
|
feed('gqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqo<cr>')
|
||||||
feed('X<cr>')
|
feed('X<cr>')
|
||||||
feed('Xa<cr>')
|
feed('Xa<cr>')
|
||||||
@@ -156,8 +156,8 @@ describe('multibyte text', function()
|
|||||||
X
|
X
|
||||||
Xa
|
Xa
|
||||||
}]])
|
}]])
|
||||||
execute('/^{/+1')
|
feed_command('/^{/+1')
|
||||||
execute('set ai tw=2 fo=tm')
|
feed_command('set ai tw=2 fo=tm')
|
||||||
feed('gqgqjgqgqo<cr>')
|
feed('gqgqjgqgqo<cr>')
|
||||||
feed('X<cr>')
|
feed('X<cr>')
|
||||||
feed('Xa<esc>')
|
feed('Xa<esc>')
|
||||||
@@ -179,8 +179,8 @@ describe('multibyte text', function()
|
|||||||
X
|
X
|
||||||
Xa
|
Xa
|
||||||
}]])
|
}]])
|
||||||
execute('/^{/+1')
|
feed_command('/^{/+1')
|
||||||
execute('set noai tw=2 fo=tm')
|
feed_command('set noai tw=2 fo=tm')
|
||||||
feed('gqgqjgqgqo<cr>')
|
feed('gqgqjgqgqo<cr>')
|
||||||
-- Literal spaces will be trimmed from the by feed().
|
-- Literal spaces will be trimmed from the by feed().
|
||||||
feed('<space><space>X<cr>')
|
feed('<space><space>X<cr>')
|
||||||
@@ -211,8 +211,8 @@ describe('multibyte text', function()
|
|||||||
XXa
|
XXa
|
||||||
XXY
|
XXY
|
||||||
}]])
|
}]])
|
||||||
execute('/^{/+1')
|
feed_command('/^{/+1')
|
||||||
execute('set tw=2 fo=cqm comments=n:X')
|
feed_command('set tw=2 fo=cqm comments=n:X')
|
||||||
feed('gqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqo<cr>')
|
feed('gqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqo<cr>')
|
||||||
feed('X<cr>')
|
feed('X<cr>')
|
||||||
feed('Xa<cr>')
|
feed('Xa<cr>')
|
||||||
@@ -261,8 +261,8 @@ describe('multibyte text', function()
|
|||||||
{
|
{
|
||||||
|
|
||||||
}]])
|
}]])
|
||||||
execute('/^{/+1')
|
feed_command('/^{/+1')
|
||||||
execute('set tw=2 fo=tm')
|
feed_command('set tw=2 fo=tm')
|
||||||
feed('RXa<esc>')
|
feed('RXa<esc>')
|
||||||
expect([[
|
expect([[
|
||||||
{
|
{
|
||||||
@@ -276,8 +276,8 @@ describe('multibyte text', function()
|
|||||||
{
|
{
|
||||||
‘ two three ’ four
|
‘ two three ’ four
|
||||||
}]])
|
}]])
|
||||||
execute('/^{/+1')
|
feed_command('/^{/+1')
|
||||||
execute('set mps+=‘:’')
|
feed_command('set mps+=‘:’')
|
||||||
feed('d%<cr>')
|
feed('d%<cr>')
|
||||||
expect([[
|
expect([[
|
||||||
{
|
{
|
||||||
@@ -299,8 +299,8 @@ describe('multibyte text', function()
|
|||||||
insert([[
|
insert([[
|
||||||
á
|
á
|
||||||
x]])
|
x]])
|
||||||
execute('set whichwrap+=h')
|
feed_command('set whichwrap+=h')
|
||||||
execute('/^x')
|
feed_command('/^x')
|
||||||
feed('dh')
|
feed('dh')
|
||||||
expect([[
|
expect([[
|
||||||
áx]])
|
áx]])
|
||||||
@@ -308,9 +308,9 @@ describe('multibyte text', function()
|
|||||||
|
|
||||||
it('can be queried with byteidx() and byteidxcomp()', function()
|
it('can be queried with byteidx() and byteidxcomp()', function()
|
||||||
-- One char of two bytes.
|
-- One char of two bytes.
|
||||||
execute("let a = '.é.'")
|
feed_command("let a = '.é.'")
|
||||||
-- Normal e with composing char.
|
-- Normal e with composing char.
|
||||||
execute("let b = '.é.'")
|
feed_command("let b = '.é.'")
|
||||||
eq(0, eval('byteidx(a, 0)'))
|
eq(0, eval('byteidx(a, 0)'))
|
||||||
eq(1, eval('byteidx(a, 1)'))
|
eq(1, eval('byteidx(a, 1)'))
|
||||||
eq(3, eval('byteidx(a, 2)'))
|
eq(3, eval('byteidx(a, 2)'))
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, insert = helpers.feed, helpers.insert
|
local feed, insert = helpers.feed, helpers.insert
|
||||||
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe('72', function()
|
describe('72', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -13,34 +13,34 @@ describe('72', function()
|
|||||||
insert([[
|
insert([[
|
||||||
1111 -----
|
1111 -----
|
||||||
2222 -----
|
2222 -----
|
||||||
|
|
||||||
123456789]])
|
123456789]])
|
||||||
|
|
||||||
-- Test 'undofile': first a simple one-line change.
|
-- Test 'undofile': first a simple one-line change.
|
||||||
execute('set visualbell')
|
feed_command('set visualbell')
|
||||||
execute('set ul=100 undofile undodir=. nomore')
|
feed_command('set ul=100 undofile undodir=. nomore')
|
||||||
execute('e! Xtestfile')
|
feed_command('e! Xtestfile')
|
||||||
feed('ggdGithis is one line<esc>:set ul=100<cr>')
|
feed('ggdGithis is one line<esc>:set ul=100<cr>')
|
||||||
execute('s/one/ONE/')
|
feed_command('s/one/ONE/')
|
||||||
execute('set ul=100')
|
feed_command('set ul=100')
|
||||||
execute('w')
|
feed_command('w')
|
||||||
execute('bwipe!')
|
feed_command('bwipe!')
|
||||||
execute('e Xtestfile')
|
feed_command('e Xtestfile')
|
||||||
feed('u:.w! test.out<cr>')
|
feed('u:.w! test.out<cr>')
|
||||||
|
|
||||||
-- Test 'undofile', change in original file fails check.
|
-- Test 'undofile', change in original file fails check.
|
||||||
execute('set noundofile')
|
feed_command('set noundofile')
|
||||||
execute('e! Xtestfile')
|
feed_command('e! Xtestfile')
|
||||||
execute('s/line/Line/')
|
feed_command('s/line/Line/')
|
||||||
execute('w')
|
feed_command('w')
|
||||||
execute('set undofile')
|
feed_command('set undofile')
|
||||||
execute('bwipe!')
|
feed_command('bwipe!')
|
||||||
execute('e Xtestfile')
|
feed_command('e Xtestfile')
|
||||||
---- TODO: this beeps.
|
---- TODO: this beeps.
|
||||||
feed('u:.w >>test.out<cr>')
|
feed('u:.w >>test.out<cr>')
|
||||||
|
|
||||||
-- Test 'undofile', add 10 lines, delete 6 lines, undo 3.
|
-- Test 'undofile', add 10 lines, delete 6 lines, undo 3.
|
||||||
execute('set undofile')
|
feed_command('set undofile')
|
||||||
feed('ggdGione<cr>')
|
feed('ggdGione<cr>')
|
||||||
feed('two<cr>')
|
feed('two<cr>')
|
||||||
feed('three<cr>')
|
feed('three<cr>')
|
||||||
@@ -57,20 +57,20 @@ describe('72', function()
|
|||||||
feed('dd:set ul=100<cr>')
|
feed('dd:set ul=100<cr>')
|
||||||
feed('dd:set ul=100<cr>')
|
feed('dd:set ul=100<cr>')
|
||||||
feed('dd:set ul=100<cr>')
|
feed('dd:set ul=100<cr>')
|
||||||
execute('w')
|
feed_command('w')
|
||||||
execute('bwipe!')
|
feed_command('bwipe!')
|
||||||
execute('e Xtestfile')
|
feed_command('e Xtestfile')
|
||||||
feed('uuu:w >>test.out<cr>')
|
feed('uuu:w >>test.out<cr>')
|
||||||
|
|
||||||
-- Test that reading the undofiles when setting undofile works.
|
-- Test that reading the undofiles when setting undofile works.
|
||||||
execute('set noundofile ul=0')
|
feed_command('set noundofile ul=0')
|
||||||
feed('i<cr>')
|
feed('i<cr>')
|
||||||
feed('<esc>u:e! Xtestfile<cr>')
|
feed('<esc>u:e! Xtestfile<cr>')
|
||||||
execute('set undofile ul=100')
|
feed_command('set undofile ul=100')
|
||||||
feed('uuuuuu:w >>test.out<cr>')
|
feed('uuuuuu:w >>test.out<cr>')
|
||||||
|
|
||||||
---- Open the output to see if it meets the expections
|
---- Open the output to see if it meets the expections
|
||||||
execute('e! test.out')
|
feed_command('e! test.out')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([[
|
expect([[
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local lfs = require('lfs')
|
local lfs = require('lfs')
|
||||||
local clear, execute, eq, neq, eval, wait, spawn =
|
local clear, command, eq, neq, eval, wait, spawn =
|
||||||
helpers.clear, helpers.execute, helpers.eq, helpers.neq, helpers.eval,
|
helpers.clear, helpers.command, helpers.eq, helpers.neq, helpers.eval,
|
||||||
helpers.wait, helpers.spawn
|
helpers.wait, helpers.spawn
|
||||||
|
|
||||||
describe('storing global variables in ShaDa files', function()
|
describe('storing global variables in ShaDa files', function()
|
||||||
@@ -26,31 +26,29 @@ describe('storing global variables in ShaDa files', function()
|
|||||||
71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
|
71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
|
||||||
89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100}
|
89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100}
|
||||||
|
|
||||||
execute(
|
command('set visualbell')
|
||||||
-- This will cause a few errors, do it silently.
|
command('set shada+=!')
|
||||||
'set visualbell',
|
command('let MY_GLOBAL_DICT={\'foo\': 1, \'bar\': 0, \'longvarible\': 1000}')
|
||||||
'set shada+=!',
|
-- Store a really long list. Initially this was testing line wrapping in
|
||||||
"let MY_GLOBAL_DICT={'foo': 1, 'bar': 0, 'longvarible': 1000}",
|
-- viminfo, but shada files has no line wrapping, no matter how long the
|
||||||
-- Store a really long list. Initially this was testing line wrapping in
|
-- list is.
|
||||||
-- viminfo, but shada files has no line wrapping, no matter how long the
|
command('let MY_GLOBAL_LIST=range(1, 100)')
|
||||||
-- list is.
|
|
||||||
'let MY_GLOBAL_LIST=range(1,100)'
|
|
||||||
)
|
|
||||||
eq(test_dict, eval('MY_GLOBAL_DICT'))
|
eq(test_dict, eval('MY_GLOBAL_DICT'))
|
||||||
eq(test_list, eval('MY_GLOBAL_LIST'))
|
eq(test_list, eval('MY_GLOBAL_LIST'))
|
||||||
|
|
||||||
execute('wsh! ' .. tempname)
|
command('wsh! ' .. tempname)
|
||||||
wait()
|
wait()
|
||||||
|
|
||||||
-- Assert that the shada file exists.
|
-- Assert that the shada file exists.
|
||||||
neq(nil, lfs.attributes(tempname))
|
neq(nil, lfs.attributes(tempname))
|
||||||
execute('unlet MY_GLOBAL_DICT',
|
command('unlet MY_GLOBAL_DICT')
|
||||||
'unlet MY_GLOBAL_LIST')
|
command('unlet MY_GLOBAL_LIST')
|
||||||
-- Assert that the variables where deleted.
|
-- Assert that the variables where deleted.
|
||||||
eq(0, eval('exists("MY_GLOBAL_DICT")'))
|
eq(0, eval('exists("MY_GLOBAL_DICT")'))
|
||||||
eq(0, eval('exists("MY_GLOBAL_LIST")'))
|
eq(0, eval('exists("MY_GLOBAL_LIST")'))
|
||||||
|
|
||||||
execute('rsh! ' .. tempname)
|
command('rsh! ' .. tempname)
|
||||||
|
|
||||||
eq(test_list, eval('MY_GLOBAL_LIST'))
|
eq(test_list, eval('MY_GLOBAL_LIST'))
|
||||||
eq(test_dict, eval('MY_GLOBAL_DICT'))
|
eq(test_dict, eval('MY_GLOBAL_DICT'))
|
||||||
|
|||||||
@@ -3,46 +3,48 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear, feed = helpers.clear, helpers.feed
|
local clear, feed = helpers.clear, helpers.feed
|
||||||
local execute, expect = helpers.execute, helpers.expect
|
local command, expect = helpers.command, helpers.expect
|
||||||
|
local wait = helpers.wait
|
||||||
|
|
||||||
describe('maparg()', function()
|
describe('maparg()', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
|
|
||||||
it('is working', function()
|
it('is working', function()
|
||||||
execute('set cpo-=<')
|
command('set cpo-=<')
|
||||||
|
|
||||||
-- Test maparg() with a string result
|
-- Test maparg() with a string result
|
||||||
execute('map foo<C-V> is<F4>foo')
|
command('map foo<C-V> is<F4>foo')
|
||||||
execute('vnoremap <script> <buffer> <expr> <silent> bar isbar')
|
command('vnoremap <script> <buffer> <expr> <silent> bar isbar')
|
||||||
execute([[call append('$', maparg('foo<C-V>'))]])
|
command([[call append('$', maparg('foo<C-V>'))]])
|
||||||
execute([[call append('$', string(maparg('foo<C-V>', '', 0, 1)))]])
|
command([[call append('$', string(maparg('foo<C-V>', '', 0, 1)))]])
|
||||||
execute([[call append('$', string(maparg('bar', '', 0, 1)))]])
|
command([[call append('$', string(maparg('bar', '', 0, 1)))]])
|
||||||
execute('map <buffer> <nowait> foo bar')
|
command('map <buffer> <nowait> foo bar')
|
||||||
execute([[call append('$', string(maparg('foo', '', 0, 1)))]])
|
command([[call append('$', string(maparg('foo', '', 0, 1)))]])
|
||||||
execute('map abc x<char-114>x')
|
command('map abc x<char-114>x')
|
||||||
execute([[call append('$', maparg('abc'))]])
|
command([[call append('$', maparg('abc'))]])
|
||||||
execute('map abc y<S-char-114>y')
|
command('map abc y<S-char-114>y')
|
||||||
execute([[call append('$', maparg('abc'))]])
|
command([[call append('$', maparg('abc'))]])
|
||||||
feed('Go<esc>:<cr>')
|
feed('Go<esc>:<cr>')
|
||||||
|
wait()
|
||||||
|
|
||||||
-- Outside of the range, minimum
|
-- Outside of the range, minimum
|
||||||
execute('inoremap <Char-0x1040> a')
|
command('inoremap <Char-0x1040> a')
|
||||||
execute([[execute "normal a\u1040\<Esc>"]])
|
command([[execute "normal a\u1040\<Esc>"]])
|
||||||
|
|
||||||
-- Inside of the range, minimum
|
-- Inside of the range, minimum
|
||||||
execute('inoremap <Char-0x103f> b')
|
command('inoremap <Char-0x103f> b')
|
||||||
execute([[execute "normal a\u103f\<Esc>"]])
|
command([[execute "normal a\u103f\<Esc>"]])
|
||||||
|
|
||||||
-- Inside of the range, maximum
|
-- Inside of the range, maximum
|
||||||
execute('inoremap <Char-0xf03f> c')
|
command('inoremap <Char-0xf03f> c')
|
||||||
execute([[execute "normal a\uf03f\<Esc>"]])
|
command([[execute "normal a\uf03f\<Esc>"]])
|
||||||
|
|
||||||
-- Outside of the range, maximum
|
-- Outside of the range, maximum
|
||||||
execute('inoremap <Char-0xf040> d')
|
command('inoremap <Char-0xf040> d')
|
||||||
execute([[execute "normal a\uf040\<Esc>"]])
|
command([[execute "normal a\uf040\<Esc>"]])
|
||||||
|
|
||||||
-- Remove empty line
|
-- Remove empty line
|
||||||
execute('1d')
|
command('1d')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([[
|
expect([[
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
-- If it isn't available then the test will be skipped.
|
-- If it isn't available then the test will be skipped.
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
|
||||||
local feed = helpers.feed
|
local feed = helpers.feed
|
||||||
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
local wait = helpers.wait
|
||||||
|
local clear = helpers.clear
|
||||||
|
local expect = helpers.expect
|
||||||
|
local command = helpers.command
|
||||||
|
|
||||||
describe('mf_hash_grow()', function()
|
describe('mf_hash_grow()', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -18,19 +22,21 @@ describe('mf_hash_grow()', function()
|
|||||||
pending('was not tested because cksum was not found', function() end)
|
pending('was not tested because cksum was not found', function() end)
|
||||||
else
|
else
|
||||||
it('is working', function()
|
it('is working', function()
|
||||||
execute('set fileformat=unix undolevels=-1')
|
command('set fileformat=unix undolevels=-1')
|
||||||
|
|
||||||
-- Fill the buffer with numbers 1 - 2000000
|
-- Fill the buffer with numbers 1 - 2000000
|
||||||
execute('let i = 1')
|
command('let i = 1')
|
||||||
execute('while i <= 2000000 | call append(i, range(i, i + 99)) | let i += 100 | endwhile')
|
command('while i <= 2000000 | call append(i, range(i, i + 99)) | let i += 100 | endwhile')
|
||||||
|
|
||||||
-- Delete empty first line, save to Xtest, and clear buffer
|
-- Delete empty first line, save to Xtest, and clear buffer
|
||||||
feed('ggdd<cr>')
|
feed('ggdd<cr>')
|
||||||
execute('w! Xtest')
|
wait()
|
||||||
|
command('w! Xtest')
|
||||||
feed('ggdG<cr>')
|
feed('ggdG<cr>')
|
||||||
|
wait()
|
||||||
|
|
||||||
-- Calculate the cksum of Xtest and delete first line
|
-- Calculate the cksum of Xtest and delete first line
|
||||||
execute('r !cksum Xtest')
|
command('r !cksum Xtest')
|
||||||
feed('ggdd<cr>')
|
feed('ggdd<cr>')
|
||||||
|
|
||||||
-- Assert correct output of cksum.
|
-- Assert correct output of cksum.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, insert = helpers.feed, helpers.insert
|
local feed, insert = helpers.feed, helpers.insert
|
||||||
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
|
||||||
local eq, eval = helpers.eq, helpers.eval
|
local eq, eval = helpers.eq, helpers.eval
|
||||||
|
|
||||||
describe('substitue()', function()
|
describe('substitue()', function()
|
||||||
@@ -46,17 +46,17 @@ describe('substitue()', function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
it('with "set magic" (TEST_1)', function()
|
it('with "set magic" (TEST_1)', function()
|
||||||
execute('set magic')
|
feed_command('set magic')
|
||||||
test_1_and_2()
|
test_1_and_2()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('with "set nomagic" (TEST_2)', function()
|
it('with "set nomagic" (TEST_2)', function()
|
||||||
execute('set nomagic')
|
feed_command('set nomagic')
|
||||||
test_1_and_2()
|
test_1_and_2()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('with sub-replace-expression (TEST_3)', function()
|
it('with sub-replace-expression (TEST_3)', function()
|
||||||
execute('set magic&')
|
feed_command('set magic&')
|
||||||
eq('a\\a', eval([[substitute('aAa', 'A', '\="\\"', '')]]))
|
eq('a\\a', eval([[substitute('aAa', 'A', '\="\\"', '')]]))
|
||||||
eq('b\\\\b', eval([[substitute('bBb', 'B', '\="\\\\"', '')]]))
|
eq('b\\\\b', eval([[substitute('bBb', 'B', '\="\\\\"', '')]]))
|
||||||
eq('c\rc', eval([[substitute('cCc', 'C', '\="]]..'\r'..[["', '')]]))
|
eq('c\rc', eval([[substitute('cCc', 'C', '\="]]..'\r'..[["', '')]]))
|
||||||
@@ -70,7 +70,7 @@ describe('substitue()', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('with submatch() (TEST_4)', function()
|
it('with submatch() (TEST_4)', function()
|
||||||
execute('set magic&')
|
feed_command('set magic&')
|
||||||
eq('a\\a', eval([[substitute('aAa', 'A', ]] ..
|
eq('a\\a', eval([[substitute('aAa', 'A', ]] ..
|
||||||
[['\=substitute(submatch(0), ".", "\\", "")', '')]]))
|
[['\=substitute(submatch(0), ".", "\\", "")', '')]]))
|
||||||
eq('b\\b', eval([[substitute('bBb', 'B', ]] ..
|
eq('b\\b', eval([[substitute('bBb', 'B', ]] ..
|
||||||
@@ -92,7 +92,7 @@ describe('substitue()', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('with submatch() (TEST_5)', function()
|
it('with submatch() (TEST_5)', function()
|
||||||
execute('set magic&')
|
feed_command('set magic&')
|
||||||
eq('A123456789987654321', eval([[substitute('A123456789', ]] ..
|
eq('A123456789987654321', eval([[substitute('A123456789', ]] ..
|
||||||
[['A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', ]] ..
|
[['A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', ]] ..
|
||||||
[['\=submatch(0) . submatch(9) . submatch(8) . submatch(7) . ]] ..
|
[['\=submatch(0) . submatch(9) . submatch(8) . submatch(7) . ]] ..
|
||||||
@@ -110,7 +110,7 @@ describe('substitue()', function()
|
|||||||
-- #2943.
|
-- #2943.
|
||||||
|
|
||||||
it('with submatch or \\ze (TEST_7)', function()
|
it('with submatch or \\ze (TEST_7)', function()
|
||||||
execute('set magic&')
|
feed_command('set magic&')
|
||||||
eq('A\rA', eval("substitute('A\rA', 'A.', '\\=submatch(0)', '')"))
|
eq('A\rA', eval("substitute('A\rA', 'A.', '\\=submatch(0)', '')"))
|
||||||
eq('B\nB', eval([[substitute("B\nB", 'B.', '\=submatch(0)', '')]]))
|
eq('B\nB', eval([[substitute("B\nB", 'B.', '\=submatch(0)', '')]]))
|
||||||
eq("['B\n']B",
|
eq("['B\n']B",
|
||||||
@@ -120,7 +120,7 @@ describe('substitue()', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('with \\zs and \\ze (TEST_10)', function()
|
it('with \\zs and \\ze (TEST_10)', function()
|
||||||
execute('set magic&')
|
feed_command('set magic&')
|
||||||
eq('a1a2a3a', eval([[substitute('123', '\zs', 'a', 'g')]]))
|
eq('a1a2a3a', eval([[substitute('123', '\zs', 'a', 'g')]]))
|
||||||
eq('aaa', eval([[substitute('123', '\zs.', 'a', 'g')]]))
|
eq('aaa', eval([[substitute('123', '\zs.', 'a', 'g')]]))
|
||||||
eq('1a2a3a', eval([[substitute('123', '.\zs', 'a', 'g')]]))
|
eq('1a2a3a', eval([[substitute('123', '.\zs', 'a', 'g')]]))
|
||||||
@@ -140,11 +140,11 @@ describe(':substitue', function()
|
|||||||
,,X
|
,,X
|
||||||
,,Y
|
,,Y
|
||||||
,,Z]])
|
,,Z]])
|
||||||
execute('set magic&')
|
feed_command('set magic&')
|
||||||
execute([[1s/\(^\|,\)\ze\(,\|X\)/\1N/g]])
|
feed_command([[1s/\(^\|,\)\ze\(,\|X\)/\1N/g]])
|
||||||
execute([[2s/\(^\|,\)\ze\(,\|Y\)/\1N/gc]])
|
feed_command([[2s/\(^\|,\)\ze\(,\|Y\)/\1N/gc]])
|
||||||
feed('a') -- For the dialog of the previous :s command.
|
feed('a') -- For the dialog of the previous :s command.
|
||||||
execute([[3s/\(^\|,\)\ze\(,\|Z\)/\1N/gc]])
|
feed_command([[3s/\(^\|,\)\ze\(,\|Z\)/\1N/gc]])
|
||||||
feed('yy') -- For the dialog of the previous :s command.
|
feed('yy') -- For the dialog of the previous :s command.
|
||||||
expect([[
|
expect([[
|
||||||
N,,NX
|
N,,NX
|
||||||
@@ -154,8 +154,8 @@ describe(':substitue', function()
|
|||||||
|
|
||||||
it('with confirmation dialog (TEST_9)', function()
|
it('with confirmation dialog (TEST_9)', function()
|
||||||
insert('xxx')
|
insert('xxx')
|
||||||
execute('set magic&')
|
feed_command('set magic&')
|
||||||
execute('s/x/X/gc')
|
feed_command('s/x/X/gc')
|
||||||
feed('yyq') -- For the dialog of the previous :s command.
|
feed('yyq') -- For the dialog of the previous :s command.
|
||||||
expect('XXx')
|
expect('XXx')
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
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 execute, expect = helpers.execute, helpers.expect
|
local feed_command, expect = helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe('coptions', function()
|
describe('coptions', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -16,18 +16,18 @@ describe('coptions', function()
|
|||||||
ccc two three four
|
ccc two three four
|
||||||
ddd yee yoo four]])
|
ddd yee yoo four]])
|
||||||
|
|
||||||
execute('set cpo-=;')
|
feed_command('set cpo-=;')
|
||||||
|
|
||||||
feed('gg0tt;D')
|
feed('gg0tt;D')
|
||||||
feed('j0fz;D')
|
feed('j0fz;D')
|
||||||
feed('j$Fy;D')
|
feed('j$Fy;D')
|
||||||
feed('j$Ty;D')
|
feed('j$Ty;D')
|
||||||
|
|
||||||
execute('set cpo+=;')
|
feed_command('set cpo+=;')
|
||||||
|
|
||||||
feed('j0tt;;D')
|
feed('j0tt;;D')
|
||||||
feed('j$Ty;;D')
|
feed('j$Ty;;D')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
aaa two
|
aaa two
|
||||||
z
|
z
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, source = helpers.feed, helpers.source
|
local feed, source = helpers.feed, helpers.source
|
||||||
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe('case-insensitive string comparison in UTF-8', function()
|
describe('case-insensitive string comparison in UTF-8', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -106,11 +106,11 @@ describe('case-insensitive string comparison in UTF-8', function()
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
-- Test that g~ap changes one paragraph only.
|
-- Test that g~ap changes one paragraph only.
|
||||||
execute('new')
|
feed_command('new')
|
||||||
feed('iabcd<cr><cr>defg<esc>gg0g~ap')
|
feed('iabcd<cr><cr>defg<esc>gg0g~ap')
|
||||||
execute('let lns = getline(1,3)')
|
feed_command('let lns = getline(1,3)')
|
||||||
execute('q!')
|
feed_command('q!')
|
||||||
execute([[call append(line('$'), lns)]])
|
feed_command([[call append(line('$'), lns)]])
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([=[
|
expect([=[
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ describe('curswant', function()
|
|||||||
let curswant_after = winsaveview().curswant
|
let curswant_after = winsaveview().curswant
|
||||||
return [a:option_name, curswant_before, curswant_after]
|
return [a:option_name, curswant_before, curswant_after]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
new
|
new
|
||||||
put =['1234567890', '12345']
|
put =['1234567890', '12345']
|
||||||
1 delete _
|
1 delete _
|
||||||
@@ -33,7 +33,7 @@ describe('curswant', function()
|
|||||||
for option_name in target_option_names
|
for option_name in target_option_names
|
||||||
call add(result, TestCurswant(option_name))
|
call add(result, TestCurswant(option_name))
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
new
|
new
|
||||||
put =map(copy(result), 'join(v:val, '' '')')
|
put =map(copy(result), 'join(v:val, '' '')')
|
||||||
1 delete _
|
1 delete _
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
-- tabulators.
|
-- tabulators.
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, insert, clear, execute =
|
local feed, insert, clear, feed_command =
|
||||||
helpers.feed, helpers.insert, helpers.clear, helpers.execute
|
helpers.feed, helpers.insert, helpers.clear, helpers.feed_command
|
||||||
|
|
||||||
local expect_pos = function(row, col)
|
local expect_pos = function(row, col)
|
||||||
return helpers.eq({row, col}, helpers.eval('[screenrow(), screencol()]'))
|
return helpers.eq({row, col}, helpers.eval('[screenrow(), screencol()]'))
|
||||||
@@ -17,19 +17,19 @@ describe('cursor and column position with conceal and tabulators', function()
|
|||||||
start:
|
start:
|
||||||
.concealed. text
|
.concealed. text
|
||||||
|concealed| text
|
|concealed| text
|
||||||
|
|
||||||
.concealed. text
|
.concealed. text
|
||||||
|concealed| text
|
|concealed| text
|
||||||
|
|
||||||
.a. .b. .c. .d.
|
.a. .b. .c. .d.
|
||||||
|a| |b| |c| |d|]])
|
|a| |b| |c| |d|]])
|
||||||
|
|
||||||
-- Conceal settings.
|
-- Conceal settings.
|
||||||
execute('set conceallevel=2')
|
feed_command('set conceallevel=2')
|
||||||
execute('set concealcursor=nc')
|
feed_command('set concealcursor=nc')
|
||||||
execute('syntax match test /|/ conceal')
|
feed_command('syntax match test /|/ conceal')
|
||||||
-- Start test.
|
-- Start test.
|
||||||
execute('/^start:')
|
feed_command('/^start:')
|
||||||
feed('ztj')
|
feed('ztj')
|
||||||
expect_pos(2, 1)
|
expect_pos(2, 1)
|
||||||
-- We should end up in the same column when running these commands on the
|
-- We should end up in the same column when running these commands on the
|
||||||
@@ -78,10 +78,10 @@ describe('cursor and column position with conceal and tabulators', function()
|
|||||||
expect_pos(9, 25)
|
expect_pos(9, 25)
|
||||||
feed('$')
|
feed('$')
|
||||||
expect_pos(9, 26)
|
expect_pos(9, 26)
|
||||||
execute('set lbr')
|
feed_command('set lbr')
|
||||||
feed('$')
|
feed('$')
|
||||||
expect_pos(9, 26)
|
expect_pos(9, 26)
|
||||||
execute('set list listchars=tab:>-')
|
feed_command('set list listchars=tab:>-')
|
||||||
feed('0')
|
feed('0')
|
||||||
expect_pos(9, 1)
|
expect_pos(9, 1)
|
||||||
feed('W')
|
feed('W')
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, insert = helpers.feed, helpers.insert
|
local feed, insert = helpers.feed, helpers.insert
|
||||||
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe('store cursor position in session file in UTF-8', function()
|
describe('store cursor position in session file in UTF-8', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -29,15 +29,15 @@ describe('store cursor position in session file in UTF-8', function()
|
|||||||
-- This test requires the buffer to correspond to a file on disk, here named
|
-- This test requires the buffer to correspond to a file on disk, here named
|
||||||
-- "test.in", because otherwise :mksession won't write out the cursor column
|
-- "test.in", because otherwise :mksession won't write out the cursor column
|
||||||
-- info needed for verification.
|
-- info needed for verification.
|
||||||
execute('write! test.in')
|
feed_command('write! test.in')
|
||||||
|
|
||||||
execute('set sessionoptions=buffers splitbelow fileencoding=utf-8')
|
feed_command('set sessionoptions=buffers splitbelow fileencoding=utf-8')
|
||||||
|
|
||||||
-- Move the cursor through the buffer lines and position it with "|". Using
|
-- Move the cursor through the buffer lines and position it with "|". Using
|
||||||
-- :split after every normal mode command is a trick to have multiple
|
-- :split after every normal mode command is a trick to have multiple
|
||||||
-- cursors on the screen that can all be stored in the session file.
|
-- cursors on the screen that can all be stored in the session file.
|
||||||
execute('/^start:')
|
feed_command('/^start:')
|
||||||
execute('vsplit')
|
feed_command('vsplit')
|
||||||
feed('j16|:split<cr>')
|
feed('j16|:split<cr>')
|
||||||
feed('j16|:split<cr>')
|
feed('j16|:split<cr>')
|
||||||
feed('j16|:split<cr>')
|
feed('j16|:split<cr>')
|
||||||
@@ -49,9 +49,9 @@ describe('store cursor position in session file in UTF-8', function()
|
|||||||
|
|
||||||
-- Again move the cursor through the buffer and position it with "|". This
|
-- Again move the cursor through the buffer and position it with "|". This
|
||||||
-- time also perform a horizontal scroll at every step.
|
-- time also perform a horizontal scroll at every step.
|
||||||
execute('wincmd l')
|
feed_command('wincmd l')
|
||||||
execute('/^start:')
|
feed_command('/^start:')
|
||||||
execute('set nowrap')
|
feed_command('set nowrap')
|
||||||
feed('j16|3zl:split<cr>')
|
feed('j16|3zl:split<cr>')
|
||||||
feed('j016|3zl:split<cr>')
|
feed('j016|3zl:split<cr>')
|
||||||
feed('j016|3zl:split<cr>')
|
feed('j016|3zl:split<cr>')
|
||||||
@@ -62,9 +62,9 @@ describe('store cursor position in session file in UTF-8', function()
|
|||||||
feed('j016|3zl:split<cr>')
|
feed('j016|3zl:split<cr>')
|
||||||
|
|
||||||
-- Create the session file, read it back in, and prepare for verification.
|
-- Create the session file, read it back in, and prepare for verification.
|
||||||
execute('mksession! test.out')
|
feed_command('mksession! test.out')
|
||||||
execute('new test.out')
|
feed_command('new test.out')
|
||||||
execute([[v/\(^ *normal! 0\|^ *exe 'normal!\)/d]])
|
feed_command([[v/\(^ *normal! 0\|^ *exe 'normal!\)/d]])
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([[
|
expect([[
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, insert = helpers.feed, helpers.insert
|
local feed, insert = helpers.feed, helpers.insert
|
||||||
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
if helpers.pending_win32(pending) then return end
|
if helpers.pending_win32(pending) then return end
|
||||||
|
|
||||||
@@ -30,13 +30,13 @@ describe('store cursor position in session file in Latin-1', function()
|
|||||||
A<><41><EFBFBD> three mulTibyte characters]])
|
A<><41><EFBFBD> three mulTibyte characters]])
|
||||||
-- Must write buffer to disk for :mksession. See the comments in
|
-- Must write buffer to disk for :mksession. See the comments in
|
||||||
-- "092_mksession_cursor_cols_utf8_spec.lua".
|
-- "092_mksession_cursor_cols_utf8_spec.lua".
|
||||||
execute('write! test.in')
|
feed_command('write! test.in')
|
||||||
|
|
||||||
execute('set sessionoptions=buffers splitbelow fileencoding=latin1')
|
feed_command('set sessionoptions=buffers splitbelow fileencoding=latin1')
|
||||||
|
|
||||||
-- Move the cursor through the buffer lines and position it with "|".
|
-- Move the cursor through the buffer lines and position it with "|".
|
||||||
execute('/^start:')
|
feed_command('/^start:')
|
||||||
execute('vsplit')
|
feed_command('vsplit')
|
||||||
feed('j16|:split<cr>')
|
feed('j16|:split<cr>')
|
||||||
feed('j16|:split<cr>')
|
feed('j16|:split<cr>')
|
||||||
feed('j16|:split<cr>')
|
feed('j16|:split<cr>')
|
||||||
@@ -48,9 +48,9 @@ describe('store cursor position in session file in Latin-1', function()
|
|||||||
|
|
||||||
-- Again move the cursor through the buffer and position it with "|". This
|
-- Again move the cursor through the buffer and position it with "|". This
|
||||||
-- time also perform a horizontal scroll at every step.
|
-- time also perform a horizontal scroll at every step.
|
||||||
execute('wincmd l')
|
feed_command('wincmd l')
|
||||||
execute('/^start:')
|
feed_command('/^start:')
|
||||||
execute('set nowrap')
|
feed_command('set nowrap')
|
||||||
feed('j16|3zl:split<cr>')
|
feed('j16|3zl:split<cr>')
|
||||||
feed('j016|3zl:split<cr>')
|
feed('j016|3zl:split<cr>')
|
||||||
feed('j016|3zl:split<cr>')
|
feed('j016|3zl:split<cr>')
|
||||||
@@ -61,9 +61,9 @@ describe('store cursor position in session file in Latin-1', function()
|
|||||||
feed('j016|3zl:split<cr>')
|
feed('j016|3zl:split<cr>')
|
||||||
|
|
||||||
-- Create the session file, read it back in, and prepare for verification.
|
-- Create the session file, read it back in, and prepare for verification.
|
||||||
execute('mksession! test.out')
|
feed_command('mksession! test.out')
|
||||||
execute('new test.out')
|
feed_command('new test.out')
|
||||||
execute([[v/\(^ *normal! 0\|^ *exe 'normal!\)/d]])
|
feed_command([[v/\(^ *normal! 0\|^ *exe 'normal!\)/d]])
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([[
|
expect([[
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
|
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
|
||||||
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
-- Vim script user functions needed for some of the test cases.
|
-- Vim script user functions needed for some of the test cases.
|
||||||
local function source_user_functions()
|
local function source_user_functions()
|
||||||
@@ -54,38 +54,38 @@ describe('Visual mode and operator', function()
|
|||||||
it('simple change in Visual mode', function()
|
it('simple change in Visual mode', function()
|
||||||
insert([[
|
insert([[
|
||||||
apple banana cherry
|
apple banana cherry
|
||||||
|
|
||||||
line 1 line 1
|
line 1 line 1
|
||||||
line 2 line 2
|
line 2 line 2
|
||||||
line 3 line 3
|
line 3 line 3
|
||||||
line 4 line 4
|
line 4 line 4
|
||||||
line 5 line 5
|
line 5 line 5
|
||||||
line 6 line 6
|
line 6 line 6
|
||||||
|
|
||||||
xxxxxxxxxxxxx
|
xxxxxxxxxxxxx
|
||||||
xxxxxxxxxxxxx
|
xxxxxxxxxxxxx
|
||||||
xxxxxxxxxxxxx
|
xxxxxxxxxxxxx
|
||||||
xxxxxxxxxxxxx]])
|
xxxxxxxxxxxxx]])
|
||||||
|
|
||||||
-- Exercise characterwise Visual mode plus operator, with count and repeat.
|
-- Exercise characterwise Visual mode plus operator, with count and repeat.
|
||||||
execute('/^apple')
|
feed_command('/^apple')
|
||||||
feed('lvld.l3vd.')
|
feed('lvld.l3vd.')
|
||||||
|
|
||||||
-- Same in linewise Visual mode.
|
-- Same in linewise Visual mode.
|
||||||
execute('/^line 1')
|
feed_command('/^line 1')
|
||||||
feed('Vcnewline<esc>j.j2Vd.')
|
feed('Vcnewline<esc>j.j2Vd.')
|
||||||
|
|
||||||
-- Same in blockwise Visual mode.
|
-- Same in blockwise Visual mode.
|
||||||
execute('/^xxxx')
|
feed_command('/^xxxx')
|
||||||
feed('<c-v>jlc <esc>l.l2<c-v>c----<esc>l.')
|
feed('<c-v>jlc <esc>l.l2<c-v>c----<esc>l.')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([[
|
expect([[
|
||||||
a y
|
a y
|
||||||
|
|
||||||
newline
|
newline
|
||||||
newline
|
newline
|
||||||
|
|
||||||
--------x
|
--------x
|
||||||
--------x
|
--------x
|
||||||
xxxx--------x
|
xxxx--------x
|
||||||
@@ -98,15 +98,15 @@ describe('Visual mode and operator', function()
|
|||||||
JambuRambutanBananaTangerineMango]])
|
JambuRambutanBananaTangerineMango]])
|
||||||
|
|
||||||
-- Set up Visual mode mappings.
|
-- Set up Visual mode mappings.
|
||||||
execute('vnoremap W /\\u/s-1<CR>')
|
feed_command('vnoremap W /\\u/s-1<CR>')
|
||||||
execute('vnoremap iW :<C-U>call SelectInCaps()<CR>')
|
feed_command('vnoremap iW :<C-U>call SelectInCaps()<CR>')
|
||||||
|
|
||||||
-- Do a simple change using the simple vmap, also with count and repeat.
|
-- Do a simple change using the simple vmap, also with count and repeat.
|
||||||
execute('/^Kiwi')
|
feed_command('/^Kiwi')
|
||||||
feed('vWcNo<esc>l.fD2vd.')
|
feed('vWcNo<esc>l.fD2vd.')
|
||||||
|
|
||||||
-- Same, using the vmap that maps to an Ex command.
|
-- Same, using the vmap that maps to an Ex command.
|
||||||
execute('/^Jambu')
|
feed_command('/^Jambu')
|
||||||
feed('llviWc-<esc>l.l2vdl.')
|
feed('llviWc-<esc>l.l2vdl.')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
@@ -122,20 +122,20 @@ describe('Visual mode and operator', function()
|
|||||||
LemonNectarineZ]])
|
LemonNectarineZ]])
|
||||||
|
|
||||||
-- Set up Operator-pending mode mappings.
|
-- Set up Operator-pending mode mappings.
|
||||||
execute('onoremap W /\\u/<CR>')
|
feed_command('onoremap W /\\u/<CR>')
|
||||||
execute('onoremap <Leader>W :<C-U>call MoveToCap()<CR>')
|
feed_command('onoremap <Leader>W :<C-U>call MoveToCap()<CR>')
|
||||||
execute('onoremap iW :<C-U>call SelectInCaps()<CR>')
|
feed_command('onoremap iW :<C-U>call SelectInCaps()<CR>')
|
||||||
|
|
||||||
-- Do a simple change using the simple omap, also with count and repeat.
|
-- Do a simple change using the simple omap, also with count and repeat.
|
||||||
execute('/^Pineapple')
|
feed_command('/^Pineapple')
|
||||||
feed('cW-<esc>l.l2.l.')
|
feed('cW-<esc>l.l2.l.')
|
||||||
|
|
||||||
-- Same, using the omap that maps to an Ex command to move the cursor.
|
-- Same, using the omap that maps to an Ex command to move the cursor.
|
||||||
execute('/^Juniper')
|
feed_command('/^Juniper')
|
||||||
feed('g?\\WfD.')
|
feed('g?\\WfD.')
|
||||||
|
|
||||||
-- Same, using the omap that uses Ex and Visual mode (custom text object).
|
-- Same, using the omap that uses Ex and Visual mode (custom text object).
|
||||||
execute('/^Lemon')
|
feed_command('/^Lemon')
|
||||||
feed('yiWPlciWNew<esc>fr.')
|
feed('yiWPlciWNew<esc>fr.')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
@@ -159,7 +159,7 @@ describe('Visual mode and operator', function()
|
|||||||
-- changed, taking into account the v/V/<c-v> modifier given; or
|
-- changed, taking into account the v/V/<c-v> modifier given; or
|
||||||
-- - abort the operation by pressing Escape: no change to the buffer is
|
-- - abort the operation by pressing Escape: no change to the buffer is
|
||||||
-- carried out.
|
-- carried out.
|
||||||
execute('/^zzzz')
|
feed_command('/^zzzz')
|
||||||
feed([[dV:<cr>dv:<cr>:set noma | let v:errmsg = ''<cr>]])
|
feed([[dV:<cr>dv:<cr>:set noma | let v:errmsg = ''<cr>]])
|
||||||
feed([[d:<cr>:set ma | put = v:errmsg =~# '^E21' ? 'ok' : 'failed'<cr>]])
|
feed([[d:<cr>:set ma | put = v:errmsg =~# '^E21' ? 'ok' : 'failed'<cr>]])
|
||||||
feed([[dv:<esc>dV:<esc>:set noma | let v:errmsg = ''<cr>]])
|
feed([[dv:<esc>dV:<esc>:set noma | let v:errmsg = ''<cr>]])
|
||||||
@@ -180,7 +180,7 @@ describe('Visual mode and operator', function()
|
|||||||
feed('v$p')
|
feed('v$p')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
x]])
|
x]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ describe('Visual mode and operator', function()
|
|||||||
feed('kkv$d')
|
feed('kkv$d')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
b
|
b
|
||||||
c]])
|
c]])
|
||||||
end)
|
end)
|
||||||
@@ -199,7 +199,7 @@ describe('Visual mode and operator', function()
|
|||||||
feed('kkvj$d')
|
feed('kkvj$d')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
c]])
|
c]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ describe('Visual mode and operator', function()
|
|||||||
feed('v$d')
|
feed('v$d')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
a
|
a
|
||||||
b
|
b
|
||||||
]])
|
]])
|
||||||
@@ -219,7 +219,7 @@ describe('Visual mode and operator', function()
|
|||||||
feed('kvj$d')
|
feed('kvj$d')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
a
|
a
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
@@ -235,7 +235,7 @@ describe('Visual mode and operator', function()
|
|||||||
feed('kkgh<End><Del>')
|
feed('kkgh<End><Del>')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
b
|
b
|
||||||
c]])
|
c]])
|
||||||
end)
|
end)
|
||||||
@@ -245,7 +245,7 @@ describe('Visual mode and operator', function()
|
|||||||
feed('kkgh<Down><End><Del>')
|
feed('kkgh<Down><End><Del>')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
c]])
|
c]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -254,7 +254,7 @@ describe('Visual mode and operator', function()
|
|||||||
feed('gh<End><Del>')
|
feed('gh<End><Del>')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
a
|
a
|
||||||
b
|
b
|
||||||
]])
|
]])
|
||||||
@@ -265,7 +265,7 @@ describe('Visual mode and operator', function()
|
|||||||
feed('kgh<Down><End><Del>')
|
feed('kgh<Down><End><Del>')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
a
|
a
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
@@ -281,7 +281,7 @@ describe('Visual mode and operator', function()
|
|||||||
feed(' kkgH<Del> ')
|
feed(' kkgH<Del> ')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
b
|
b
|
||||||
c]])
|
c]])
|
||||||
end)
|
end)
|
||||||
@@ -291,7 +291,7 @@ describe('Visual mode and operator', function()
|
|||||||
feed('kkgH<Down><Del>')
|
feed('kkgH<Down><Del>')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
c]])
|
c]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -300,7 +300,7 @@ describe('Visual mode and operator', function()
|
|||||||
feed('gH<Del>')
|
feed('gH<Del>')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
a
|
a
|
||||||
b]])
|
b]])
|
||||||
end)
|
end)
|
||||||
@@ -310,7 +310,7 @@ describe('Visual mode and operator', function()
|
|||||||
feed('kgH<Down><Del>')
|
feed('kgH<Down><Del>')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
a]])
|
a]])
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
@@ -318,25 +318,25 @@ describe('Visual mode and operator', function()
|
|||||||
describe('v_p:', function()
|
describe('v_p:', function()
|
||||||
it('replace last character with line register at middle line', function()
|
it('replace last character with line register at middle line', function()
|
||||||
put_aaabbbccc()
|
put_aaabbbccc()
|
||||||
execute('-2yank')
|
feed_command('-2yank')
|
||||||
feed('k$vp')
|
feed('k$vp')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
aaa
|
aaa
|
||||||
bb
|
bb
|
||||||
aaa
|
aaa
|
||||||
|
|
||||||
ccc]])
|
ccc]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('replace last character with line register at middle line selecting newline', function()
|
it('replace last character with line register at middle line selecting newline', function()
|
||||||
put_aaabbbccc()
|
put_aaabbbccc()
|
||||||
execute('-2yank')
|
feed_command('-2yank')
|
||||||
feed('k$v$p')
|
feed('k$v$p')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
aaa
|
aaa
|
||||||
bb
|
bb
|
||||||
aaa
|
aaa
|
||||||
@@ -345,11 +345,11 @@ describe('Visual mode and operator', function()
|
|||||||
|
|
||||||
it('replace last character with line register at last line', function()
|
it('replace last character with line register at last line', function()
|
||||||
put_aaabbbccc()
|
put_aaabbbccc()
|
||||||
execute('-2yank')
|
feed_command('-2yank')
|
||||||
feed('$vp')
|
feed('$vp')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
aaa
|
aaa
|
||||||
bbb
|
bbb
|
||||||
cc
|
cc
|
||||||
@@ -359,11 +359,11 @@ describe('Visual mode and operator', function()
|
|||||||
|
|
||||||
it('replace last character with line register at last line selecting newline', function()
|
it('replace last character with line register at last line selecting newline', function()
|
||||||
put_aaabbbccc()
|
put_aaabbbccc()
|
||||||
execute('-2yank')
|
feed_command('-2yank')
|
||||||
feed('$v$p')
|
feed('$v$p')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
aaa
|
aaa
|
||||||
bbb
|
bbb
|
||||||
cc
|
cc
|
||||||
@@ -380,7 +380,7 @@ describe('Visual mode and operator', function()
|
|||||||
feed('kv3lyjv3lpgvcxxx<Esc>')
|
feed('kv3lyjv3lpgvcxxx<Esc>')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
zzz
|
zzz
|
||||||
xxx ]])
|
xxx ]])
|
||||||
end)
|
end)
|
||||||
@@ -392,7 +392,7 @@ describe('Visual mode and operator', function()
|
|||||||
feed('0v3l<Esc>gvcxxx<Esc>')
|
feed('0v3l<Esc>gvcxxx<Esc>')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
xxx ]])
|
xxx ]])
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local source = helpers.source
|
local source = helpers.source
|
||||||
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
local clear, command, expect = helpers.clear, helpers.command, helpers.expect
|
||||||
|
|
||||||
describe('location list', function()
|
describe('location list', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -28,7 +28,7 @@ describe('location list', function()
|
|||||||
function! ReadTestProtocol(name)
|
function! ReadTestProtocol(name)
|
||||||
let base = substitute(a:name, '\v^test://(.*)%(\.[^.]+)?', '\1', '')
|
let base = substitute(a:name, '\v^test://(.*)%(\.[^.]+)?', '\1', '')
|
||||||
let word = substitute(base, '\v(.*)\..*', '\1', '')
|
let word = substitute(base, '\v(.*)\..*', '\1', '')
|
||||||
|
|
||||||
setl modifiable
|
setl modifiable
|
||||||
setl noreadonly
|
setl noreadonly
|
||||||
setl noswapfile
|
setl noswapfile
|
||||||
@@ -37,9 +37,9 @@ describe('location list', function()
|
|||||||
" For problem 2:
|
" For problem 2:
|
||||||
" 'buftype' has to be set to reproduce the constant opening of new windows.
|
" 'buftype' has to be set to reproduce the constant opening of new windows.
|
||||||
setl buftype=nofile
|
setl buftype=nofile
|
||||||
|
|
||||||
call setline(1, word)
|
call setline(1, word)
|
||||||
|
|
||||||
setl nomodified
|
setl nomodified
|
||||||
setl nomodifiable
|
setl nomodifiable
|
||||||
setl readonly
|
setl readonly
|
||||||
@@ -71,74 +71,77 @@ describe('location list', function()
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
-- Set up the result buffer "test.out".
|
-- Set up the result buffer "test.out".
|
||||||
execute('enew')
|
command('enew')
|
||||||
execute('w! test.out')
|
command('w! test.out')
|
||||||
execute('b 1')
|
command('b 1')
|
||||||
|
|
||||||
-- Test A.
|
-- Test A.
|
||||||
|
|
||||||
-- Open a new buffer as the sole window, rewind and open the prepopulated
|
-- Open a new buffer as the sole window, rewind and open the prepopulated
|
||||||
-- location list and navigate through the entries.
|
-- location list and navigate through the entries.
|
||||||
execute('lrewind')
|
command('lrewind')
|
||||||
execute('enew')
|
command('enew')
|
||||||
execute('lopen')
|
command('lopen')
|
||||||
execute('lnext', 'lnext', 'lnext', 'lnext')
|
command(('lnext|'):rep(4))
|
||||||
|
|
||||||
-- Split the window, copying the location list, then open the copied
|
-- Split the window, copying the location list, then open the copied
|
||||||
-- location list and again navigate forward.
|
-- location list and again navigate forward.
|
||||||
execute('vert split')
|
command('vert split')
|
||||||
execute('wincmd L')
|
command('wincmd L')
|
||||||
execute('lopen')
|
command('lopen')
|
||||||
execute('wincmd p')
|
command('wincmd p')
|
||||||
execute('lnext')
|
command('lnext')
|
||||||
|
|
||||||
-- Record the current file name and the file name of the corresponding
|
-- Record the current file name and the file name of the corresponding
|
||||||
-- location list entry, then open the result buffer.
|
-- location list entry, then open the result buffer.
|
||||||
execute('let fileName = expand("%")')
|
command('let fileName = expand("%")')
|
||||||
execute('wincmd p')
|
command('wincmd p')
|
||||||
execute([[let locationListFileName = substitute(getline(line('.')), '\([^|]*\)|.*', '\1', '')]])
|
command([[let locationListFileName = substitute(getline(line('.')), '\([^|]*\)|.*', '\1', '')]])
|
||||||
execute('wincmd n')
|
command('wincmd n')
|
||||||
execute('wincmd K')
|
command('wincmd K')
|
||||||
execute('b test.out')
|
command('b test.out')
|
||||||
|
|
||||||
-- Prepare test output and write it to the result buffer.
|
-- Prepare test output and write it to the result buffer.
|
||||||
execute([[let fileName = substitute(fileName, '\\', '/', 'g')]])
|
command([[let fileName = substitute(fileName, '\\', '/', 'g')]])
|
||||||
execute([[let locationListFileName = substitute(locationListFileName, '\\', '/', 'g')]])
|
command([[let locationListFileName = substitute(locationListFileName, '\\', '/', 'g')]])
|
||||||
execute([[call append(line('$'), "Test A:")]])
|
command([[call append(line('$'), "Test A:")]])
|
||||||
execute([[call append(line('$'), " - file name displayed: " . fileName)]])
|
command([[call append(line('$'), " - file name displayed: " . fileName)]])
|
||||||
execute([[call append(line('$'), " - quickfix claims that the file name displayed is: " . locationListFileName)]])
|
command([[call append(line('$'), " - quickfix claims that the file name displayed is: " . locationListFileName)]])
|
||||||
execute('w')
|
command('w')
|
||||||
|
|
||||||
-- Clean slate for the next test.
|
-- Clean slate for the next test.
|
||||||
execute('wincmd o')
|
command('wincmd o')
|
||||||
execute('b 1')
|
command('b 1')
|
||||||
|
|
||||||
-- Test B.
|
-- Test B.
|
||||||
|
|
||||||
-- Rewind the location list, then open it and browse through it by running
|
-- Rewind the location list, then open it and browse through it by running
|
||||||
-- ":{number}" followed by Enter repeatedly in the location list window.
|
-- ":{number}" followed by Enter repeatedly in the location list window.
|
||||||
execute('lrewind')
|
command('lrewind')
|
||||||
execute('lopen')
|
command('lopen')
|
||||||
execute('2', [[exe "normal \\<CR>"]])
|
command('2')
|
||||||
execute('wincmd p')
|
command([[exe "normal \\<CR>"]])
|
||||||
execute('3', [[exe "normal \<CR>"]])
|
command('wincmd p')
|
||||||
execute('wincmd p')
|
command('3')
|
||||||
execute('4', [[exe "normal \<CR>"]])
|
command([[exe "normal \<CR>"]])
|
||||||
|
command('wincmd p')
|
||||||
|
command('4')
|
||||||
|
command([[exe "normal \<CR>"]])
|
||||||
|
|
||||||
-- Record the number of windows open, then go back to the result buffer.
|
-- Record the number of windows open, then go back to the result buffer.
|
||||||
execute('let numberOfWindowsOpen = winnr("$")')
|
command('let numberOfWindowsOpen = winnr("$")')
|
||||||
execute('wincmd n')
|
command('wincmd n')
|
||||||
execute('wincmd K')
|
command('wincmd K')
|
||||||
execute('b test.out')
|
command('b test.out')
|
||||||
|
|
||||||
-- Prepare test output and write it to the result buffer.
|
-- Prepare test output and write it to the result buffer.
|
||||||
execute('call append(line("$"), "Test B:")')
|
command('call append(line("$"), "Test B:")')
|
||||||
execute('call append(line("$"), " - number of window open: " . numberOfWindowsOpen)')
|
command('call append(line("$"), " - number of window open: " . numberOfWindowsOpen)')
|
||||||
execute('w')
|
command('w')
|
||||||
|
|
||||||
-- Clean slate.
|
-- Clean slate.
|
||||||
execute('wincmd o')
|
command('wincmd o')
|
||||||
execute('b 1')
|
command('b 1')
|
||||||
|
|
||||||
-- Test C.
|
-- Test C.
|
||||||
|
|
||||||
@@ -146,38 +149,41 @@ describe('location list', function()
|
|||||||
-- Enter browsing. But this time, move the location list window to the top
|
-- Enter browsing. But this time, move the location list window to the top
|
||||||
-- to check whether it (the first window found) will be reused when we try
|
-- to check whether it (the first window found) will be reused when we try
|
||||||
-- to open new windows.
|
-- to open new windows.
|
||||||
execute('lrewind')
|
command('lrewind')
|
||||||
execute('lopen')
|
command('lopen')
|
||||||
execute('wincmd K')
|
command('wincmd K')
|
||||||
execute('2', [[exe "normal \<CR>"]])
|
command('2')
|
||||||
execute('wincmd p')
|
command([[exe "normal \<CR>"]])
|
||||||
execute('3', [[exe "normal \<CR>"]])
|
command('wincmd p')
|
||||||
execute('wincmd p')
|
command('3')
|
||||||
execute('4', [[exe "normal \<CR>"]])
|
command([[exe "normal \<CR>"]])
|
||||||
|
command('wincmd p')
|
||||||
|
command('4')
|
||||||
|
command([[exe "normal \<CR>"]])
|
||||||
|
|
||||||
-- Record the 'buftype' of window 1 (the location list) and the buffer name
|
-- Record the 'buftype' of window 1 (the location list) and the buffer name
|
||||||
-- of window 2 (the current "test protocol" buffer), then go back to the
|
-- of window 2 (the current "test protocol" buffer), then go back to the
|
||||||
-- result buffer.
|
-- result buffer.
|
||||||
execute('1wincmd w')
|
command('1wincmd w')
|
||||||
execute('let locationListWindowBufType = &buftype')
|
command('let locationListWindowBufType = &buftype')
|
||||||
execute('2wincmd w')
|
command('2wincmd w')
|
||||||
execute('let bufferName = expand("%")')
|
command('let bufferName = expand("%")')
|
||||||
execute('wincmd n')
|
command('wincmd n')
|
||||||
execute('wincmd K')
|
command('wincmd K')
|
||||||
execute('b test.out')
|
command('b test.out')
|
||||||
|
|
||||||
-- Prepare test output and write it to the result buffer.
|
-- Prepare test output and write it to the result buffer.
|
||||||
execute([[let bufferName = substitute(bufferName, '\\', '/', 'g')]])
|
command([[let bufferName = substitute(bufferName, '\\', '/', 'g')]])
|
||||||
execute([[call append(line("$"), "Test C:")]])
|
command([[call append(line("$"), "Test C:")]])
|
||||||
execute([[call append(line('$'), " - 'buftype' of the location list window: " . locationListWindowBufType)]])
|
command([[call append(line('$'), " - 'buftype' of the location list window: " . locationListWindowBufType)]])
|
||||||
execute([[call append(line('$'), " - buffer displayed in the 2nd window: " . bufferName)]])
|
command([[call append(line('$'), " - buffer displayed in the 2nd window: " . bufferName)]])
|
||||||
execute('w')
|
command('w')
|
||||||
execute('wincmd o')
|
command('wincmd o')
|
||||||
execute('b 1')
|
command('b 1')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
Test A:
|
Test A:
|
||||||
- file name displayed: test://bar.txt
|
- file name displayed: test://bar.txt
|
||||||
- quickfix claims that the file name displayed is: test://bar.txt
|
- quickfix claims that the file name displayed is: test://bar.txt
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local execute, expect = helpers.execute, helpers.expect
|
local command, expect = helpers.command, helpers.expect
|
||||||
|
|
||||||
if helpers.pending_win32(pending) then return end
|
if helpers.pending_win32(pending) then return end
|
||||||
|
|
||||||
@@ -19,26 +19,26 @@ describe('glob() and globpath()', function()
|
|||||||
|
|
||||||
it('is working', function()
|
it('is working', function()
|
||||||
-- Make sure glob() doesn't use the shell
|
-- Make sure glob() doesn't use the shell
|
||||||
execute('set shell=doesnotexist')
|
command('set shell=doesnotexist')
|
||||||
|
|
||||||
-- Consistent sorting of file names
|
-- Consistent sorting of file names
|
||||||
execute('set nofileignorecase')
|
command('set nofileignorecase')
|
||||||
|
|
||||||
execute([[$put =glob('Xxx\{')]])
|
command([[$put =glob('Xxx\{')]])
|
||||||
execute([[$put =glob('Xxx\$')]])
|
command([[$put =glob('Xxx\$')]])
|
||||||
|
|
||||||
execute('w! Xxx{')
|
command('silent w! Xxx{')
|
||||||
execute([[w! Xxx\$]])
|
command([[w! Xxx\$]])
|
||||||
execute([[$put =glob('Xxx\{')]])
|
command([[$put =glob('Xxx\{')]])
|
||||||
execute([[$put =glob('Xxx\$')]])
|
command([[$put =glob('Xxx\$')]])
|
||||||
|
|
||||||
execute("$put =string(globpath('sautest/autoload', '*.vim'))")
|
command("$put =string(globpath('sautest/autoload', '*.vim'))")
|
||||||
execute("$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
|
||||||
|
|||||||
@@ -2,52 +2,52 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear, feed = helpers.clear, helpers.feed
|
local clear, feed = helpers.clear, helpers.feed
|
||||||
local execute, expect = helpers.execute, helpers.expect
|
local feed_command, expect = helpers.feed_command, helpers.expect
|
||||||
|
|
||||||
describe('v:hlsearch', function()
|
describe('v:hlsearch', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
|
|
||||||
it('is working', function()
|
it('is working', function()
|
||||||
-- Last abc: Q
|
-- Last abc: Q
|
||||||
execute('new')
|
feed_command('new')
|
||||||
execute([[call setline(1, repeat(['aaa'], 10))]])
|
feed_command([[call setline(1, repeat(['aaa'], 10))]])
|
||||||
execute('set hlsearch nolazyredraw')
|
feed_command('set hlsearch nolazyredraw')
|
||||||
execute('let r=[]')
|
feed_command('let r=[]')
|
||||||
execute('command -nargs=0 -bar AddR :call add(r, [screenattr(1, 1), v:hlsearch])')
|
feed_command('command -nargs=0 -bar AddR :call add(r, [screenattr(1, 1), v:hlsearch])')
|
||||||
execute('/aaa')
|
feed_command('/aaa')
|
||||||
execute('AddR')
|
feed_command('AddR')
|
||||||
execute('nohlsearch')
|
feed_command('nohlsearch')
|
||||||
execute('AddR')
|
feed_command('AddR')
|
||||||
execute('let v:hlsearch=1')
|
feed_command('let v:hlsearch=1')
|
||||||
execute('AddR')
|
feed_command('AddR')
|
||||||
execute('let v:hlsearch=0')
|
feed_command('let v:hlsearch=0')
|
||||||
execute('AddR')
|
feed_command('AddR')
|
||||||
execute('set hlsearch')
|
feed_command('set hlsearch')
|
||||||
execute('AddR')
|
feed_command('AddR')
|
||||||
execute('let v:hlsearch=0')
|
feed_command('let v:hlsearch=0')
|
||||||
execute('AddR')
|
feed_command('AddR')
|
||||||
feed('n:AddR<cr>')
|
feed('n:AddR<cr>')
|
||||||
execute('let v:hlsearch=0')
|
feed_command('let v:hlsearch=0')
|
||||||
execute('AddR')
|
feed_command('AddR')
|
||||||
execute('/')
|
feed_command('/')
|
||||||
execute('AddR')
|
feed_command('AddR')
|
||||||
execute('set nohls')
|
feed_command('set nohls')
|
||||||
execute('/')
|
feed_command('/')
|
||||||
execute('AddR')
|
feed_command('AddR')
|
||||||
execute('let r1=r[0][0]')
|
feed_command('let r1=r[0][0]')
|
||||||
|
|
||||||
-- I guess it is not guaranteed that screenattr outputs always the same character
|
-- I guess it is not guaranteed that screenattr outputs always the same character
|
||||||
execute([[call map(r, 'v:val[1].":".(v:val[0]==r1?"highlighted":"not highlighted")')]])
|
feed_command([[call map(r, 'v:val[1].":".(v:val[0]==r1?"highlighted":"not highlighted")')]])
|
||||||
execute('try')
|
feed_command('try')
|
||||||
execute(' let v:hlsearch=[]')
|
feed_command(' let v:hlsearch=[]')
|
||||||
execute('catch')
|
feed_command('catch')
|
||||||
execute([[ call add(r, matchstr(v:exception,'^Vim(let):E\d\+:'))]])
|
feed_command([[ call add(r, matchstr(v:exception,'^Vim(let):E\d\+:'))]])
|
||||||
execute('endtry')
|
feed_command('endtry')
|
||||||
execute('bwipeout!')
|
feed_command('bwipeout!')
|
||||||
execute('$put=r')
|
feed_command('$put=r')
|
||||||
execute('call garbagecollect(1)')
|
feed_command('call garbagecollect(1)')
|
||||||
execute('call getchar()')
|
feed_command('call getchar()')
|
||||||
execute('1d', '1d')
|
feed_command('1d', '1d')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([[
|
expect([[
|
||||||
|
|||||||
@@ -2,19 +2,19 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local execute, expect = helpers.execute, helpers.expect
|
local command, expect = helpers.command, helpers.expect
|
||||||
|
|
||||||
describe('fnameescape', function()
|
describe('fnameescape', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
|
|
||||||
it('is working', function()
|
it('is working', function()
|
||||||
execute('let fname = "Xspa ce"')
|
command('let fname = "Xspa ce"')
|
||||||
execute('try', 'exe "w! " . fnameescape(fname)', "put='Space'", 'endtry')
|
command('try | exe "w! " . fnameescape(fname) | put=\'Space\' | endtry')
|
||||||
execute('let fname = "Xemark!"')
|
command('let fname = "Xemark!"')
|
||||||
execute('try', 'exe "w! " . fnameescape(fname)', "put='ExclamationMark'", 'endtry')
|
command('try | exe "w! " . fnameescape(fname) | put=\'ExclamationMark\' | endtry')
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
|
|
||||||
Space
|
Space
|
||||||
ExclamationMark]])
|
ExclamationMark]])
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear, source = helpers.clear, helpers.source
|
local clear, source = helpers.clear, helpers.source
|
||||||
local execute, expect = helpers.execute, helpers.expect
|
local command, expect = helpers.command, helpers.expect
|
||||||
|
|
||||||
describe(':let', function()
|
describe(':let', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
|
|
||||||
it('is working', function()
|
it('is working', function()
|
||||||
execute('set runtimepath+=test/functional/fixtures')
|
command('set runtimepath+=test/functional/fixtures')
|
||||||
|
|
||||||
-- Test to not autoload when assigning. It causes internal error.
|
-- Test to not autoload when assigning. It causes internal error.
|
||||||
source([[
|
source([[
|
||||||
@@ -34,7 +34,7 @@ describe(':let', function()
|
|||||||
endfor]])
|
endfor]])
|
||||||
|
|
||||||
-- Remove empty line
|
-- Remove empty line
|
||||||
execute('1d')
|
command('1d')
|
||||||
|
|
||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([[
|
expect([[
|
||||||
|
|||||||
@@ -2,19 +2,19 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local execute, expect = helpers.execute, helpers.expect
|
local command, expect = helpers.command, helpers.expect
|
||||||
|
|
||||||
describe('errorformat', function()
|
describe('errorformat', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
|
|
||||||
it('is working', function()
|
it('is working', function()
|
||||||
execute("set efm=%EEEE%m,%WWWW%m,%+CCCC%.%#,%-GGGG%.%#")
|
command("set efm=%EEEE%m,%WWWW%m,%+CCCC%.%#,%-GGGG%.%#")
|
||||||
execute("cgetexpr ['WWWW', 'EEEE', 'CCCC']")
|
command("cgetexpr ['WWWW', 'EEEE', 'CCCC']")
|
||||||
execute("$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))")
|
command("$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))")
|
||||||
execute("cgetexpr ['WWWW', 'GGGG', 'EEEE', 'CCCC']")
|
command("cgetexpr ['WWWW', 'GGGG', 'EEEE', 'CCCC']")
|
||||||
execute("$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))")
|
command("$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))")
|
||||||
execute("cgetexpr ['WWWW', 'GGGG', 'ZZZZ', 'EEEE', 'CCCC', 'YYYY']")
|
command("cgetexpr ['WWWW', 'GGGG', 'ZZZZ', 'EEEE', 'CCCC', 'YYYY']")
|
||||||
execute("$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))")
|
command("$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))")
|
||||||
|
|
||||||
expect([=[
|
expect([=[
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,11 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
|
|
||||||
|
local wait = helpers.wait
|
||||||
|
local clear = helpers.clear
|
||||||
local insert = helpers.insert
|
local insert = helpers.insert
|
||||||
local clear, execute = helpers.clear, helpers.execute
|
local command = helpers.command
|
||||||
|
|
||||||
if helpers.pending_win32(pending) then return end
|
if helpers.pending_win32(pending) then return end
|
||||||
|
|
||||||
@@ -15,31 +18,34 @@ describe('107', function()
|
|||||||
screen:attach()
|
screen:attach()
|
||||||
|
|
||||||
insert('start:')
|
insert('start:')
|
||||||
execute('new')
|
wait()
|
||||||
execute('call setline(1, range(1,256))')
|
command('new')
|
||||||
execute('let r=[]')
|
command('call setline(1, range(1,256))')
|
||||||
execute('func! GetScreenStr(row)')
|
command('let r=[]')
|
||||||
execute(' let str = ""')
|
command([[
|
||||||
execute(' for c in range(1,3)')
|
func! GetScreenStr(row)
|
||||||
execute(' let str .= nr2char(screenchar(a:row, c))')
|
let str = ""
|
||||||
execute(' endfor')
|
for c in range(1,3)
|
||||||
execute(' return str')
|
let str .= nr2char(screenchar(a:row, c))
|
||||||
execute('endfunc')
|
endfor
|
||||||
execute([[exe ":norm! \<C-W>t\<C-W>=1Gzt\<C-W>w\<C-W>+"]])
|
return str
|
||||||
execute('let s3=GetScreenStr(1)')
|
endfunc
|
||||||
execute('wincmd p')
|
]])
|
||||||
execute('call add(r, [line("w0"), s3])')
|
command([[exe ":norm! \<C-W>t\<C-W>=1Gzt\<C-W>w\<C-W>+"]])
|
||||||
execute([[exe ":norm! \<C-W>t\<C-W>=50Gzt\<C-W>w\<C-W>+"]])
|
command('let s3=GetScreenStr(1)')
|
||||||
execute('let s3=GetScreenStr(1)')
|
command('wincmd p')
|
||||||
execute('wincmd p')
|
command('call add(r, [line("w0"), s3])')
|
||||||
execute('call add(r, [line("w0"), s3])')
|
command([[exe ":norm! \<C-W>t\<C-W>=50Gzt\<C-W>w\<C-W>+"]])
|
||||||
execute([[exe ":norm! \<C-W>t\<C-W>=59Gzt\<C-W>w\<C-W>+"]])
|
command('let s3=GetScreenStr(1)')
|
||||||
execute('let s3=GetScreenStr(1)')
|
command('wincmd p')
|
||||||
execute(':wincmd p')
|
command('call add(r, [line("w0"), s3])')
|
||||||
execute('call add(r, [line("w0"), s3])')
|
command([[exe ":norm! \<C-W>t\<C-W>=59Gzt\<C-W>w\<C-W>+"]])
|
||||||
execute('bwipeout!')
|
command('let s3=GetScreenStr(1)')
|
||||||
execute('$put=r')
|
command(':wincmd p')
|
||||||
execute('call garbagecollect(1)')
|
command('call add(r, [line("w0"), s3])')
|
||||||
|
command('bwipeout!')
|
||||||
|
command('$put=r')
|
||||||
|
command('call garbagecollect(1)')
|
||||||
|
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
start: |
|
start: |
|
||||||
@@ -55,7 +61,7 @@ describe('107', function()
|
|||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
:call garbagecollect(1) |
|
3 more lines |
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user