Patch 9.0.0300
Problem: 'cpoptions' tests are flaky.
Solution: Use a different file name for each test.
Files: src/testdir/test_cpoptions.vim
*** ../vim-9.0.0299/src/testdir/test_cpoptions.vim 2021-05-29 15:26:26.000000000 +0100
--- src/testdir/test_cpoptions.vim 2022-08-28 17:42:22.021596862 +0100
***************
*** 8,26 ****
" file name.
func Test_cpo_a()
let save_cpo = &cpo
! call writefile(['one'], 'Xfile')
" Wipe out all the buffers, so that the alternate file is empty
edit Xfoo | %bw
set cpo-=a
new
! read Xfile
call assert_equal('', @#)
%d
set cpo+=a
! read Xfile
! call assert_equal('Xfile', @#)
close!
! call delete('Xfile')
let &cpo = save_cpo
endfunc
--- 8,26 ----
" file name.
func Test_cpo_a()
let save_cpo = &cpo
! call writefile(['one'], 'XfileCpoA')
" Wipe out all the buffers, so that the alternate file is empty
edit Xfoo | %bw
set cpo-=a
new
! read XfileCpoA
call assert_equal('', @#)
%d
set cpo+=a
! read XfileCpoA
! call assert_equal('XfileCpoA', @#)
close!
! call delete('XfileCpoA')
let &cpo = save_cpo
endfunc
***************
*** 99,129 ****
" Test for the 'C' flag in 'cpo' (line continuation)
func Test_cpo_C()
let save_cpo = &cpo
! call writefile(['let l = [', '\ 1,', '\ 2]'], 'Xfile')
set cpo-=C
! source Xfile
call assert_equal([1, 2], g:l)
set cpo+=C
! call assert_fails('source Xfile', ['E697:', 'E10:'])
! call delete('Xfile')
let &cpo = save_cpo
endfunc
" Test for the 'd' flag in 'cpo' (tags relative to the current file)
func Test_cpo_d()
let save_cpo = &cpo
! call mkdir('Xdir')
call writefile(["one\tXfile1\t/^one$/"], 'tags')
! call writefile(["two\tXfile2\t/^two$/"], 'Xdir/tags')
set tags=./tags
set cpo-=d
! edit Xdir/Xfile
call assert_equal('two', taglist('.*')[0].name)
set cpo+=d
call assert_equal('one', taglist('.*')[0].name)
%bw!
call delete('tags')
! call delete('Xdir', 'rf')
set tags&
let &cpo = save_cpo
endfunc
--- 99,129 ----
" Test for the 'C' flag in 'cpo' (line continuation)
func Test_cpo_C()
let save_cpo = &cpo
! call writefile(['let l = [', '\ 1,', '\ 2]'], 'XfileCpoC')
set cpo-=C
! source XfileCpoC
call assert_equal([1, 2], g:l)
set cpo+=C
! call assert_fails('source XfileCpoC', ['E697:', 'E10:'])
! call delete('XfileCpoC')
let &cpo = save_cpo
endfunc
" Test for the 'd' flag in 'cpo' (tags relative to the current file)
func Test_cpo_d()
let save_cpo = &cpo
! call mkdir('XdirCpoD')
call writefile(["one\tXfile1\t/^one$/"], 'tags')
! call writefile(["two\tXfile2\t/^two$/"], 'XdirCpoD/tags')
set tags=./tags
set cpo-=d
! edit XdirCpoD/Xfile
call assert_equal('two', taglist('.*')[0].name)
set cpo+=d
call assert_equal('one', taglist('.*')[0].name)
%bw!
call delete('tags')
! call delete('XdirCpoD', 'rf')
set tags&
let &cpo = save_cpo
endfunc
***************
*** 204,217 ****
let save_cpo = &cpo
new
set cpo-=F
! write Xfile
call assert_equal('', @%)
! call delete('Xfile')
set cpo+=F
! write Xfile
! call assert_equal('Xfile', @%)
close!
! call delete('Xfile')
let &cpo = save_cpo
endfunc
--- 204,217 ----
let save_cpo = &cpo
new
set cpo-=F
! write XfileCpoF
call assert_equal('', @%)
! call delete('XfileCpoF')
set cpo+=F
! write XfileCpoF
! call assert_equal('XfileCpoF', @%)
close!
! call delete('XfileCpoF')
let &cpo = save_cpo
endfunc
***************
*** 413,428 ****
" Test for the 'O' flag in 'cpo' (overwriting an existing file)
func Test_cpo_O()
let save_cpo = &cpo
! new Xfile
call setline(1, 'one')
! call writefile(['two'], 'Xfile')
set cpo-=O
call assert_fails('write', 'E13:')
set cpo+=O
write
! call assert_equal(['one'], readfile('Xfile'))
close!
! call delete('Xfile')
let &cpo = save_cpo
endfunc
--- 413,428 ----
" Test for the 'O' flag in 'cpo' (overwriting an existing file)
func Test_cpo_O()
let save_cpo = &cpo
! new XfileCpoO
call setline(1, 'one')
! call writefile(['two'], 'XfileCpoO')
set cpo-=O
call assert_fails('write', 'E13:')
set cpo+=O
write
! call assert_equal(['one'], readfile('XfileCpoO'))
close!
! call delete('XfileCpoO')
let &cpo = save_cpo
endfunc
***************
*** 432,449 ****
" name)
func Test_cpo_P()
let save_cpo = &cpo
! call writefile([], 'Xfile')
new
call setline(1, 'one')
set cpo+=F
set cpo-=P
! write >> Xfile
call assert_equal('', @%)
set cpo+=P
! write >> Xfile
! call assert_equal('Xfile', @%)
close!
! call delete('Xfile')
let &cpo = save_cpo
endfunc
--- 432,449 ----
" name)
func Test_cpo_P()
let save_cpo = &cpo
! call writefile([], 'XfileCpoP')
new
call setline(1, 'one')
set cpo+=F
set cpo-=P
! write >> XfileCpoP
call assert_equal('', @%)
set cpo+=P
! write >> XfileCpoP
! call assert_equal('XfileCpoP', @%)
close!
! call delete('XfileCpoP')
let &cpo = save_cpo
endfunc
***************
*** 635,642 ****
" Test for the 'Z' flag in 'cpo' (write! resets 'readonly')
func Test_cpo_Z()
let save_cpo = &cpo
! call writefile([], 'Xfile')
! new Xfile
setlocal readonly
set cpo-=Z
write!
--- 635,642 ----
" Test for the 'Z' flag in 'cpo' (write! resets 'readonly')
func Test_cpo_Z()
let save_cpo = &cpo
! call writefile([], 'XfileCpoZ')
! new XfileCpoZ
setlocal readonly
set cpo-=Z
write!
***************
*** 646,652 ****
write!
call assert_equal(1, &readonly)
close!
! call delete('Xfile')
let &cpo = save_cpo
endfunc
--- 646,652 ----
write!
call assert_equal(1, &readonly)
close!
! call delete('XfileCpoZ')
let &cpo = save_cpo
endfunc
***************
*** 723,730 ****
" flag)
func Test_cpo_plus()
let save_cpo = &cpo
! call writefile([], 'Xfile')
! new Xfile
call setline(1, 'foo')
write X1
call assert_equal(1, &modified)
--- 723,730 ----
" flag)
func Test_cpo_plus()
let save_cpo = &cpo
! call writefile([], 'XfileCpoPlus')
! new XfileCpoPlus
call setline(1, 'foo')
write X1
call assert_equal(1, &modified)
***************
*** 732,738 ****
write X2
call assert_equal(0, &modified)
close!
! call delete('Xfile')
call delete('X1')
call delete('X2')
let &cpo = save_cpo
--- 732,738 ----
write X2
call assert_equal(0, &modified)
close!
! call delete('XfileCpoPlus')
call delete('X1')
call delete('X2')
let &cpo = save_cpo
***************
*** 835,851 ****
" Test for the '&' flag in 'cpo'. The swap file is kept when a buffer is still
" loaded and ':preserve' is used.
func Test_cpo_ampersand()
! call writefile(['one'], 'Xfile')
let after =<< trim [CODE]
set cpo+=&
preserve
qall
[CODE]
! if RunVim([], after, 'Xfile')
! call assert_equal(1, filereadable('.Xfile.swp'))
! call delete('.Xfile.swp')
endif
! call delete('Xfile')
endfunc
" Test for the '\' flag in 'cpo' (backslash in a [] range in a search pattern)
--- 835,851 ----
" Test for the '&' flag in 'cpo'. The swap file is kept when a buffer is still
" loaded and ':preserve' is used.
func Test_cpo_ampersand()
! call writefile(['one'], 'XfileCpoAmp')
let after =<< trim [CODE]
set cpo+=&
preserve
qall
[CODE]
! if RunVim([], after, 'XfileCpoAmp')
! call assert_equal(1, filereadable('.XfileCpoAmp.swp'))
! call delete('.XfileCpoAmp.swp')
endif
! call delete('XfileCpoAmp')
endfunc
" Test for the '\' flag in 'cpo' (backslash in a [] range in a search pattern)
*** ../vim-9.0.0299/src/version.c 2022-08-28 17:24:59.775549192 +0100
--- src/version.c 2022-08-28 17:40:38.257743320 +0100
***************
*** 709,710 ****
--- 709,712 ----
{ /* Add new patch number below this line */
+ /**/
+ 300,
/**/
--
NEIL INNES PLAYED: THE FIRST SELF-DESTRUCTIVE MONK, ROBIN'S LEAST FAVORITE
MINSTREL, THE PAGE CRUSHED BY A RABBIT, THE OWNER OF A DUCK
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///