aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/api/buffer_spec.lua2
-rw-r--r--test/functional/api/tabpage_spec.lua2
-rw-r--r--test/functional/api/vim_spec.lua58
-rw-r--r--test/functional/api/window_spec.lua2
-rw-r--r--test/functional/core/job_spec.lua2
-rw-r--r--test/functional/eval/timer_spec.lua1
-rw-r--r--test/functional/ex_cmds/digraphs_spec.lua14
-rw-r--r--test/functional/plugin/msgpack_spec.lua22
-rw-r--r--test/functional/ui/searchhl_spec.lua54
9 files changed, 123 insertions, 34 deletions
diff --git a/test/functional/api/buffer_spec.lua b/test/functional/api/buffer_spec.lua
index 958e2f68fc..271e196103 100644
--- a/test/functional/api/buffer_spec.lua
+++ b/test/functional/api/buffer_spec.lua
@@ -309,7 +309,7 @@ describe('api/buf', function()
eq(1, funcs.exists('b:lua'))
curbufmeths.del_var('lua')
eq(0, funcs.exists('b:lua'))
- eq({false, 'Key does not exist: lua'}, meth_pcall(curbufmeths.del_var, 'lua'))
+ eq({false, 'Key not found: lua'}, meth_pcall(curbufmeths.del_var, 'lua'))
curbufmeths.set_var('lua', 1)
command('lockvar b:lua')
eq({false, 'Key is locked: lua'}, meth_pcall(curbufmeths.del_var, 'lua'))
diff --git a/test/functional/api/tabpage_spec.lua b/test/functional/api/tabpage_spec.lua
index 260a91a80c..c49091db02 100644
--- a/test/functional/api/tabpage_spec.lua
+++ b/test/functional/api/tabpage_spec.lua
@@ -34,7 +34,7 @@ describe('api/tabpage', function()
eq(1, funcs.exists('t:lua'))
curtabmeths.del_var('lua')
eq(0, funcs.exists('t:lua'))
- eq({false, 'Key does not exist: lua'}, meth_pcall(curtabmeths.del_var, 'lua'))
+ eq({false, 'Key not found: lua'}, meth_pcall(curtabmeths.del_var, 'lua'))
curtabmeths.set_var('lua', 1)
command('lockvar t:lua')
eq({false, 'Key is locked: lua'}, meth_pcall(curtabmeths.del_var, 'lua'))
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index ae8a8488d4..5261f57ca7 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -24,13 +24,25 @@ describe('API', function()
before_each(clear)
it('validates requests', function()
- expect_err('Invalid method: bogus',
+ -- RPC
+ expect_err('Invalid method: bogus$',
request, 'bogus')
- expect_err('Invalid method: … の り 。…',
+ expect_err('Invalid method: … の り 。…$',
request, '… の り 。…')
- expect_err('Invalid method: <empty>',
+ expect_err('Invalid method: <empty>$',
request, '')
- expect_err("can't serialize object",
+
+ -- Non-RPC: rpcrequest(v:servername) uses internal channel.
+ expect_err('Invalid method: … の り 。…$',
+ request, 'nvim_eval',
+ [=[rpcrequest(sockconnect('pipe', v:servername, {'rpc':1}), '… の り 。…')]=])
+ expect_err('Invalid method: bogus$',
+ request, 'nvim_eval',
+ [=[rpcrequest(sockconnect('pipe', v:servername, {'rpc':1}), 'bogus')]=])
+
+ -- XXX: This must be the last one, else next one will fail:
+ -- "Packer instance already working. Use another Packer ..."
+ expect_err("can't serialize object$",
request, nil)
end)
@@ -158,7 +170,7 @@ describe('API', function()
end)
it("VimL error: returns error details, does NOT update v:errmsg", function()
- expect_err('E121: Undefined variable: bogus', request,
+ expect_err('E121: Undefined variable: bogus$', request,
'nvim_eval', 'bogus expression')
eq('', eval('v:errmsg')) -- v:errmsg was not updated.
end)
@@ -173,7 +185,7 @@ describe('API', function()
end)
it("VimL validation error: returns specific error, does NOT update v:errmsg", function()
- expect_err('E117: Unknown function: bogus function', request,
+ expect_err('E117: Unknown function: bogus function$', request,
'nvim_call_function', 'bogus function', {'arg1'})
expect_err('E119: Not enough arguments for function: atan', request,
'nvim_call_function', 'atan', {})
@@ -182,11 +194,11 @@ describe('API', function()
end)
it("VimL error: returns error details, does NOT update v:errmsg", function()
- expect_err('E808: Number or Float required', request,
+ expect_err('E808: Number or Float required$', request,
'nvim_call_function', 'atan', {'foo'})
- expect_err('Invalid channel stream "xxx"', request,
+ expect_err('Invalid channel stream "xxx"$', request,
'nvim_call_function', 'chanclose', {999, 'xxx'})
- expect_err('E900: Invalid channel id', request,
+ expect_err('E900: Invalid channel id$', request,
'nvim_call_function', 'chansend', {999, 'foo'})
eq('', eval('v:exception'))
eq('', eval('v:errmsg')) -- v:errmsg was not updated.
@@ -198,7 +210,7 @@ describe('API', function()
throw 'wtf'
endfunction
]])
- expect_err('wtf', request,
+ expect_err('wtf$', request,
'nvim_call_function', 'Foo', {})
eq('', eval('v:exception'))
eq('', eval('v:errmsg')) -- v:errmsg was not updated.
@@ -212,7 +224,7 @@ describe('API', function()
endfunction
]])
-- E740
- expect_err('Function called with too many arguments', request,
+ expect_err('Function called with too many arguments$', request,
'nvim_call_function', 'Foo', too_many_args)
end)
end)
@@ -248,23 +260,23 @@ describe('API', function()
it('validates args', function()
command('let g:d={"baz":"zub","meep":[]}')
- expect_err('Not found: bogus', request,
+ expect_err('Not found: bogus$', request,
'nvim_call_dict_function', 'g:d', 'bogus', {1,2})
- expect_err('Not a function: baz', request,
+ expect_err('Not a function: baz$', request,
'nvim_call_dict_function', 'g:d', 'baz', {1,2})
- expect_err('Not a function: meep', request,
+ expect_err('Not a function: meep$', request,
'nvim_call_dict_function', 'g:d', 'meep', {1,2})
- expect_err('E117: Unknown function: f', request,
+ expect_err('E117: Unknown function: f$', request,
'nvim_call_dict_function', { f = '' }, 'f', {1,2})
- expect_err('Not a function: f', request,
+ expect_err('Not a function: f$', request,
'nvim_call_dict_function', "{ 'f': '' }", 'f', {1,2})
- expect_err('dict argument type must be String or Dictionary', request,
+ expect_err('dict argument type must be String or Dictionary$', request,
'nvim_call_dict_function', 42, 'f', {1,2})
- expect_err('Failed to evaluate dict expression', request,
+ expect_err('Failed to evaluate dict expression$', request,
'nvim_call_dict_function', 'foo', 'f', {1,2})
- expect_err('dict not found', request,
+ expect_err('dict not found$', request,
'nvim_call_dict_function', '42', 'f', {1,2})
- expect_err('Invalid %(empty%) function name', request,
+ expect_err('Invalid %(empty%) function name$', request,
'nvim_call_dict_function', "{ 'f': '' }", '', {1,2})
end)
end)
@@ -337,7 +349,7 @@ describe('API', function()
eq(1, funcs.exists('g:lua'))
meths.del_var('lua')
eq(0, funcs.exists('g:lua'))
- eq({false, 'Key does not exist: lua'}, meth_pcall(meths.del_var, 'lua'))
+ eq({false, "Key not found: lua"}, meth_pcall(meths.del_var, 'lua'))
meths.set_var('lua', 1)
command('lockvar lua')
eq({false, 'Key is locked: lua'}, meth_pcall(meths.del_var, 'lua'))
@@ -948,7 +960,7 @@ describe('API', function()
}
local status, err = pcall(meths.call_atomic, req)
eq(false, status)
- ok(err:match(' All items in calls array must be arrays of size 2') ~= nil)
+ ok(err:match('Items in calls array must be arrays of size 2') ~= nil)
-- call before was done, but not after
eq(1, meths.get_var('avar'))
@@ -958,7 +970,7 @@ describe('API', function()
}
status, err = pcall(meths.call_atomic, req)
eq(false, status)
- ok(err:match('All items in calls array must be arrays') ~= nil)
+ ok(err:match('Items in calls array must be arrays') ~= nil)
eq({2,3}, meths.get_var('bvar'))
req = {
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua
index d404ef5426..27d7aa11b4 100644
--- a/test/functional/api/window_spec.lua
+++ b/test/functional/api/window_spec.lua
@@ -169,7 +169,7 @@ describe('api/win', function()
eq(1, funcs.exists('w:lua'))
curwinmeths.del_var('lua')
eq(0, funcs.exists('w:lua'))
- eq({false, 'Key does not exist: lua'}, meth_pcall(curwinmeths.del_var, 'lua'))
+ eq({false, 'Key not found: lua'}, meth_pcall(curwinmeths.del_var, 'lua'))
curwinmeths.set_var('lua', 1)
command('lockvar w:lua')
eq({false, 'Key is locked: lua'}, meth_pcall(curwinmeths.del_var, 'lua'))
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index feb9c9aeaa..f8488ca7a3 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -663,7 +663,7 @@ describe('jobs', function()
call rpcnotify(g:channel, 'wait', jobwait([
\ jobstart('exit 4'),
\ jobstart((has('win32') ? 'Start-Sleep 10' : 'sleep 10').'; exit 5'),
- \ ], has('win32') ? 3000 : 100))
+ \ ], has('win32') ? 6000 : 100))
]])
eq({'notification', 'wait', {{4, -1}}}, next_msg())
end)
diff --git a/test/functional/eval/timer_spec.lua b/test/functional/eval/timer_spec.lua
index 2dd9968a01..8afc3592cc 100644
--- a/test/functional/eval/timer_spec.lua
+++ b/test/functional/eval/timer_spec.lua
@@ -96,6 +96,7 @@ describe('timers', function()
source([[
func! AddItem(timer)
call nvim_buf_set_lines(0, 2, 2, v:true, ['ITEM 3'])
+ call getchar(1)
redraw
endfunc
call timer_start(200, 'AddItem')
diff --git a/test/functional/ex_cmds/digraphs_spec.lua b/test/functional/ex_cmds/digraphs_spec.lua
index f2d0b76739..37d3814136 100644
--- a/test/functional/ex_cmds/digraphs_spec.lua
+++ b/test/functional/ex_cmds/digraphs_spec.lua
@@ -23,13 +23,13 @@ describe(':digraphs', function()
it('displays digraphs', function()
feed(':digraphs<CR>')
screen:expect([[
- A@ {6:Å} 197 E` {6:È} 200 E^ {6:Ê} 202 E" {6:Ë} 203 I` {6:Ì} 204 |
- I^ {6:Î} 206 I" {6:Ï} 207 N~ {6:Ñ} 209 O` {6:Ò} 210 O^ {6:Ô} 212 |
- O~ {6:Õ} 213 /\ {6:×} 215 U` {6:Ù} 217 U^ {6:Û} 219 Ip {6:Þ} 222 |
- a` {6:à} 224 a^ {6:â} 226 a~ {6:ã} 227 a" {6:ä} 228 a@ {6:å} 229 |
- e` {6:è} 232 e^ {6:ê} 234 e" {6:ë} 235 i` {6:ì} 236 i^ {6:î} 238 |
- n~ {6:ñ} 241 o` {6:ò} 242 o^ {6:ô} 244 o~ {6:õ} 245 u` {6:ù} 249 |
- u^ {6:û} 251 y" {6:ÿ} 255 |
+ E` {6:È} 200 E^ {6:Ê} 202 E" {6:Ë} 203 I` {6:Ì} 204 I^ {6:Î} 206 |
+ I" {6:Ï} 207 N~ {6:Ñ} 209 O` {6:Ò} 210 O^ {6:Ô} 212 O~ {6:Õ} 213 |
+ /\ {6:×} 215 U` {6:Ù} 217 U^ {6:Û} 219 Ip {6:Þ} 222 a` {6:à} 224 |
+ a^ {6:â} 226 a~ {6:ã} 227 a" {6:ä} 228 a@ {6:å} 229 e` {6:è} 232 |
+ e^ {6:ê} 234 e" {6:ë} 235 i` {6:ì} 236 i^ {6:î} 238 n~ {6:ñ} 241 |
+ o` {6:ò} 242 o^ {6:ô} 244 o~ {6:õ} 245 u` {6:ù} 249 u^ {6:û} 251 |
+ y" {6:ÿ} 255 |
{3:Press ENTER or type command to continue}^ |
]])
end)
diff --git a/test/functional/plugin/msgpack_spec.lua b/test/functional/plugin/msgpack_spec.lua
index 4b014cbc73..2ce9974812 100644
--- a/test/functional/plugin/msgpack_spec.lua
+++ b/test/functional/plugin/msgpack_spec.lua
@@ -581,6 +581,8 @@ describe('autoload/msgpack.vim', function()
eval_eq('binary', {'', 'abc', '', '', 'def'}, '"\\nabc\\n\\n\\ndef"')
eval_eq('binary', {''}, '""')
eval_eq('binary', {'"'}, '"\\""')
+ eval_eq('binary', {'py3 print(sys.version_info)'},
+ '"py3 print(sys.version_info)"')
end)
it('correctly loads strings', function()
@@ -595,6 +597,8 @@ describe('autoload/msgpack.vim', function()
eval_eq('string', {'', 'abc', '', '', 'def'}, '="\\nabc\\n\\n\\ndef"')
eval_eq('string', {''}, '=""')
eval_eq('string', {'"'}, '="\\""')
+ eval_eq('string', {'py3 print(sys.version_info)'},
+ '="py3 print(sys.version_info)"')
end)
it('correctly loads ext values', function()
@@ -625,6 +629,9 @@ describe('autoload/msgpack.vim', function()
'+(-1)"\\nabc\\n\\n\\ndef"')
eval_eq('ext', {-1, {''}}, '+(-1)""')
eval_eq('ext', {-1, {'"'}}, '+(-1)"\\""')
+
+ eval_eq('ext', {42, {'py3 print(sys.version_info)'}},
+ '+(42)"py3 print(sys.version_info)"')
end)
it('correctly loads floats', function()
@@ -676,6 +683,13 @@ describe('autoload/msgpack.vim', function()
eval_eq('map', {{{_TYPE={}, _VAL={{1, 2}}}, {_TYPE={}, _VAL={{3, 4}}}},
{1, 2}},
'{{1: 2}: {3: 4}, 1: 2}')
+
+ eval_eq('map', {{{_TYPE={}, _VAL={
+ {{_TYPE={}, _VAL={'py3 print(sys.version_info)'}},
+ 2}}},
+ {_TYPE={}, _VAL={{3, 4}}}},
+ {1, 2}},
+ '{{"py3 print(sys.version_info)": 2}: {3: 4}, 1: 2}')
end)
it('correctly loads arrays', function()
@@ -684,6 +698,9 @@ describe('autoload/msgpack.vim', function()
eval_eq('array', {{_TYPE={}, _VAL=1}}, '[TRUE]')
eval_eq('array', {{{_TYPE={}, _VAL={{1, 2}}}}, {_TYPE={}, _VAL={{3, 4}}}},
'[[{1: 2}], {3: 4}]')
+
+ eval_eq('array', {{_TYPE={}, _VAL={'py3 print(sys.version_info)'}}},
+ '["py3 print(sys.version_info)"]')
end)
it('errors out when needed', function()
@@ -711,6 +728,11 @@ describe('autoload/msgpack.vim', function()
exc_exec('call msgpack#eval("0x", {})'))
eq('name-unknown:Unknown name FOO: FOO',
exc_exec('call msgpack#eval("FOO", {})'))
+
+ eq('name-unknown:Unknown name py3: py3 print(sys.version_info)',
+ exc_exec('call msgpack#eval("py3 print(sys.version_info)", {})'))
+ eq('name-unknown:Unknown name o: o',
+ exc_exec('call msgpack#eval("-info", {})'))
end)
end)
end)
diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua
index 168080a092..b535092ab9 100644
--- a/test/functional/ui/searchhl_spec.lua
+++ b/test/functional/ui/searchhl_spec.lua
@@ -1,6 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local command = helpers.command
local feed_command = helpers.feed_command
local eq = helpers.eq
local eval = helpers.eval
@@ -93,6 +94,59 @@ describe('search highlighting', function()
]])
end)
+ it('highlights after EOL', function()
+ insert("\n\n\n\n\n\n")
+
+ feed("gg/^<cr>")
+ screen:expect([[
+ {2: } |
+ {2:^ } |
+ {2: } |
+ {2: } |
+ {2: } |
+ {2: } |
+ /^ |
+ ]])
+
+ -- Test that highlights are preserved after moving the cursor.
+ feed("j")
+ screen:expect([[
+ {2: } |
+ {2: } |
+ {2:^ } |
+ {2: } |
+ {2: } |
+ {2: } |
+ /^ |
+ ]])
+
+ -- Repeat the test in rightleft mode.
+ command("nohlsearch")
+ command("set rightleft")
+ feed("gg/^<cr>")
+
+ screen:expect([[
+ {2: }|
+ {2:^ }|
+ {2: }|
+ {2: }|
+ {2: }|
+ {2: }|
+ ^/ |
+ ]])
+
+ feed("j")
+ screen:expect([[
+ {2: }|
+ {2: }|
+ {2:^ }|
+ {2: }|
+ {2: }|
+ {2: }|
+ ^/ |
+ ]])
+ end)
+
it('is preserved during :terminal activity', function()
if iswin() then
feed([[:terminal for /L \%I in (1,1,5000) do @(echo xxx & echo xxx & echo xxx)<cr>]])