aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/eval/input_spec.lua42
-rw-r--r--test/functional/ex_cmds/cmd_map_spec.lua34
-rw-r--r--test/functional/ex_cmds/swapfile_preserve_recover_spec.lua8
3 files changed, 84 insertions, 0 deletions
diff --git a/test/functional/eval/input_spec.lua b/test/functional/eval/input_spec.lua
index 8c65297ac6..e774b939f7 100644
--- a/test/functional/eval/input_spec.lua
+++ b/test/functional/eval/input_spec.lua
@@ -8,6 +8,7 @@ local clear = helpers.clear
local source = helpers.source
local command = helpers.command
local exc_exec = helpers.exc_exec
+local nvim_async = helpers.nvim_async
local screen
@@ -59,6 +60,7 @@ before_each(function()
RBP3={background=Screen.colors.Green},
RBP4={background=Screen.colors.Blue},
SEP={bold = true, reverse = true},
+ CONFIRM={bold = true, foreground = Screen.colors.SeaGreen4},
})
end)
@@ -439,3 +441,43 @@ describe('inputdialog()', function()
]])
end)
end)
+
+describe('confirm()', function()
+ it("shows dialog even if :silent #8788", function()
+ command("autocmd BufNewFile * call confirm('test')")
+
+ local function check_and_clear(edit_line)
+ screen:expect([[
+ |
+ {SEP: }|
+ ]]..edit_line..[[
+ {CONFIRM:test} |
+ {CONFIRM:[O]k: }^ |
+ ]])
+ feed('<cr>')
+ command('redraw')
+ command('bdelete!')
+ end
+
+ -- With shortmess-=F
+ command('set shortmess-=F')
+ feed(':edit foo<cr>')
+ check_and_clear('"foo" [New File] |\n')
+
+ -- With shortmess+=F
+ command('set shortmess+=F')
+ feed(':edit foo<cr>')
+ check_and_clear(':edit foo |\n')
+
+ -- With :silent
+ feed(':silent edit foo<cr>')
+ check_and_clear(':silent edit foo |\n')
+
+ -- With API (via eval/VimL) call and shortmess+=F
+ feed(':call nvim_command("edit x")<cr>')
+ check_and_clear(':call nvim_command("edit |\n')
+
+ nvim_async('command', 'edit x')
+ check_and_clear(' |\n')
+ end)
+end)
diff --git a/test/functional/ex_cmds/cmd_map_spec.lua b/test/functional/ex_cmds/cmd_map_spec.lua
index 67b3ab49d6..a5ce1abff7 100644
--- a/test/functional/ex_cmds/cmd_map_spec.lua
+++ b/test/functional/ex_cmds/cmd_map_spec.lua
@@ -29,6 +29,9 @@ describe('mappings with <Cmd>', function()
[5] = {background = Screen.colors.LightGrey},
[6] = {foreground = Screen.colors.Blue1},
[7] = {bold = true, reverse = true},
+ [8] = {background = Screen.colors.WebGray},
+ [9] = {background = Screen.colors.LightMagenta},
+ [10] = {foreground = Screen.colors.Red},
})
screen:attach()
@@ -656,6 +659,37 @@ describe('mappings with <Cmd>', function()
eq('n', eval('mode(1)'))
end)
+ it('works in insert completion (Ctrl-X) mode', function()
+ feed('os<c-x><c-n>')
+ screen:expect([[
+ some short lines |
+ some^ |
+ {8:some } |
+ {9:short }{1: }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {4:-- Keyword Local completion (^N^P) }{3:match 1 of 2} |
+ ]])
+
+ feed('<f3>')
+ eq('ic', eval('m'))
+
+ -- ensure a redraw, this would have moved the cursor
+ -- instead if CTRL-X mode was left.
+ feed('<up>')
+ screen:expect([[
+ some short lines |
+ some^ |
+ {9:some } |
+ {9:short }{1: }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {4:-- Keyword Local completion (^N^P) }{10:Back at original} |
+ ]])
+ end)
+
it('works in cmdline mode', function()
feed(':text<F3>')
eq('c', eval('m'))
diff --git a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua
index 577a26178a..3fcffd422f 100644
--- a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua
+++ b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua
@@ -11,6 +11,7 @@ local ok = helpers.ok
local rmdir = helpers.rmdir
local set_session = helpers.set_session
local spawn = helpers.spawn
+local nvim_async = helpers.nvim_async
describe(':recover', function()
before_each(clear)
@@ -150,5 +151,12 @@ describe('swapfile detection', function()
feed('e') -- Chose "Edit" at the swap dialog.
feed('<c-c>')
screen2:expect(expected_no_dialog)
+
+ -- With API call and shortmess+=F
+ nvim_async('command', 'edit %')
+ screen2:expect{any=[[Found a swap file by the name ".*]]
+ ..[[Xtest_swapdialog_dir[/\].*]]..testfile..[[%.swp"]]}
+ feed('e') -- Chose "Edit" at the swap dialog.
+ feed('<c-c>')
end)
end)