mirror of
https://github.com/neovim/neovim.git
synced 2025-12-06 06:32:33 +00:00
update functional test for "places cursor correctly #6035"
This commit is contained in:
@@ -126,135 +126,134 @@ describe('execute()', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('places cursor correctly #6035', function()
|
it('places cursor correctly #6035', function()
|
||||||
local screen = Screen.new(40, 5)
|
local screen = Screen.new(40, 6)
|
||||||
screen:attach()
|
screen:attach()
|
||||||
source([=[
|
source([=[
|
||||||
" test 1
|
" test 1: non-silenced output goes as usual
|
||||||
function! Test1a()
|
function! Test1()
|
||||||
echo 12345678
|
echo 1234
|
||||||
let x = execute('echo 1234567890', '')
|
let x = execute('echon "abcdef"', '')
|
||||||
echon '1234'
|
echon 'ABCD'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! Test1b()
|
" test 2: silenced output does not affect ui
|
||||||
echo 12345678
|
function! Test2()
|
||||||
echo 1234567890
|
echo 1234
|
||||||
echon '1234'
|
let x = execute('echon "abcdef"', 'silent')
|
||||||
|
echon 'ABCD'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" test 2
|
" test 3: silenced! error does not affect ui
|
||||||
function! Test2a()
|
function! Test3()
|
||||||
echo 12345678
|
echo 1234
|
||||||
let x = execute('echo 1234567890', 'silent')
|
let x = execute('echoerr "abcdef"', 'silent!')
|
||||||
echon '1234'
|
echon 'ABCD'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! Test2b()
|
" test 4: silenced echoerr goes as usual
|
||||||
echo 12345678
|
" bug here
|
||||||
silent echo 1234567890
|
function! Test4()
|
||||||
echon '1234'
|
echo 1234
|
||||||
|
let x = execute('echoerr "abcdef"', 'silent')
|
||||||
|
echon 'ABCD'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" test 3
|
" test 5: silenced! echoerr does not affect ui
|
||||||
function! Test3a()
|
function! Test5()
|
||||||
echo 12345678
|
echo 1234
|
||||||
let x = execute('echoerr 1234567890', 'silent!')
|
let x = execute('echoerr "abcdef"', 'silent!')
|
||||||
echon '1234'
|
echon 'ABCD'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! Test3b()
|
" test 6: silenced error goes as usual
|
||||||
echo 12345678
|
function! Test6()
|
||||||
silent! echoerr 1234567890
|
echo 1234
|
||||||
echon '1234'
|
let x = execute('echo undefined', 'silent')
|
||||||
|
echon 'ABCD'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" test 4
|
" test 7: existing error does not mess the result
|
||||||
function! Test4a()
|
function! Test7()
|
||||||
echo 12345678
|
" display from Test6() is still visible
|
||||||
let x = execute('echoerr 1234567890', 'silent')
|
" why does the "abcdef" goes into a newline
|
||||||
echon '1234'
|
let x = execute('echon "abcdef"', '')
|
||||||
endfunction
|
echon 'ABCD'
|
||||||
|
|
||||||
function! Test4b()
|
|
||||||
echo 12345678
|
|
||||||
silent echoerr 1234567890
|
|
||||||
echon '1234'
|
|
||||||
endfunction
|
endfunction
|
||||||
]=])
|
]=])
|
||||||
|
|
||||||
feed([[:call Test1a()<cr>]])
|
feed([[:call Test1()<cr>]])
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
|
^ |
|
||||||
|
|
~ |
|
||||||
12345678 |
|
~ |
|
||||||
12345678901234 |
|
~ |
|
||||||
|
~ |
|
||||||
|
1234abcdefABCD |
|
||||||
|
]])
|
||||||
|
|
||||||
|
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^ |
|
Press ENTER or type command to continue^ |
|
||||||
]])
|
]])
|
||||||
|
|
||||||
feed([[:call Test1b()<cr>]])
|
feed([[<cr>]]) -- to clear screen
|
||||||
|
feed([[:call Test5()<cr>]])
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
12345678 |
|
^ |
|
||||||
12345678901234 |
|
~ |
|
||||||
12345678 |
|
~ |
|
||||||
12345678901234 |
|
~ |
|
||||||
|
~ |
|
||||||
|
1234ABCD |
|
||||||
|
]])
|
||||||
|
|
||||||
|
feed([[:call Test6()<cr>]])
|
||||||
|
screen:expect([[
|
||||||
|
1234 |
|
||||||
|
Error detected while processing function|
|
||||||
|
Test6: |
|
||||||
|
line 2: |
|
||||||
|
E121: Undefined variable: undefinedABCD |
|
||||||
Press ENTER or type command to continue^ |
|
Press ENTER or type command to continue^ |
|
||||||
]])
|
]])
|
||||||
|
|
||||||
feed([[:call Test2a()<cr>]])
|
feed([[:call Test7()<cr>]])
|
||||||
screen:expect([[
|
|
||||||
12345678901234 |
|
|
||||||
12345678 |
|
|
||||||
12345678901234 |
|
|
||||||
123456781234 |
|
|
||||||
Press ENTER or type command to continue^ |
|
|
||||||
]])
|
|
||||||
|
|
||||||
feed([[:call Test2b()<cr>]])
|
|
||||||
screen:expect([[
|
|
||||||
12345678 |
|
|
||||||
12345678901234 |
|
|
||||||
123456781234 |
|
|
||||||
123456781234 |
|
|
||||||
Press ENTER or type command to continue^ |
|
|
||||||
]])
|
|
||||||
|
|
||||||
feed([[:call Test3a()<cr>]])
|
|
||||||
screen:expect([[
|
|
||||||
12345678901234 |
|
|
||||||
123456781234 |
|
|
||||||
123456781234 |
|
|
||||||
123456781234 |
|
|
||||||
Press ENTER or type command to continue^ |
|
|
||||||
]])
|
|
||||||
|
|
||||||
feed([[:call Test3b()<cr>]])
|
|
||||||
screen:expect([[
|
|
||||||
123456781234 |
|
|
||||||
123456781234 |
|
|
||||||
123456781234 |
|
|
||||||
123456781234 |
|
|
||||||
Press ENTER or type command to continue^ |
|
|
||||||
]])
|
|
||||||
|
|
||||||
feed([[:call Test4a()<cr>]])
|
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
Error detected while processing function|
|
Error detected while processing function|
|
||||||
Test4a: |
|
Test6: |
|
||||||
line 2: |
|
line 2: |
|
||||||
123456781234 |
|
E121: Undefined variable: undefinedABCD |
|
||||||
|
abcdefABCD |
|
||||||
Press ENTER or type command to continue^ |
|
Press ENTER or type command to continue^ |
|
||||||
]])
|
]])
|
||||||
|
|
||||||
feed([[:call Test4b()<cr>]])
|
|
||||||
screen:expect([[
|
|
||||||
Error detected while processing function|
|
|
||||||
Test4b: |
|
|
||||||
line 2: |
|
|
||||||
12345678901234 |
|
|
||||||
Press ENTER or type command to continue^ |
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- This deviates from vim behavior, but is consistent
|
-- This deviates from vim behavior, but is consistent
|
||||||
|
|||||||
Reference in New Issue
Block a user