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'
call assert_equal(15, line('w$'))
set foldenable&
- close!
+ bwipe!
endfunc
func Test_scroll_in_ex_mode()
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
" can't use Turkish locale
throw 'Skipped: Turkish locale not available'
endtry
- close!
+
+ bwipe!
endfunc
" Test for r (replace) command
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
call assert_equal([7, 8, 15], [line('.'), col('.'), virtcol('.')])
call assert_equal(-1, foldclosedend(7))
- close!
+ bwipe!
endfunc
" Tests for g cmds
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
au!
augroup END
au! normalcHoldTest
- close!
+
+ bwipe!
delfunc s:cHold
endfunc
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
new
call setline(1, ['one', 'two'])
call assert_beeps("normal! Gc:d\<CR>")
- close!
+ bwipe!
endfunc
" Test for d and D commands
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'
call setline(1, ['one two', 'three four'])
exe "norm! $3x"
call assert_equal(['one twhree four'], getline(1, '$'))
- close!
+
+ bwipe!
set whichwrap&
endfunc
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)
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
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 %
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'
CheckCanRunGui
let lines =<< trim END
+ vim9script
set mouseshape+=o:busy
setlocal nomodifiable
- let g: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')
+ var mouse_shapes = []
+
+ 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")