@@ -136,9 +136,7 @@ func Test_writefile_sync_arg()
136136endfunc
137137
138138func Test_writefile_sync_dev_stdout ()
139- if ! has (' unix' )
140- return
141- endif
139+ CheckUnix
142140 if filewritable (' /dev/stdout' )
143141 " Just check that this doesn't cause an error.
144142 call writefile ([' one' ], ' /dev/stdout' )
@@ -371,13 +369,10 @@ endfunc
371369
372370" Test for writing to a readonly file
373371func Test_write_readonly ()
374- " In Cirrus-CI, the freebsd tests are run under a root account. So this test
375- " doesn't fail.
376- CheckNotBSD
377372 call writefile ([], ' Xfile' )
378373 call setfperm (' Xfile' , " r--------" )
379374 edit Xfile
380- set noreadonly
375+ set noreadonly backupskip =
381376 call assert_fails (' write' , ' E505:' )
382377 let save_cpo = &cpo
383378 set cpo += W
@@ -386,37 +381,32 @@ func Test_write_readonly()
386381 call setline (1 , [' line1' ])
387382 write !
388383 call assert_equal ([' line1' ], readfile (' Xfile' ))
384+ set backupskip &
389385 call delete (' Xfile' )
390386endfunc
391387
392388" Test for 'patchmode'
393389func Test_patchmode ()
394- CheckNotBSD
395390 call writefile ([' one' ], ' Xfile' )
396- set patchmode = .orig nobackup writebackup
391+ set patchmode = .orig nobackup backupskip = writebackup
397392 new Xfile
398393 call setline (1 , ' two' )
399394 " first write should create the .orig file
400395 write
401- " TODO: Xfile.orig is not created in Cirrus FreeBSD CI test
402396 call assert_equal ([' one' ], readfile (' Xfile.orig' ))
403397 call setline (1 , ' three' )
404398 " subsequent writes should not create/modify the .orig file
405399 write
406400 call assert_equal ([' one' ], readfile (' Xfile.orig' ))
407- set patchmode & backup & writebackup &
401+ set patchmode & backup & backupskip & writebackup &
408402 call delete (' Xfile' )
409403 call delete (' Xfile.orig' )
410404endfunc
411405
412406" Test for writing to a file in a readonly directory
413407func Test_write_readonly_dir ()
414- if ! has (' unix' ) || has (' bsd' )
415- " On MS-Windows, modifying files in a read-only directory is allowed.
416- " In Cirrus-CI for Freebsd, tests are run under a root account where
417- " modifying files in a read-only directory are allowed.
418- return
419- endif
408+ " On MS-Windows, modifying files in a read-only directory is allowed.
409+ CheckUnix
420410 call mkdir (' Xdir' )
421411 call writefile ([' one' ], ' Xdir/Xfile1' )
422412 call setfperm (' Xdir' , ' r-xr--r--' )
@@ -426,12 +416,12 @@ func Test_write_readonly_dir()
426416 call assert_fails (' write' , ' E212:' )
427417 " try to create a backup file in the directory
428418 edit ! Xdir/Xfile1
429- set backupdir = ./Xdir
419+ set backupdir = ./Xdir backupskip =
430420 set patchmode = .orig
431421 call assert_fails (' write' , ' E509:' )
432422 call setfperm (' Xdir' , ' rwxr--r--' )
433423 call delete (' Xdir' , ' rf' )
434- set backupdir & patchmode &
424+ set backupdir & backupskip & patchmode &
435425endfunc
436426
437427" Test for writing a file using invalid file encoding
0 commit comments