@@ -35,8 +35,20 @@ func! CountSpaces(type, ...)
3535 let @@ = reg_save
3636endfunc
3737
38- func ! IsWindows ()
39- return has (" win32" ) || has (" win64" ) || has (" win95" )
38+ func ! OpfuncDummy (type , ... )
39+ " for testing operatorfunc
40+ let g: opt= &linebreak
41+
42+ if a: 0 " Invoked from Visual mode, use gv command.
43+ silent exe " normal! gvy"
44+ elseif a: type == ' line'
45+ silent exe " normal! '[V']y"
46+ else
47+ silent exe " normal! `[v`]y"
48+ endif
49+ " Create a new dummy window
50+ new
51+ let g: bufnr= bufnr (' %' )
4052endfunc
4153
4254fun ! Test_normal00_optrans ()
@@ -147,7 +159,7 @@ endfunc
147159func ! Test_normal04_filter ()
148160 " basic filter test
149161 " only test on non windows platform
150- if IsWindows ( )
162+ if has ( ' win32 ' )
151163 return
152164 endif
153165 call Setup_NewWindow ()
@@ -210,7 +222,7 @@ endfunc
210222func ! Test_normal06_formatprg ()
211223 " basic test for formatprg
212224 " only test on non windows platform
213- if IsWindows ( )
225+ if has ( ' win32 ' )
214226 return
215227 else
216228 " uses sed to number non-empty lines
@@ -325,10 +337,37 @@ func! Test_normal09_operatorfunc()
325337 norm V10j,,
326338 call assert_equal (22 , g: a )
327339
340+ " clean up
341+ unmap <buffer> ,,
342+ set opfunc =
343+ unlet ! g: a
344+ bw !
345+ endfunc
346+
347+ func ! Test_normal09a_operatorfunc ()
348+ " Test operatorfunc
349+ call Setup_NewWindow ()
350+ " Add some spaces for counting
351+ 50 ,60 s/$/ /
352+ unlet ! g: opt
353+ set linebreak
354+ nmap <buffer> <silent> ,, :set opfunc=OpfuncDummy<CR> g@
355+ 50
356+ norm ,,j
357+ exe " bd!" g: bufnr
358+ call assert_true (&linebreak )
359+ call assert_equal (g: opt , &linebreak )
360+ set nolinebreak
361+ norm ,,j
362+ exe " bd!" g: bufnr
363+ call assert_false (&linebreak )
364+ call assert_equal (g: opt , &linebreak )
365+
328366 " clean up
329367 unmap <buffer> ,,
330368 set opfunc =
331369 bw !
370+ unlet ! g: opt
332371endfunc
333372
334373func ! Test_normal10_expand ()
@@ -1248,10 +1287,12 @@ func! Test_normal23_K()
12481287 norm! K
12491288 call assert_equal (' aa%bb' , fnamemodify (bufname (' %' ), ' :t' ))
12501289 bwipe!
1251- 4
1252- norm! K
1253- call assert_equal (' cc|dd' , fnamemodify (bufname (' %' ), ' :t' ))
1254- bwipe!
1290+ if ! has (' win32' )
1291+ 4
1292+ norm! K
1293+ call assert_equal (' cc|dd' , fnamemodify (bufname (' %' ), ' :t' ))
1294+ bwipe!
1295+ endif
12551296 set iskeyword -= %
12561297 set iskeyword -= \|
12571298
0 commit comments