aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/api/highlight_spec.lua2
-rw-r--r--test/functional/api/vim_spec.lua55
-rw-r--r--test/functional/core/exit_spec.lua6
-rw-r--r--test/functional/core/job_spec.lua9
-rw-r--r--test/functional/editor/ctrl_c_spec.lua12
-rw-r--r--test/functional/ex_cmds/oldfiles_spec.lua3
-rw-r--r--test/functional/ex_cmds/source_spec.lua65
-rw-r--r--test/functional/ex_cmds/wincmd_spec.lua13
-rw-r--r--test/functional/helpers.lua4
-rw-r--r--test/functional/legacy/arglist_spec.lua2
-rw-r--r--test/functional/legacy/ex_mode_spec.lua4
-rw-r--r--test/functional/legacy/excmd_spec.lua6
-rw-r--r--test/functional/legacy/filechanged_spec.lua9
-rw-r--r--test/functional/legacy/gf_spec.lua15
-rw-r--r--test/functional/legacy/global_spec.lua6
-rw-r--r--test/functional/legacy/mapping_spec.lua18
-rw-r--r--test/functional/legacy/messages_spec.lua89
-rw-r--r--test/functional/lua/overrides_spec.lua45
-rw-r--r--test/functional/options/defaults_spec.lua30
-rw-r--r--test/functional/provider/clipboard_spec.lua10
-rw-r--r--test/functional/terminal/tui_spec.lua41
-rw-r--r--test/functional/ui/cmdline_highlight_spec.lua74
-rw-r--r--test/functional/ui/decorations_spec.lua38
-rw-r--r--test/functional/ui/fold_spec.lua7
-rw-r--r--test/functional/ui/highlight_spec.lua341
-rw-r--r--test/functional/ui/hlstate_spec.lua20
-rw-r--r--test/functional/ui/inccommand_spec.lua17
-rw-r--r--test/functional/ui/inccommand_user_spec.lua347
-rw-r--r--test/functional/ui/input_spec.lua29
-rw-r--r--test/functional/ui/messages_spec.lua13
-rw-r--r--test/functional/ui/mouse_spec.lua2
-rw-r--r--test/functional/ui/output_spec.lua29
-rw-r--r--test/functional/ui/screen.lua8
-rw-r--r--test/functional/ui/statusline_spec.lua2
-rw-r--r--test/functional/ui/winbar_spec.lua134
-rw-r--r--test/functional/vimscript/null_spec.lua2
-rw-r--r--test/functional/vimscript/special_vars_spec.lua6
37 files changed, 1146 insertions, 367 deletions
diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua
index c4197f0b3e..2730f7e23d 100644
--- a/test/functional/api/highlight_spec.lua
+++ b/test/functional/api/highlight_spec.lua
@@ -243,7 +243,7 @@ describe("API: set highlight", function()
local function get_ns()
local ns = meths.create_namespace('Test_set_hl')
- meths._set_hl_ns(ns)
+ meths.set_hl_ns(ns)
return ns
end
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index fe623ff824..72a03c409a 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -281,8 +281,8 @@ describe('API', function()
]]}
end)
- it('does\'t display messages when output=true', function()
- local screen = Screen.new(40, 8)
+ it('doesn\'t display messages when output=true', function()
+ local screen = Screen.new(40, 6)
screen:attach()
screen:set_default_attr_ids({
[0] = {bold=true, foreground=Screen.colors.Blue},
@@ -294,9 +294,21 @@ describe('API', function()
{0:~ }|
{0:~ }|
{0:~ }|
+ |
+ ]]}
+ exec([[
+ func Print()
+ call nvim_exec('echo "hello"', v:true)
+ endfunc
+ ]])
+ feed([[:echon 1 | call Print() | echon 5<CR>]])
+ screen:expect{grid=[[
+ ^ |
{0:~ }|
{0:~ }|
- |
+ {0:~ }|
+ {0:~ }|
+ 15 |
]]}
end)
end)
@@ -3829,5 +3841,42 @@ describe('API', function()
eq({'aa'}, meths.buf_get_lines(0, 0, 1, false))
assert_alive()
end)
+ it("'make' command works when argument count isn't 1 #19696", function()
+ command('set makeprg=echo')
+ meths.cmd({ cmd = 'make' }, {})
+ assert_alive()
+ meths.cmd({ cmd = 'make', args = { 'foo', 'bar' } }, {})
+ assert_alive()
+ end)
+ it('doesn\'t display messages when output=true', function()
+ local screen = Screen.new(40, 6)
+ screen:attach()
+ screen:set_default_attr_ids({
+ [0] = {bold=true, foreground=Screen.colors.Blue},
+ })
+ meths.cmd({cmd = 'echo', args = {[['hello']]}}, {output = true})
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]]}
+ exec([[
+ func Print()
+ call nvim_cmd(#{cmd: 'echo', args: ['"hello"']}, #{output: v:true})
+ endfunc
+ ]])
+ feed([[:echon 1 | call Print() | echon 5<CR>]])
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ 15 |
+ ]]}
+ end)
end)
end)
diff --git a/test/functional/core/exit_spec.lua b/test/functional/core/exit_spec.lua
index 4dba58dbfc..8cad7adfa6 100644
--- a/test/functional/core/exit_spec.lua
+++ b/test/functional/core/exit_spec.lua
@@ -3,6 +3,7 @@ local helpers = require('test.functional.helpers')(after_each)
local assert_alive = helpers.assert_alive
local command = helpers.command
local feed_command = helpers.feed_command
+local feed = helpers.feed
local eval = helpers.eval
local eq = helpers.eq
local run = helpers.run
@@ -36,11 +37,12 @@ describe('v:exiting', function()
end
run(on_request, nil, on_setup)
end)
- it('is 0 on exit from ex-mode involving try-catch', function()
+ it('is 0 on exit from Ex mode involving try-catch vim-patch:8.0.0184', function()
local function on_setup()
command('autocmd VimLeavePre * call rpcrequest('..cid..', "")')
command('autocmd VimLeave * call rpcrequest('..cid..', "")')
- feed_command('call feedkey("Q")','try', 'call NoFunction()', 'catch', 'echo "bye"', 'endtry', 'quit')
+ feed('gQ')
+ feed_command('try', 'call NoFunction()', 'catch', 'echo "bye"', 'endtry', 'quit')
end
local function on_request()
eq(0, eval('v:exiting'))
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index 04fbb807be..02ff18bdda 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -21,6 +21,7 @@ local nvim_set = helpers.nvim_set
local expect_twostreams = helpers.expect_twostreams
local expect_msg_seq = helpers.expect_msg_seq
local pcall_err = helpers.pcall_err
+local matches = helpers.matches
local Screen = require('test.functional.ui.screen')
describe('jobs', function()
@@ -229,8 +230,8 @@ describe('jobs', function()
local dir = 'Xtest_not_executable_dir'
mkdir(dir)
funcs.setfperm(dir, 'rw-------')
- eq('Vim(call):E475: Invalid argument: expected valid directory',
- pcall_err(nvim, 'command', "call jobstart('pwd', {'cwd': '"..dir.."'})"))
+ matches('^Vim%(call%):E903: Process failed to start: permission denied: .*',
+ pcall_err(nvim, 'command', "call jobstart(['pwd'], {'cwd': '"..dir.."'})"))
rmdir(dir)
end)
@@ -690,8 +691,8 @@ describe('jobs', function()
-- jobstart() shares its v:servername with the child via $NVIM.
eq('NVIM='..addr, get_env_in_child_job('NVIM'))
-- $NVIM_LISTEN_ADDRESS is unset by server_init in the child.
- eq('NVIM_LISTEN_ADDRESS=null', get_env_in_child_job('NVIM_LISTEN_ADDRESS'))
- eq('NVIM_LISTEN_ADDRESS=null', get_env_in_child_job('NVIM_LISTEN_ADDRESS',
+ eq('NVIM_LISTEN_ADDRESS=v:null', get_env_in_child_job('NVIM_LISTEN_ADDRESS'))
+ eq('NVIM_LISTEN_ADDRESS=v:null', get_env_in_child_job('NVIM_LISTEN_ADDRESS',
{ NVIM_LISTEN_ADDRESS='Xtest_jobstart_env' }))
-- User can explicitly set $NVIM_LOG_FILE, $VIM, $VIMRUNTIME.
eq('NVIM_LOG_FILE=Xtest_jobstart_env',
diff --git a/test/functional/editor/ctrl_c_spec.lua b/test/functional/editor/ctrl_c_spec.lua
index 60131bf2a4..4548e1aa34 100644
--- a/test/functional/editor/ctrl_c_spec.lua
+++ b/test/functional/editor/ctrl_c_spec.lua
@@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, source = helpers.clear, helpers.feed, helpers.source
local command = helpers.command
+local poke_eventloop = helpers.poke_eventloop
local sleep = helpers.sleep
describe("CTRL-C (mapped)", function()
@@ -57,11 +58,9 @@ describe("CTRL-C (mapped)", function()
it('interrupts :sleep', function()
command('nnoremap <C-C> <Nop>')
feed(':sleep 100<CR>')
- -- wait for :sleep to start
- sleep(10)
+ poke_eventloop() -- wait for :sleep to start
feed('foo<C-C>')
- -- wait for input buffer to be flushed
- sleep(10)
+ poke_eventloop() -- wait for input buffer to be flushed
feed('i')
screen:expect([[
^ |
@@ -77,10 +76,9 @@ describe("CTRL-C (mapped)", function()
command('nnoremap <C-C> <Nop>')
command('nmap <F2> <Ignore><F2>')
feed('<F2>')
- sleep(10)
+ sleep(10) -- wait for the key to enter typeahead
feed('foo<C-C>')
- -- wait for input buffer to be flushed
- sleep(10)
+ poke_eventloop() -- wait for input buffer to be flushed
feed('i')
screen:expect([[
^ |
diff --git a/test/functional/ex_cmds/oldfiles_spec.lua b/test/functional/ex_cmds/oldfiles_spec.lua
index 003ab64dd4..5f87c3cdd9 100644
--- a/test/functional/ex_cmds/oldfiles_spec.lua
+++ b/test/functional/ex_cmds/oldfiles_spec.lua
@@ -29,7 +29,6 @@ describe(':oldfiles', function()
it('shows most recently used files', function()
local screen = Screen.new(100, 5)
screen:attach()
- feed_command("set display-=msgsep")
feed_command('edit testfile1')
feed_command('edit testfile2')
feed_command('wshada')
@@ -37,7 +36,7 @@ describe(':oldfiles', function()
local oldfiles = helpers.meths.get_vvar('oldfiles')
feed_command('oldfiles')
screen:expect([[
- testfile2 |
+ |
1: ]].. add_padding(oldfiles[1]) ..[[ |
2: ]].. add_padding(oldfiles[2]) ..[[ |
|
diff --git a/test/functional/ex_cmds/source_spec.lua b/test/functional/ex_cmds/source_spec.lua
index 13a40fcc53..163ded43f9 100644
--- a/test/functional/ex_cmds/source_spec.lua
+++ b/test/functional/ex_cmds/source_spec.lua
@@ -13,6 +13,10 @@ local exec_lua = helpers.exec_lua
local eval = helpers.eval
local exec_capture = helpers.exec_capture
local neq = helpers.neq
+local matches = helpers.matches
+local iswin = helpers.iswin
+local mkdir = helpers.mkdir
+local rmdir = helpers.rmdir
describe(':source', function()
before_each(function()
@@ -39,6 +43,47 @@ describe(':source', function()
os.remove(test_file)
end)
+ it("changing 'shellslash' changes the result of expand()", function()
+ if not iswin() then
+ pending("'shellslash' only works on Windows")
+ return
+ end
+ meths.set_option('shellslash', false)
+ mkdir('Xshellslash')
+
+ write_file([[Xshellslash/Xstack.vim]], [[
+ let g:stack1 = expand('<stack>')
+ set shellslash
+ let g:stack2 = expand('<stack>')
+ set noshellslash
+ let g:stack3 = expand('<stack>')
+ ]])
+
+ for _ = 1, 2 do
+ command([[source Xshellslash/Xstack.vim]])
+ matches([[Xshellslash\Xstack%.vim]], meths.get_var('stack1'))
+ matches([[Xshellslash/Xstack%.vim]], meths.get_var('stack2'))
+ matches([[Xshellslash\Xstack%.vim]], meths.get_var('stack3'))
+ end
+
+ write_file([[Xshellslash/Xstack.lua]], [[
+ vim.g.stack1 = vim.fn.expand('<stack>')
+ vim.o.shellslash = true
+ vim.g.stack2 = vim.fn.expand('<stack>')
+ vim.o.shellslash = false
+ vim.g.stack3 = vim.fn.expand('<stack>')
+ ]])
+
+ for _ = 1, 2 do
+ command([[source Xshellslash/Xstack.lua]])
+ matches([[Xshellslash\Xstack%.lua]], meths.get_var('stack1'))
+ matches([[Xshellslash/Xstack%.lua]], meths.get_var('stack2'))
+ matches([[Xshellslash\Xstack%.lua]], meths.get_var('stack3'))
+ end
+
+ rmdir('Xshellslash')
+ end)
+
it('current buffer', function()
insert([[
let a = 2
@@ -117,11 +162,18 @@ describe(':source', function()
it('can source lua files', function()
local test_file = 'test.lua'
- write_file (test_file, [[vim.g.sourced_lua = 1]])
-
- exec('source ' .. test_file)
+ write_file(test_file, [[
+ vim.g.sourced_lua = 1
+ vim.g.sfile_value = vim.fn.expand('<sfile>')
+ vim.g.stack_value = vim.fn.expand('<stack>')
+ ]])
+ command('set shellslash')
+ command('source ' .. test_file)
eq(1, eval('g:sourced_lua'))
+ matches([[/test%.lua$]], meths.get_var('sfile_value'))
+ matches([[/test%.lua$]], meths.get_var('stack_value'))
+
os.remove(test_file)
end)
@@ -153,13 +205,15 @@ describe(':source', function()
it('can source current lua buffer without argument', function()
local test_file = 'test.lua'
- write_file (test_file, [[
+ write_file(test_file, [[
vim.g.c = 10
vim.g.c = 11
vim.g.c = 12
a = [=[
\ 1
"\ 2]=]
+ vim.g.sfile_value = vim.fn.expand('<sfile>')
+ vim.g.stack_value = vim.fn.expand('<stack>')
]])
command('edit '..test_file)
@@ -167,6 +221,9 @@ describe(':source', function()
eq(12, eval('g:c'))
eq(' \\ 1\n "\\ 2', exec_lua('return _G.a'))
+ eq(':source (no file)', meths.get_var('sfile_value'))
+ eq(':source (no file)', meths.get_var('stack_value'))
+
os.remove(test_file)
end)
diff --git a/test/functional/ex_cmds/wincmd_spec.lua b/test/functional/ex_cmds/wincmd_spec.lua
new file mode 100644
index 0000000000..b1f174f445
--- /dev/null
+++ b/test/functional/ex_cmds/wincmd_spec.lua
@@ -0,0 +1,13 @@
+local helpers = require("test.functional.helpers")(after_each)
+local clear = helpers.clear
+local eq = helpers.eq
+local funcs = helpers.funcs
+local command = helpers.command
+
+it(':wincmd accepts a count', function()
+ clear()
+ command('vsplit')
+ eq(1, funcs.winnr())
+ command('wincmd 2 w')
+ eq(2, funcs.winnr())
+end)
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index 8c5a60657a..981cfc306e 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -244,10 +244,12 @@ function module.run_session(lsession, request_cb, notification_cb, setup_cb, tim
last_error = nil
error(err)
end
+
+ return session.eof_err
end
function module.run(request_cb, notification_cb, setup_cb, timeout)
- module.run_session(session, request_cb, notification_cb, setup_cb, timeout)
+ return module.run_session(session, request_cb, notification_cb, setup_cb, timeout)
end
function module.stop()
diff --git a/test/functional/legacy/arglist_spec.lua b/test/functional/legacy/arglist_spec.lua
index f90da16d7b..4d9e88c446 100644
--- a/test/functional/legacy/arglist_spec.lua
+++ b/test/functional/legacy/arglist_spec.lua
@@ -276,6 +276,6 @@ describe('argument list commands', function()
2 more files to edit. Quit anyway? |
[Y]es, (N)o: ^ |
]])
- expect_exit(100, feed, 'Y')
+ expect_exit(1000, feed, 'Y')
end)
end)
diff --git a/test/functional/legacy/ex_mode_spec.lua b/test/functional/legacy/ex_mode_spec.lua
index a8f54c6939..f21c47e175 100644
--- a/test/functional/legacy/ex_mode_spec.lua
+++ b/test/functional/legacy/ex_mode_spec.lua
@@ -6,7 +6,7 @@ local eq = helpers.eq
local eval = helpers.eval
local feed = helpers.feed
local meths = helpers.meths
-local sleep = helpers.sleep
+local poke_eventloop = helpers.poke_eventloop
before_each(clear)
@@ -143,7 +143,7 @@ describe('Ex mode', function()
^ |
]])
feed('<C-C>')
- sleep(10) -- Wait for input to be flushed
+ poke_eventloop() -- Wait for input to be flushed
feed('foo<CR>')
screen:expect([[
Entering Ex mode. Type "visual" to go to Normal mode. |
diff --git a/test/functional/legacy/excmd_spec.lua b/test/functional/legacy/excmd_spec.lua
index 65957d85de..ece88d26bd 100644
--- a/test/functional/legacy/excmd_spec.lua
+++ b/test/functional/legacy/excmd_spec.lua
@@ -94,7 +94,7 @@ describe(':confirm command dialog', function()
{3:Save changes to "Xbar"?} |
{3:[Y]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: }^ |
]])
- expect_exit(100, feed, 'A')
+ expect_exit(1000, feed, 'A')
eq('foo2\n', read_file('Xfoo'))
eq('bar2\n', read_file('Xbar'))
@@ -132,7 +132,7 @@ describe(':confirm command dialog', function()
{3:Save changes to "Xbar"?} |
{3:[Y]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: }^ |
]])
- expect_exit(100, feed, 'D')
+ expect_exit(1000, feed, 'D')
eq('foo2\n', read_file('Xfoo'))
eq('bar2\n', read_file('Xbar'))
@@ -193,7 +193,7 @@ describe(':confirm command dialog', function()
{3:Save changes to "Xfoo"?} |
{3:[Y]es, (N)o, (C)ancel: }^ |
]])
- expect_exit(100, feed, 'Y')
+ expect_exit(1000, feed, 'Y')
eq('foo4\n', read_file('Xfoo'))
eq('bar2\n', read_file('Xbar'))
diff --git a/test/functional/legacy/filechanged_spec.lua b/test/functional/legacy/filechanged_spec.lua
index ecb861098c..1f23528d61 100644
--- a/test/functional/legacy/filechanged_spec.lua
+++ b/test/functional/legacy/filechanged_spec.lua
@@ -67,6 +67,15 @@ describe('file changed dialog', function()
call assert_equal(1, line('$'))
call assert_equal('new line', getline(1))
+ " File created after starting to edit it
+ call delete('Xchanged_d')
+ new Xchanged_d
+ call writefile(['one'], 'Xchanged_d')
+ call nvim_input('L')
+ checktime Xchanged_d
+ call assert_equal(['one'], getline(1, '$'))
+ close!
+
bwipe!
call delete('Xchanged_d')
endfunc
diff --git a/test/functional/legacy/gf_spec.lua b/test/functional/legacy/gf_spec.lua
new file mode 100644
index 0000000000..f1b1790ba1
--- /dev/null
+++ b/test/functional/legacy/gf_spec.lua
@@ -0,0 +1,15 @@
+local helpers = require('test.functional.helpers')(after_each)
+local clear = helpers.clear
+local command = helpers.command
+local eq = helpers.eq
+local pcall_err = helpers.pcall_err
+
+describe('gf', function()
+ before_each(clear)
+
+ it('is not allowed when buffer is locked', function()
+ command('au OptionSet diff norm! gf')
+ command([[call setline(1, ['Xfile1', 'line2', 'line3', 'line4'])]])
+ eq('Vim(normal):E788: Not allowed to edit another buffer now', pcall_err(command, 'diffthis'))
+ end)
+end)
diff --git a/test/functional/legacy/global_spec.lua b/test/functional/legacy/global_spec.lua
index 9f4528530c..ff02c41e6c 100644
--- a/test/functional/legacy/global_spec.lua
+++ b/test/functional/legacy/global_spec.lua
@@ -3,7 +3,7 @@ local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
local exec = helpers.exec
local feed = helpers.feed
-local sleep = helpers.sleep
+local poke_eventloop = helpers.poke_eventloop
before_each(clear)
@@ -24,7 +24,7 @@ describe(':global', function()
]])
feed(':g/foo/norm :<C-V>;<CR>')
- sleep(10) -- Wait for :sleep to start
+ poke_eventloop() -- Wait for :sleep to start
feed('<C-C>')
screen:expect([[
^foo |
@@ -37,7 +37,7 @@ describe(':global', function()
-- Also test in Ex mode
feed('gQg/foo/norm :<C-V>;<CR>')
- sleep(10) -- Wait for :sleep to start
+ poke_eventloop() -- Wait for :sleep to start
feed('<C-C>')
screen:expect([[
{0: }|
diff --git a/test/functional/legacy/mapping_spec.lua b/test/functional/legacy/mapping_spec.lua
index 456acc12b5..c1f23ab0a6 100644
--- a/test/functional/legacy/mapping_spec.lua
+++ b/test/functional/legacy/mapping_spec.lua
@@ -131,11 +131,11 @@ describe('mapping', function()
command('set selectmode=mouse')
command('nnoremap <LeftDrag> <LeftDrag><Cmd><CR>')
- sleep(10)
+ poke_eventloop()
meths.input_mouse('left', 'press', '', 0, 0, 0)
- sleep(10)
+ poke_eventloop()
meths.input_mouse('left', 'drag', '', 0, 0, 1)
- sleep(10)
+ poke_eventloop()
eq('s', eval('mode()'))
end)
@@ -144,22 +144,22 @@ describe('mapping', function()
command('inoremap <LeftDrag> <LeftDrag><Cmd>let g:dragged = 1<CR>')
feed('i')
- sleep(10)
+ poke_eventloop()
meths.input_mouse('left', 'press', '', 0, 0, 0)
- sleep(10)
+ poke_eventloop()
meths.input_mouse('left', 'drag', '', 0, 0, 1)
- sleep(10)
+ poke_eventloop()
eq(1, eval('g:dragged'))
eq('v', eval('mode()'))
feed([[<C-\><C-N>]])
command([[inoremap <LeftDrag> <LeftDrag><C-\><C-N>]])
feed('i')
- sleep(10)
+ poke_eventloop()
meths.input_mouse('left', 'press', '', 0, 0, 0)
- sleep(10)
+ poke_eventloop()
meths.input_mouse('left', 'drag', '', 0, 0, 1)
- sleep(10)
+ poke_eventloop()
eq('n', eval('mode()'))
end)
diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua
index 51c2406933..159cf7a551 100644
--- a/test/functional/legacy/messages_spec.lua
+++ b/test/functional/legacy/messages_spec.lua
@@ -337,6 +337,95 @@ describe('messages', function()
end)
end)
+ describe('mode is cleared when', function()
+ before_each(function()
+ screen = Screen.new(40, 6)
+ screen:set_default_attr_ids({
+ [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [2] = {bold = true}, -- ModeMsg
+ [3] = {bold = true, reverse=true}, -- StatusLine
+ })
+ screen:attach()
+ end)
+
+ -- oldtest: Test_mode_message_at_leaving_insert_by_ctrl_c()
+ it('leaving Insert mode with Ctrl-C vim-patch:8.1.1189', function()
+ exec([[
+ func StatusLine() abort
+ return ""
+ endfunc
+ set statusline=%!StatusLine()
+ set laststatus=2
+ ]])
+ feed('i')
+ screen:expect([[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {3: }|
+ {2:-- INSERT --} |
+ ]])
+ feed('<C-C>')
+ screen:expect([[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {3: }|
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_mode_message_at_leaving_insert_with_esc_mapped()
+ it('leaving Insert mode with ESC in the middle of a mapping vim-patch:8.1.1192', function()
+ exec([[
+ set laststatus=2
+ inoremap <Esc> <Esc>00
+ ]])
+ feed('i')
+ screen:expect([[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {3:[No Name] }|
+ {2:-- INSERT --} |
+ ]])
+ feed('<Esc>')
+ screen:expect([[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {3:[No Name] }|
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_mode_updated_after_ctrl_c()
+ it('pressing Ctrl-C in i_CTRL-O', function()
+ feed('i<C-O>')
+ screen:expect([[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {2:-- (insert) --} |
+ ]])
+ feed('<C-C>')
+ screen:expect([[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ end)
+ end)
+
-- oldtest: Test_ask_yesno()
it('y/n prompt works', function()
screen = Screen.new(75, 6)
diff --git a/test/functional/lua/overrides_spec.lua b/test/functional/lua/overrides_spec.lua
index 9b51af1eec..32c1615a45 100644
--- a/test/functional/lua/overrides_spec.lua
+++ b/test/functional/lua/overrides_spec.lua
@@ -144,13 +144,14 @@ describe('debug.debug', function()
before_each(function()
screen = Screen.new()
screen:attach()
- screen:set_default_attr_ids({
- [0] = {bold=true, foreground=255},
- E = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
- cr = {bold = true, foreground = Screen.colors.SeaGreen4},
- })
- command("set display-=msgsep")
+ screen:set_default_attr_ids {
+ [0] = {bold=true, foreground=255};
+ [1] = {bold = true, reverse = true};
+ E = {foreground = Screen.colors.Grey100, background = Screen.colors.Red};
+ cr = {bold = true, foreground = Screen.colors.SeaGreen4};
+ }
end)
+
it('works', function()
command([[lua
function Test(a)
@@ -160,9 +161,8 @@ describe('debug.debug', function()
end
]])
feed(':lua Test()\n')
- screen:expect([[
- {0:~ }|
- {0:~ }|
+ screen:expect{grid=[[
+ |
{0:~ }|
{0:~ }|
{0:~ }|
@@ -173,11 +173,13 @@ describe('debug.debug', function()
{0:~ }|
{0:~ }|
{0:~ }|
+ {1: }|
nil |
lua_debug> ^ |
- ]])
+ ]]}
feed('print("TEST")\n')
screen:expect([[
+ |
{0:~ }|
{0:~ }|
{0:~ }|
@@ -186,8 +188,7 @@ describe('debug.debug', function()