Patch 9.0.0380
Problem:    Deleting files in tests is a hassle.
Solution:   Use the new 'D' flag of writefile().
Files:      src/testdir/test_arglist.vim,
            src/testdir/test_assert.vim,
            src/testdir/test_autocmd.vim


*** ../vim-9.0.0380/src/testdir/test_arglist.vim        2021-12-24 
20:15:38.000000000 +0000
--- src/testdir/test_arglist.vim        2022-09-04 17:54:04.740822376 +0100
***************
*** 97,103 ****
  func Test_argadd_empty_curbuf()
    new
    let curbuf = bufnr('%')
!   call writefile(['test', 'Xargadd'], 'Xargadd')
    " must not re-use the current buffer.
    argadd Xargadd
    call assert_equal(curbuf, bufnr('%'))
--- 97,103 ----
  func Test_argadd_empty_curbuf()
    new
    let curbuf = bufnr('%')
!   call writefile(['test', 'Xargadd'], 'Xargadd', 'D')
    " must not re-use the current buffer.
    argadd Xargadd
    call assert_equal(curbuf, bufnr('%'))
***************
*** 108,114 ****
    call assert_equal('Xargadd', '%'->bufname())
    call assert_equal(2, line('$'))
  
-   call delete('Xargadd')
    %argd
    bwipe!
  endfunc
--- 108,113 ----
***************
*** 506,514 ****
  " Test for autocommand that redefines the argument list, when doing ":all".
  func Test_arglist_autocmd()
    autocmd BufReadPost Xxx2 next Xxx2 Xxx1
!   call writefile(['test file Xxx1'], 'Xxx1')
!   call writefile(['test file Xxx2'], 'Xxx2')
!   call writefile(['test file Xxx3'], 'Xxx3')
  
    new
    " redefine arglist; go to Xxx1
--- 505,513 ----
  " Test for autocommand that redefines the argument list, when doing ":all".
  func Test_arglist_autocmd()
    autocmd BufReadPost Xxx2 next Xxx2 Xxx1
!   call writefile(['test file Xxx1'], 'Xxx1', 'D')
!   call writefile(['test file Xxx2'], 'Xxx2', 'D')
!   call writefile(['test file Xxx3'], 'Xxx3', 'D')
  
    new
    " redefine arglist; go to Xxx1
***************
*** 524,541 ****
  
    autocmd! BufReadPost Xxx2
    enew! | only
-   call delete('Xxx1')
-   call delete('Xxx2')
-   call delete('Xxx3')
    argdelete Xxx*
    bwipe! Xxx1 Xxx2 Xxx3
  endfunc
  
  func Test_arg_all_expand()
!   call writefile(['test file Xxx1'], 'Xx x')
    next notexist Xx\ x runtest.vim
    call assert_equal('notexist Xx\ x runtest.vim', expand('##'))
-   call delete('Xx x')
  endfunc
  
  func Test_large_arg()
--- 523,536 ----
  
    autocmd! BufReadPost Xxx2
    enew! | only
    argdelete Xxx*
    bwipe! Xxx1 Xxx2 Xxx3
  endfunc
  
  func Test_arg_all_expand()
!   call writefile(['test file Xxx1'], 'Xx x', 'D')
    next notexist Xx\ x runtest.vim
    call assert_equal('notexist Xx\ x runtest.vim', expand('##'))
  endfunc
  
  func Test_large_arg()
*** ../vim-9.0.0380/src/testdir/test_assert.vim 2022-09-02 15:15:11.063569185 
+0100
--- src/testdir/test_assert.vim 2022-09-04 17:54:38.836779103 +0100
***************
*** 89,100 ****
    call remove(v:errors, 0)
  
    let goodtext = ["one", "two", "three"]
!   call writefile(goodtext, 'Xone')
    call assert_equal(1, 'Xone'->assert_equalfile('xyzxyz'))
    call assert_match("E485: Can't read file xyzxyz", v:errors[0])
    call remove(v:errors, 0)
  
!   call writefile(goodtext, 'Xtwo')
    call assert_equal(0, assert_equalfile('Xone', 'Xtwo'))
  
    call writefile([goodtext[0]], 'Xone')
--- 89,100 ----
    call remove(v:errors, 0)
  
    let goodtext = ["one", "two", "three"]
!   call writefile(goodtext, 'Xone', 'D')
    call assert_equal(1, 'Xone'->assert_equalfile('xyzxyz'))
    call assert_match("E485: Can't read file xyzxyz", v:errors[0])
    call remove(v:errors, 0)
  
!   call writefile(goodtext, 'Xtwo', 'D')
    call assert_equal(0, assert_equalfile('Xone', 'Xtwo'))
  
    call writefile([goodtext[0]], 'Xone')
***************
*** 124,132 ****
    call assert_equal(1, assert_equalfile('Xone', 'Xtwo', 'a message'))
    call assert_match("a message: difference at byte 234, line 1 after", 
v:errors[0])
    call remove(v:errors, 0)
- 
-   call delete('Xone')
-   call delete('Xtwo')
  endfunc
  
  func Test_assert_notequal()
--- 124,129 ----
*** ../vim-9.0.0380/src/testdir/test_autocmd.vim        2022-09-02 
21:55:45.499049444 +0100
--- src/testdir/test_autocmd.vim        2022-09-04 18:02:36.280174297 +0100
***************
*** 24,35 ****
  " Test for the CursorHold autocmd
  func Test_CursorHold_autocmd()
    CheckRunVimInTerminal
!   call writefile(['one', 'two', 'three'], 'XoneTwoThree')
    let before =<< trim END
      set updatetime=10
      au CursorHold * call writefile([line('.')], 'XCHoutput', 'a')
    END
!   call writefile(before, 'XCHinit')
    let buf = RunVimInTerminal('-S XCHinit XoneTwoThree', {})
    call term_sendkeys(buf, "G")
    call term_wait(buf, 50)
--- 24,35 ----
  " Test for the CursorHold autocmd
  func Test_CursorHold_autocmd()
    CheckRunVimInTerminal
!   call writefile(['one', 'two', 'three'], 'XoneTwoThree', 'D')
    let before =<< trim END
      set updatetime=10
      au CursorHold * call writefile([line('.')], 'XCHoutput', 'a')
    END
!   call writefile(before, 'XCHinit', 'D')
    let buf = RunVimInTerminal('-S XCHinit XoneTwoThree', {})
    call term_sendkeys(buf, "G")
    call term_wait(buf, 50)
***************
*** 44,52 ****
    call WaitForAssert({-> assert_equal(['1', '2', '3'], 
readfile('XCHoutput')[-3:-1])})
    call StopVimInTerminal(buf)
  
-   call delete('XCHinit')
    call delete('XCHoutput')
-   call delete('XoneTwoThree')
  endfunc
  
  if has('timers')
--- 44,50 ----
***************
*** 124,130 ****
      augroup set_tabstop
        au OptionSet tabstop call timer_start(1, {-> execute("echo 'Handler 
called'", "")})
      augroup END
!     call writefile(['vim: set ts=7 sw=5 :', 'something'], 
'XoptionsetModeline')
      set modeline
      let v:errmsg = ''
      call assert_fails('split XoptionsetModeline', 'E12:')
--- 122,128 ----
      augroup set_tabstop
        au OptionSet tabstop call timer_start(1, {-> execute("echo 'Handler 
called'", "")})
      augroup END
!     call writefile(['vim: set ts=7 sw=5 :', 'something'], 
'XoptionsetModeline', 'D')
      set modeline
      let v:errmsg = ''
      call assert_fails('split XoptionsetModeline', 'E12:')
***************
*** 136,142 ****
      augroup END
      bwipe!
      set ts&
-     call delete('XoptionsetModeline')
      call test_override('starting', 0)
    endfunc
  
--- 134,139 ----
***************
*** 246,253 ****
  
  func Test_autocmd_dummy_wipeout()
    " prepare files
!   call writefile([''], 'Xdummywipetest1.txt')
!   call writefile([''], 'Xdummywipetest2.txt')
    augroup test_bufunload_group
      autocmd!
      autocmd BufUnload * call add(s:li, "bufunload")
--- 243,250 ----
  
  func Test_autocmd_dummy_wipeout()
    " prepare files
!   call writefile([''], 'Xdummywipetest1.txt', 'D')
!   call writefile([''], 'Xdummywipetest2.txt', 'D')
    augroup test_bufunload_group
      autocmd!
      autocmd BufUnload * call add(s:li, "bufunload")
***************
*** 261,268 ****
    call assert_equal(["bufunload", "bufwipeout"], s:li)
  
    bwipeout
-   call delete('Xdummywipetest1.txt')
-   call delete('Xdummywipetest2.txt')
    au! test_bufunload_group
    augroup! test_bufunload_group
  endfunc
--- 258,263 ----
***************
*** 326,332 ****
      au WinScrolled * let g:amatch = str2nr(expand('<amatch>'))
      au WinScrolled * let g:afile = str2nr(expand('<afile>'))
    END
!   call writefile(lines, 'Xtest_winscrolled')
    let buf = RunVimInTerminal('-S Xtest_winscrolled', {'rows': 6})
  
    call term_sendkeys(buf, ":echo g:scrolled\<CR>")
--- 321,327 ----
      au WinScrolled * let g:amatch = str2nr(expand('<amatch>'))
      au WinScrolled * let g:afile = str2nr(expand('<afile>'))
    END
!   call writefile(lines, 'Xtest_winscrolled', 'D')
    let buf = RunVimInTerminal('-S Xtest_winscrolled', {'rows': 6})
  
    call term_sendkeys(buf, ":echo g:scrolled\<CR>")
***************
*** 361,367 ****
    call WaitForAssert({-> assert_match('^v:true ', term_getline(buf, 6))}, 
1000)
  
    call StopVimInTerminal(buf)
-   call delete('Xtest_winscrolled')
  endfunc
  
  func Test_WinScrolled_mouse()
--- 356,361 ----
***************
*** 375,381 ****
      let g:scrolled = 0
      au WinScrolled * let g:scrolled += 1
    END
!   call writefile(lines, 'Xtest_winscrolled_mouse')
    let buf = RunVimInTerminal('-S Xtest_winscrolled_mouse', {'rows': 10})
  
    " With the upper split focused, send a scroll-down event to the unfocused 
one.
--- 369,375 ----
      let g:scrolled = 0
      au WinScrolled * let g:scrolled += 1
    END
!   call writefile(lines, 'Xtest_winscrolled_mouse', 'D')
    let buf = RunVimInTerminal('-S Xtest_winscrolled_mouse', {'rows': 10})
  
    " With the upper split focused, send a scroll-down event to the unfocused 
one.
***************
*** 392,398 ****
    call WaitForAssert({-> assert_match('^2', term_getline(buf, 10))}, 1000)
  
    call StopVimInTerminal(buf)
-   call delete('Xtest_winscrolled_mouse')
  endfunc
  
  func Test_WinScrolled_close_curwin()
--- 386,391 ----
***************
*** 405,411 ****
      au WinScrolled * close
      au VimLeave * call writefile(['123456'], 'Xtestout')
    END
!   call writefile(lines, 'Xtest_winscrolled_close_curwin')
    let buf = RunVimInTerminal('-S Xtest_winscrolled_close_curwin', {'rows': 6})
  
    " This was using freed memory
--- 398,404 ----
      au WinScrolled * close
      au VimLeave * call writefile(['123456'], 'Xtestout')
    END
!   call writefile(lines, 'Xtest_winscrolled_close_curwin', 'D')
    let buf = RunVimInTerminal('-S Xtest_winscrolled_close_curwin', {'rows': 6})
  
    " This was using freed memory
***************
*** 415,421 ****
  
    call assert_equal(['123456'], readfile('Xtestout'))
  
-   call delete('Xtest_winscrolled_close_curwin')
    call delete('Xtestout')
  endfunc
  
--- 408,413 ----
***************
*** 431,437 ****
      call setline(1, repeat('foo', height * width))
      call cursor(1, height * width)
    END
!   call writefile(lines, 'Xtest_winscrolled_long_wrapped')
    let buf = RunVimInTerminal('-S Xtest_winscrolled_long_wrapped', {'rows': 6})
  
    call term_sendkeys(buf, ":echo g:scrolled\<CR>")
--- 423,429 ----
      call setline(1, repeat('foo', height * width))
      call cursor(1, height * width)
    END
!   call writefile(lines, 'Xtest_winscrolled_long_wrapped', 'D')
    let buf = RunVimInTerminal('-S Xtest_winscrolled_long_wrapped', {'rows': 6})
  
    call term_sendkeys(buf, ":echo g:scrolled\<CR>")
***************
*** 448,455 ****
    call term_sendkeys(buf, '$')
    call term_sendkeys(buf, ":echo g:scrolled\<CR>")
    call WaitForAssert({-> assert_match('^3 ', term_getline(buf, 6))}, 1000)
- 
-   call delete('Xtest_winscrolled_long_wrapped')
  endfunc
  
  func Test_WinClosed()
--- 440,445 ----
***************
*** 772,784 ****
      au VimLeave * call WriteErrors()
    [CODE]
  
!   call writefile(content, 'Xvimrc')
    call system(GetVimCommand('Xvimrc') .. ' --not-a-term --noplugins -S 
Session.vim -c cq')
    let errors = join(readfile('Xerrors'))
    call assert_match('E814:', errors)
  
    set swapfile
!   for file in ['Session.vim', 'Xvimrc', 'Xerrors']
      call delete(file)
    endfor
  endfunc
--- 762,774 ----
      au VimLeave * call WriteErrors()
    [CODE]
  
!   call writefile(content, 'Xvimrc', 'D')
    call system(GetVimCommand('Xvimrc') .. ' --not-a-term --noplugins -S 
Session.vim -c cq')
    let errors = join(readfile('Xerrors'))
    call assert_match('E814:', errors)
  
    set swapfile
!   for file in ['Session.vim', 'Xerrors']
      call delete(file)
    endfor
  endfunc
***************
*** 795,805 ****
        qall
    [CODE]
  
!   call writefile(content, 'XblastBall')
    call system(GetVimCommand() .. ' --clean -S XblastBall')
    call assert_match('OK', readfile('Xerrors')->join())
  
-   call delete('XblastBall')
    call delete('Xerrors')
  endfunc
  
--- 785,794 ----
        qall
    [CODE]
  
!   call writefile(content, 'XblastBall', 'D')
    call system(GetVimCommand() .. ' --clean -S XblastBall')
    call assert_match('OK', readfile('Xerrors')->join())
  
    call delete('Xerrors')
  endfunc
  
***************
*** 832,838 ****
      au VimLeave * call WriteErrors()
    [CODE]
  
!   call writefile(content, 'Xvimrc')
    call system(GetVimCommand('Xvimrc') .. ' --not-a-term --noplugins -S 
Session.vim -c cq')
    let errors = join(readfile('Xerrors'))
    " This probably only ever matches on unix.
--- 821,827 ----
      au VimLeave * call WriteErrors()
    [CODE]
  
!   call writefile(content, 'Xvimrc', 'D')
    call system(GetVimCommand('Xvimrc') .. ' --not-a-term --noplugins -S 
Session.vim -c cq')
    let errors = join(readfile('Xerrors'))
    " This probably only ever matches on unix.
***************
*** 840,846 ****
    call assert_match('SessionLoadPost DONE', errors)
  
    set swapfile
!   for file in ['Session.vim', 'Xvimrc', 'Xerrors']
      call delete(file)
    endfor
  endfunc
--- 829,835 ----
    call assert_match('SessionLoadPost DONE', errors)
  
    set swapfile
!   for file in ['Session.vim', 'Xerrors']
      call delete(file)
    endfor
  endfunc
***************
*** 1542,1550 ****
  func Test_Acmd_BufAll()
    enew!
    %bwipe!
!   call writefile(['Test file Xxx1'], 'Xxx1')
!   call writefile(['Test file Xxx2'], 'Xxx2')
!   call writefile(['Test file Xxx3'], 'Xxx3')
  
    " Add three files to the buffer list
    split Xxx1
--- 1531,1539 ----
  func Test_Acmd_BufAll()
    enew!
    %bwipe!
!   call writefile(['Test file Xxx1'], 'Xxx1', 'D')
!   call writefile(['Test file Xxx2'], 'Xxx2', 'D')
!   call writefile(['Test file Xxx3'], 'Xxx3', 'D')
  
    " Add three files to the buffer list
    split Xxx1
***************
*** 1566,1574 ****
  
    au! BufReadPost
    %bwipe!
-   call delete('Xxx1')
-   call delete('Xxx2')
-   call delete('Xxx3')
    enew! | only
  endfunc
  
--- 1555,1560 ----
***************
*** 1578,1588 ****
    %bwipe!
    call writefile(['start of test file Xxx1',
              \ "\<Tab>this is a test",
!             \ 'end of test file Xxx1'], 'Xxx1')
    call writefile(['start of test file Xxx2',
              \ 'vim: set noai :',
              \ "\<Tab>this is a test",
!             \ 'end of test file Xxx2'], 'Xxx2')
  
    au BufEnter Xxx2 brew
    set ai modeline modelines=3
--- 1564,1574 ----
    %bwipe!
    call writefile(['start of test file Xxx1',
              \ "\<Tab>this is a test",
!             \ 'end of test file Xxx1'], 'Xxx1', 'D')
    call writefile(['start of test file Xxx2',
              \ 'vim: set noai :',
              \ "\<Tab>this is a test",
!             \ 'end of test file Xxx2'], 'Xxx2', 'D')
  
    au BufEnter Xxx2 brew
    set ai modeline modelines=3
***************
*** 1604,1611 ****
    call assert_equal(4, line('.'))
  
    %bwipe!
-   call delete('Xxx1')
-   call delete('Xxx2')
    set ai&vim modeline&vim modelines&vim
  endfunc
  
--- 1590,1595 ----
***************
*** 1632,1639 ****
    let content = ['start of test file Xxx',
              \ 'this is a test',
              \ 'end of test file Xxx']
!   call writefile(content, 'Xxx1')
!   call writefile(content, 'Xxx2')
  
    au BufLeave Xxx2 bwipe
    edit Xxx1
--- 1616,1623 ----
    let content = ['start of test file Xxx',
              \ 'this is a test',
              \ 'end of test file Xxx']
!   call writefile(content, 'Xxx1', 'D')
!   call writefile(content, 'Xxx2', 'D')
  
    au BufLeave Xxx2 bwipe
    edit Xxx1
***************
*** 1659,1666 ****
    let g:bufinfo = getbufinfo()
    call assert_equal(1, len(g:bufinfo))
  
-   call delete('Xxx1')
-   call delete('Xxx2')
    call delete('test.out')
    %bwipe
    au! BufLeave
--- 1643,1648 ----
***************
*** 1729,1736 ****
    au BufWritePre Xxx1 bunload
    au BufWritePre Xxx2 bwipe
  
!   call writefile(['start of Xxx1', 'test', 'end of Xxx1'], 'Xxx1')
!   call writefile(['start of Xxx2', 'test', 'end of Xxx2'], 'Xxx2')
  
    edit Xtest
    e! Xxx2
--- 1711,1718 ----
    au BufWritePre Xxx1 bunload
    au BufWritePre Xxx2 bwipe
  
!   call writefile(['start of Xxx1', 'test', 'end of Xxx1'], 'Xxx1', 'D')
!   call writefile(['start of Xxx2', 'test', 'end of Xxx2'], 'Xxx2', 'D')
  
    edit Xtest
    e! Xxx2
***************
*** 1746,1760 ****
    call assert_fails('w', 'E203:')
    call assert_equal('Xxx1', bufname('%'))
    au! BufWritePre
-   call delete('Xxx1')
-   call delete('Xxx2')
  endfunc
  
  " Test for BufUnload autocommand that unloads all the other buffers
  func Test_bufunload_all()
    let g:test_is_flaky = 1
!   call writefile(['Test file Xxx1'], 'Xxx1')"
!   call writefile(['Test file Xxx2'], 'Xxx2')"
  
    let content =<< trim [CODE]
      func UnloadAllBufs()
--- 1728,1740 ----
    call assert_fails('w', 'E203:')
    call assert_equal('Xxx1', bufname('%'))
    au! BufWritePre
  endfunc
  
  " Test for BufUnload autocommand that unloads all the other buffers
  func Test_bufunload_all()
    let g:test_is_flaky = 1
!   call writefile(['Test file Xxx1'], 'Xxx1', 'D')"
!   call writefile(['Test file Xxx2'], 'Xxx2', 'D')"
  
    let content =<< trim [CODE]
      func UnloadAllBufs()
***************
*** 1773,1787 ****
      q
    [CODE]
  
!   call writefile(content, 'Xtest')
  
    call delete('Xout')
!   call system(GetVimCommandClean() .. ' -N --not-a-term -S Xtest')
    call assert_true(filereadable('Xout'))
  
-   call delete('Xxx1')
-   call delete('Xxx2')
-   call delete('Xtest')
    call delete('Xout')
  endfunc
  
--- 1753,1764 ----
      q
    [CODE]
  
!   call writefile(content, 'Xbunloadtest', 'D')
  
    call delete('Xout')
!   call system(GetVimCommandClean() .. ' -N --not-a-term -S Xbunloadtest')
    call assert_true(filereadable('Xout'))
  
    call delete('Xout')
  endfunc
  
***************
*** 1809,1815 ****
  
  " Test for "*Cmd" autocommands
  func Test_Cmd_Autocmds()
!   call writefile(['start of Xxx', "\tabc2", 'end of Xxx'], 'Xxx')
  
    enew!
    au BufReadCmd XtestA 0r Xxx|$del
--- 1786,1792 ----
  
  " Test for "*Cmd" autocommands
  func Test_Cmd_Autocmds()
!   call writefile(['start of Xxx', "\tabc2", 'end of Xxx'], 'Xxx', 'D')
  
    enew!
    au BufReadCmd XtestA 0r Xxx|$del
***************
*** 1884,1890 ****
    au! FileWriteCmd
    au! FileAppendCmd
    %bwipe!
-   call delete('Xxx')
    enew!
  endfunc
  
--- 1861,1866 ----
***************
*** 1909,1915 ****
    autocmd BufReadCmd *.test call s:ReadFile()
    autocmd BufWriteCmd *.test call s:WriteFile()
  
!   call writefile(['one', 'two', 'three'], 'Xcmd.test')
    edit Xcmd.test
    call assert_match('Xcmd.test" line 1 of 3', execute('file'))
    normal! Gofour
--- 1885,1891 ----
    autocmd BufReadCmd *.test call s:ReadFile()
    autocmd BufWriteCmd *.test call s:WriteFile()
  
!   call writefile(['one', 'two', 'three'], 'Xcmd.test', 'D')
    edit Xcmd.test
    call assert_match('Xcmd.test" line 1 of 3', execute('file'))
    normal! Gofour
***************
*** 1917,1923 ****
    call assert_equal(['one', 'two', 'three', 'four'], readfile('Xcmd.test'))
  
    bwipe!
-   call delete('Xcmd.test')
    au! BufReadCmd
    au! BufWriteCmd
  endfunc
--- 1893,1898 ----
***************
*** 2324,2330 ****
    let g:test_is_flaky = 1
  
    " Prepare file for TextChanged event.
!   call writefile([''], 'Xchanged.txt')
    let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], 
{'term_rows': 3})
    call assert_equal('running', term_getstatus(buf))
    " Wait for the ruler (in the status line) to be shown.
--- 2299,2305 ----
    let g:test_is_flaky = 1
  
    " Prepare file for TextChanged event.
!   call writefile([''], 'Xchanged.txt', 'D')
    let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], 
{'term_rows': 3})
    call assert_equal('running', term_getstatus(buf))
    " Wait for the ruler (in the status line) to be shown.
***************
*** 2342,2348 ****
    call assert_equal([''], readfile('Xchanged.txt'))
  
    " clean up
-   call delete('Xchanged.txt')
    bwipe!
  endfunc
  
--- 2317,2322 ----
***************
*** 2432,2444 ****
        autocmd BufReadPost * autocmd SafeState * ++once foldclosed('.')
        autocmd WinEnter * matchadd('ErrorMsg', 'pat')
    END
!   call writefile(lines, 'Xautoscript')
    let buf = RunVimInTerminal('-S Xautoscript', {'rows': 10})
    call VerifyScreenDump(buf, 'Test_autocmd_nested_switch', {})
  
    call StopVimInTerminal(buf)
    call delete('Xautofile')
-   call delete('Xautoscript')
  endfunc
  
  func Test_autocmd_once()
--- 2406,2417 ----
        autocmd BufReadPost * autocmd SafeState * ++once foldclosed('.')
        autocmd WinEnter * matchadd('ErrorMsg', 'pat')
    END
!   call writefile(lines, 'Xautoscript', 'D')
    let buf = RunVimInTerminal('-S Xautoscript', {'rows': 10})
    call VerifyScreenDump(buf, 'Test_autocmd_nested_switch', {})
  
    call StopVimInTerminal(buf)
    call delete('Xautofile')
  endfunc
  
  func Test_autocmd_once()
***************
*** 2590,2596 ****
      au FileAppendPost  *.out  !cat Xtest.c >> test.out
    augroup END
  
!   call writefile(['/*', ' * Here is a new .c file', ' */'], 'Xtest.c')
    new foo.c                   " should load Xtest.c
    call assert_equal(['/*', ' * Here is a new .c file', ' */'], getline(2, 4))
    w! >> test.out              " append it to the output file
--- 2563,2569 ----
      au FileAppendPost  *.out  !cat Xtest.c >> test.out
    augroup END
  
!   call writefile(['/*', ' * Here is a new .c file', ' */'], 'Xtest.c', 'D')
    new foo.c                   " should load Xtest.c
    call assert_equal(['/*', ' * Here is a new .c file', ' */'], getline(2, 4))
    w! >> test.out              " append it to the output file
***************
*** 2714,2720 ****
  
    au! FileChangedShell
    call delete('Xtestfile.gz')
-   call delete('Xtest.c')
    call delete('test.out')
  endfunc
  
--- 2687,2692 ----
***************
*** 2762,2768 ****
          call timer_start(10, {id -> execute('let g:again ..= "t"')})
        endfunc
    END
!   call writefile(lines, 'XSafeState')
    let buf = RunVimInTerminal('-S XSafeState', #{rows: 6})
  
    " Sometimes we loop to handle a K_IGNORE, SafeState may be triggered once or
--- 2734,2740 ----
          call timer_start(10, {id -> execute('let g:again ..= "t"')})
        endfunc
    END
!   call writefile(lines, 'XSafeState', 'D')
    let buf = RunVimInTerminal('-S XSafeState', #{rows: 6})
  
    " Sometimes we loop to handle a K_IGNORE, SafeState may be triggered once or
***************
*** 2782,2788 ****
    call WaitForAssert({-> assert_match('xtx', term_getline(buf, 6))}, 1000)
  
    call StopVimInTerminal(buf)
-   call delete('XSafeState')
  endfunc
  
  func Test_autocmd_CmdWinEnter()
--- 2754,2759 ----
***************
*** 3024,3034 ****
      au!
      autocmd BufReadPre XbufreadPre call delete('XbufreadPre')
    augroup END
!   call writefile([], 'XbufreadPre')
    call assert_fails('new XbufreadPre', 'E200:')
    call assert_equal('XbufreadPre', @%)
    call assert_equal(1, &readonly)
!   call delete('XbufreadPre')
    augroup TestAuCmd
      au!
    augroup END
--- 2995,3005 ----
      au!
      autocmd BufReadPre XbufreadPre call delete('XbufreadPre')
    augroup END
!   call writefile([], 'XbufreadPre', 'D')
    call assert_fails('new XbufreadPre', 'E200:')
    call assert_equal('XbufreadPre', @%)
    call assert_equal(1, &readonly)
! 
    augroup TestAuCmd
      au!
    augroup END
***************
*** 3041,3051 ****
      au!
      autocmd BufReadPre Xchangebuf edit Xsomeotherfile
    augroup END
!   call writefile([], 'Xchangebuf')
    call assert_fails('new Xchangebuf', 'E201:')
    call assert_equal('Xsomeotherfile', @%)
    call assert_equal(1, &readonly)
!   call delete('Xchangebuf')
    augroup TestAuCmd
      au!
    augroup END
--- 3012,3022 ----
      au!
      autocmd BufReadPre Xchangebuf edit Xsomeotherfile
    augroup END
!   call writefile([], 'Xchangebuf', 'D')
    call assert_fails('new Xchangebuf', 'E201:')
    call assert_equal('Xsomeotherfile', @%)
    call assert_equal(1, &readonly)
! 
    augroup TestAuCmd
      au!
    augroup END
*** ../vim-9.0.0380/src/version.c       2022-09-04 18:09:45.247511444 +0100
--- src/version.c       2022-09-04 18:07:53.495705707 +0100
***************
*** 705,706 ****
--- 705,708 ----
  {   /* Add new patch number below this line */
+ /**/
+     380,
  /**/

-- 
The average life of an organization chart is six months.  You can safely
ignore any order from your boss that would take six months to complete.
                                (Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220904171327.14F3A1C0CE4%40moolenaar.net.

Raspunde prin e-mail lui