diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-06-04 00:14:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-04 00:14:49 +0200 |
commit | 16b1e8f9c070ad853c6c63b43591e297bf512662 (patch) | |
tree | 2246efdc9b3ca66346d2182ffa3866914fbee999 /test/functional/eval/execute_spec.lua | |
parent | dc4fa0b24dd65a72f66e853e9f5eb42a2e1973ff (diff) | |
parent | 49733df939b7c47739069581d5d2ae9d891eb4a8 (diff) | |
download | rneovim-16b1e8f9c070ad853c6c63b43591e297bf512662.tar.gz rneovim-16b1e8f9c070ad853c6c63b43591e297bf512662.tar.bz2 rneovim-16b1e8f9c070ad853c6c63b43591e297bf512662.zip |
Merge #9338 from janlazo/vim-8.1.0569
vim-patch:8.1.{569,571}
Diffstat (limited to 'test/functional/eval/execute_spec.lua')
-rw-r--r-- | test/functional/eval/execute_spec.lua | 135 |
1 files changed, 133 insertions, 2 deletions
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) |