mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.0.1028: mouse shape test is flaky, especially on Mac OS (#23455)
Problem: Mouse shape test is flaky, especially on Mac OS.
Solution: Instead of starting all timers at the same time, start the next
one in the callback of the previous one. (Yee Cheng Chin,
closes vim/vim#11673) Also use "bwipe!" instead of "close!" to avoid
swap files remaining.
1881abfc34
Cherry-pick test_normal.vim changes from patch 8.2.3795.
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
This commit is contained in:
parent
1975062d3c
commit
a4bb8c37db
@ -250,9 +250,10 @@ func Test_normal_formatexpr_returns_nonzero()
|
||||
setlocal formatexpr=Format()
|
||||
normal VGgq
|
||||
call assert_equal(['one two'], getline(1, '$'))
|
||||
|
||||
setlocal formatexpr=
|
||||
delfunc Format
|
||||
close!
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test for using a script-local function for 'formatexpr'
|
||||
@ -1329,7 +1330,7 @@ func Test_vert_scroll_cmds()
|
||||
call assert_equal(15, line('w$'))
|
||||
|
||||
set foldenable&
|
||||
close!
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_scroll_in_ex_mode()
|
||||
@ -2350,7 +2351,7 @@ func Test_normal_section()
|
||||
call assert_equal(2, line('.'))
|
||||
call assert_equal(-1, foldclosedend(line('.')))
|
||||
|
||||
close!
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test for changing case using u, U, gu, gU and ~ (tilde) commands
|
||||
@ -2447,7 +2448,8 @@ func Test_normal_changecase_turkish()
|
||||
" can't use Turkish locale
|
||||
throw 'Skipped: Turkish locale not available'
|
||||
endtry
|
||||
close!
|
||||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test for r (replace) command
|
||||
@ -2524,7 +2526,6 @@ endfunc
|
||||
" Test for g`, g;, g,, g&, gv, gk, gj, gJ, g0, g^, g_, gm, g$, gM, g CTRL-G,
|
||||
" gi and gI commands
|
||||
func Test_normal33_g_cmd2()
|
||||
CheckFeature jumplist
|
||||
call Setup_NewWindow()
|
||||
" Test for g`
|
||||
clearjumps
|
||||
@ -2982,7 +2983,8 @@ func Test_normal_nvend()
|
||||
call assert_equal([4, 5], [line('.'), col('.')])
|
||||
exe "normal! \<C-End>"
|
||||
call assert_equal([10, 6], [line('.'), col('.')])
|
||||
close!
|
||||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test for cw cW ce
|
||||
@ -3479,12 +3481,11 @@ func Test_java_motion()
|
||||
call assert_equal([7, 8, 15], [line('.'), col('.'), virtcol('.')])
|
||||
call assert_equal(-1, foldclosedend(7))
|
||||
|
||||
close!
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Tests for g cmds
|
||||
func Test_normal_gdollar_cmd()
|
||||
CheckFeature jumplist
|
||||
call Setup_NewWindow()
|
||||
" Make long lines that will wrap
|
||||
%s/$/\=repeat(' foobar', 10)/
|
||||
@ -3595,7 +3596,8 @@ func Test_normal_yank_with_excmd()
|
||||
let @a = ''
|
||||
call feedkeys("\"ay:if v:true\<CR>normal l\<CR>endif\<CR>", 'xt')
|
||||
call assert_equal('f', @a)
|
||||
close!
|
||||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test for supplying a count to a normal-mode command across a cursorhold call
|
||||
@ -3617,7 +3619,8 @@ func Test_normal_cursorhold_with_count()
|
||||
au!
|
||||
augroup END
|
||||
au! normalcHoldTest
|
||||
close!
|
||||
|
||||
bwipe!
|
||||
delfunc s:cHold
|
||||
endfunc
|
||||
|
||||
@ -3641,7 +3644,8 @@ func Test_horiz_motion()
|
||||
call assert_equal(11, col('.'))
|
||||
exe "normal! $\<C-BS>"
|
||||
call assert_equal(10, col('.'))
|
||||
close!
|
||||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test for using a : command in operator pending mode
|
||||
@ -3649,7 +3653,7 @@ func Test_normal_colon_op()
|
||||
new
|
||||
call setline(1, ['one', 'two'])
|
||||
call assert_beeps("normal! Gc:d\<CR>")
|
||||
close!
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test for d and D commands
|
||||
@ -3674,7 +3678,7 @@ func Test_normal_delete_cmd()
|
||||
call assert_fails('normal D', 'E21:')
|
||||
call assert_fails('normal d$', 'E21:')
|
||||
|
||||
close!
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test for deleting or changing characters across lines with 'whichwrap'
|
||||
@ -3694,7 +3698,8 @@ func Test_normal_op_across_lines()
|
||||
call setline(1, ['one two', 'three four'])
|
||||
exe "norm! $3x"
|
||||
call assert_equal(['one twhree four'], getline(1, '$'))
|
||||
close!
|
||||
|
||||
bwipe!
|
||||
set whichwrap&
|
||||
endfunc
|
||||
|
||||
@ -3732,11 +3737,11 @@ func Test_normal_word_move()
|
||||
normal 3Gyb
|
||||
call assert_equal("two\n ", @")
|
||||
|
||||
close!
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test for 'scrolloff' with a long line that doesn't fit in the screen
|
||||
func Test_normal_scroloff()
|
||||
func Test_normal_scrolloff()
|
||||
10new
|
||||
60vnew
|
||||
call setline(1, ' 1 ' .. repeat('a', 57)
|
||||
@ -3777,8 +3782,9 @@ func Test_normal_scroloff()
|
||||
call assert_equal(1, winline())
|
||||
normal $
|
||||
call assert_equal(10, winline())
|
||||
|
||||
set scrolloff&
|
||||
close!
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test for vertical scrolling with CTRL-F and CTRL-B with a long line
|
||||
@ -3798,7 +3804,8 @@ func Test_normal_vert_scroll_longline()
|
||||
exe "normal \<C-B>\<C-B>"
|
||||
call assert_equal(5, line('.'))
|
||||
call assert_equal(5, winline())
|
||||
close!
|
||||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test for jumping in a file using %
|
||||
@ -3811,7 +3818,8 @@ func Test_normal_percent_jump()
|
||||
call feedkeys('50%', 'xt')
|
||||
call assert_equal(50, line('.'))
|
||||
call assert_equal(-1, foldclosedend(50))
|
||||
close!
|
||||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test for << and >> commands to shift text by 'shiftwidth'
|
||||
@ -3904,24 +3912,25 @@ func Test_mouse_shape_after_failed_change()
|
||||
CheckCanRunGui
|
||||
|
||||
let lines =<< trim END
|
||||
vim9script
|
||||
set mouseshape+=o:busy
|
||||
setlocal nomodifiable
|
||||
let g:mouse_shapes = []
|
||||
var mouse_shapes = []
|
||||
|
||||
func SaveMouseShape(timer)
|
||||
let g:mouse_shapes += [getmouseshape()]
|
||||
endfunc
|
||||
|
||||
func SaveAndQuit(timer)
|
||||
call writefile(g:mouse_shapes, 'Xmouseshapes')
|
||||
quit
|
||||
endfunc
|
||||
|
||||
call timer_start(50, {_ -> feedkeys('c')})
|
||||
call timer_start(100, 'SaveMouseShape')
|
||||
call timer_start(150, {_ -> feedkeys('c')})
|
||||
call timer_start(200, 'SaveMouseShape')
|
||||
call timer_start(250, 'SaveAndQuit')
|
||||
feedkeys('c')
|
||||
timer_start(50, (_) => {
|
||||
mouse_shapes += [getmouseshape()]
|
||||
timer_start(50, (_) => {
|
||||
feedkeys('c')
|
||||
timer_start(50, (_) => {
|
||||
mouse_shapes += [getmouseshape()]
|
||||
timer_start(50, (_) => {
|
||||
writefile(mouse_shapes, 'Xmouseshapes')
|
||||
quit
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
END
|
||||
call writefile(lines, 'Xmouseshape.vim', 'D')
|
||||
call RunVim([], [], "-g -S Xmouseshape.vim")
|
||||
|
Loading…
Reference in New Issue
Block a user