aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/core/startup_spec.lua6
-rw-r--r--test/functional/eval/execute_spec.lua135
2 files changed, 137 insertions, 4 deletions
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
index f77af836a6..45bfa93b56 100644
--- a/test/functional/core/startup_spec.lua
+++ b/test/functional/core/startup_spec.lua
@@ -46,7 +46,7 @@ describe('startup', function()
]])
end)
it('in a TTY: has("ttyin")==1 has("ttyout")==1', function()
- local screen = Screen.new(25, 3)
+ local screen = Screen.new(25, 4)
screen:attach()
if iswin() then
command([[set shellcmdflag=/s\ /c shellxquote=\"]])
@@ -58,6 +58,7 @@ describe('startup', function()
..[[, shellescape(v:progpath))]])
screen:expect([[
^ |
+ ~ |
1 1 |
|
]])
@@ -96,7 +97,7 @@ describe('startup', function()
end)
end)
it('input from pipe (implicit) #7679', function()
- local screen = Screen.new(25, 3)
+ local screen = Screen.new(25, 4)
screen:attach()
if iswin() then
command([[set shellcmdflag=/s\ /c shellxquote=\"]])
@@ -109,6 +110,7 @@ describe('startup', function()
..[[, shellescape(v:progpath))]])
screen:expect([[
^foo |
+ ~ |
0 1 |
|
]])
diff --git a/test/functional/eval/execute_spec.lua b/test/functional/eval/execute_spec.lua
index af37ab8d55..f52ac4e59b 100644
--- a/test/functional/eval/execute_spec.lua
+++ b/test/functional/eval/execute_spec.lua
@@ -114,7 +114,7 @@ describe('execute()', function()
{1:~ }|
{1:~ }|
{2: }|
- :echo execute("hi ErrorMsg") |
+ |
ErrorMsg xxx ctermfg=15 ctermbg=1 guifg=White guibg=Red |
{3:Press ENTER or type command to continue}^ |
]], {
@@ -125,9 +125,140 @@ describe('execute()', function()
feed('<CR>')
end)
+ it('places cursor correctly #6035', function()
+ local screen = Screen.new(40, 6)
+ screen:attach()
+ source([=[
+ " test 1: non-silenced output goes as usual
+ function! Test1()
+ echo 1234
+ let x = execute('echon "abcdef"', '')
+ echon 'ABCD'
+ endfunction
+
+ " test 2: silenced output does not affect ui
+ function! Test2()
+ echo 1234
+ let x = execute('echon "abcdef"', 'silent')
+ echon 'ABCD'
+ endfunction
+
+ " test 3: silenced! error does not affect ui
+ function! Test3()
+ echo 1234
+ let x = execute('echoerr "abcdef"', 'silent!')
+ echon 'ABCD'
+ endfunction
+
+ " test 4: silenced echoerr goes as usual
+ " bug here
+ function! Test4()
+ echo 1234
+ let x = execute('echoerr "abcdef"', 'silent')
+ echon 'ABCD'
+ endfunction
+
+ " test 5: silenced! echoerr does not affect ui
+ function! Test5()
+ echo 1234
+ let x = execute('echoerr "abcdef"', 'silent!')
+ echon 'ABCD'
+ endfunction
+
+ " test 6: silenced error goes as usual
+ function! Test6()
+ echo 1234
+ let x = execute('echo undefined', 'silent')
+ echon 'ABCD'
+ endfunction
+
+ " test 7: existing error does not mess the result
+ function! Test7()
+ " display from Test6() is still visible
+ " why does the "abcdef" goes into a newline
+ let x = execute('echon "abcdef"', '')
+ echon 'ABCD'
+ endfunction
+ ]=])
+
+ feed([[:call Test1()<cr>]])
+ screen:expect([[
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ABCD |
+ ]])
+
+ feed([[:call Test2()<cr>]])
+ screen:expect([[
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ 1234ABCD |
+ ]])
+
+ feed([[:call Test3()<cr>]])
+ screen:expect([[
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ 1234ABCD |
+ ]])
+
+ feed([[:call Test4()<cr>]])
+ -- unexpected: need to fix
+ -- echoerr does not set did_emsg
+ -- "ef" was overwritten since msg_col was recovered wrongly
+ screen:expect([[
+ 1234 |
+ Error detected while processing function|
+ Test4: |
+ line 2: |
+ abcdABCD |
+ Press ENTER or type command to continue^ |
+ ]])
+
+ feed([[<cr>]]) -- to clear screen
+ feed([[:call Test5()<cr>]])
+ screen:expect([[
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ 1234ABCD |
+ ]])
+
+ feed([[:call Test6()<cr>]])
+ screen:expect([[
+ |
+ Error detected while processing function|
+ Test6: |
+ line 2: |
+ E121ABCD |
+ Press ENTER or type command to continue^ |
+ ]])
+
+ feed([[:call Test7()<cr>]])
+ screen:expect([[
+ Error detected while processing function|
+ Test6: |
+ line 2: |
+ E121ABCD |
+ ABCD |
+ Press ENTER or type command to continue^ |
+ ]])
+ end)
+
-- This deviates from vim behavior, but is consistent
-- with how nvim currently displays the output.
- it('does capture shell-command output', function()
+ it('captures shell-command output', function()
local win_lf = iswin() and '\13' or ''
eq('\n:!echo foo\r\n\nfoo'..win_lf..'\n', funcs.execute('!echo foo'))
end)