Patch 9.0.0532
Problem:    Edit test is flaky when run under valgrind.
Solution:   Send some text to the terminal to trigger a redraw.
Files:      src/testdir/test_edit.vim


*** ../vim-9.0.0531/src/testdir/test_edit.vim   2022-08-30 21:46:03.661214458 
+0100
--- src/testdir/test_edit.vim   2022-09-21 15:11:15.531586771 +0100
***************
*** 452,458 ****
    " has been taken care of by other tests
    CheckFeature quickfix
    botright new
!   call writefile(range(1, 10), 'Xqflist.txt')
    call setqflist([{'filename': 'Xqflist.txt', 'lnum': 2}])
    copen
    set modifiable
--- 452,458 ----
    " has been taken care of by other tests
    CheckFeature quickfix
    botright new
!   call writefile(range(1, 10), 'Xqflist.txt', 'D')
    call setqflist([{'filename': 'Xqflist.txt', 'lnum': 2}])
    copen
    set modifiable
***************
*** 472,480 ****
    call feedkeys("A\n", 'tnix')
    call feedkeys("A\r", 'tnix')
    call assert_equal(map(range(1, 10), 'string(v:val)') + ['', '', '', ''], 
getline(1, '$'))
    bw!
    lclose
-   call delete('Xqflist.txt')
  endfunc
  
  func Test_edit_CTRL_()
--- 472,480 ----
    call feedkeys("A\n", 'tnix')
    call feedkeys("A\r", 'tnix')
    call assert_equal(map(range(1, 10), 'string(v:val)') + ['', '', '', ''], 
getline(1, '$'))
+ 
    bw!
    lclose
  endfunc
  
  func Test_edit_CTRL_()
***************
*** 569,575 ****
    call feedkeys("Arunt\<c-x>\<c-f>\<tab>\<cr>\<esc>", 'tnix')
    call assert_match('runtest\.vim', getline(1))
    %d
!   call writefile(['one', 'two', 'three'], 'Xinclude.txt')
    let include='#include Xinclude.txt'
    call setline(1, [include, ''])
    call cursor(2, 1)
--- 569,575 ----
    call feedkeys("Arunt\<c-x>\<c-f>\<tab>\<cr>\<esc>", 'tnix')
    call assert_match('runtest\.vim', getline(1))
    %d
!   call writefile(['one', 'two', 'three'], 'Xinclude.txt', 'D')
    let include='#include Xinclude.txt'
    call setline(1, [include, ''])
    call cursor(2, 1)
***************
*** 581,594 ****
    call assert_equal([include, 'three', ''], getline(1, '$'))
    call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<down>\<cr>\<esc>", 'tnix')
    call assert_equal([include, '', ''], getline(1, '$'))
-   call delete("Xinclude.txt")
    bw!
  endfunc
  
  func Test_edit_CTRL_K()
    " Test pressing CTRL-K (basically only dictionary completion and digraphs
    " the rest is already covered
!   call writefile(['A', 'AA', 'AAA', 'AAAA'], 'Xdictionary.txt')
    set dictionary=Xdictionary.txt
    new
    call setline(1, 'A')
--- 581,593 ----
    call assert_equal([include, 'three', ''], getline(1, '$'))
    call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<down>\<cr>\<esc>", 'tnix')
    call assert_equal([include, '', ''], getline(1, '$'))
    bw!
  endfunc
  
  func Test_edit_CTRL_K()
    " Test pressing CTRL-K (basically only dictionary completion and digraphs
    " the rest is already covered
!   call writefile(['A', 'AA', 'AAA', 'AAAA'], 'Xdictionary.txt', 'D')
    set dictionary=Xdictionary.txt
    new
    call setline(1, 'A')
***************
*** 644,650 ****
      " error sleeps 2 seconds, when v:testing is not set
      let v:testing = 0
    endtry
-   call delete('Xdictionary.txt')
  
    call test_override("char_avail", 1)
    set showcmd
--- 643,648 ----
***************
*** 842,848 ****
    call assert_equal(["\<tab>abcxyz"], getline(1, '$'))
    set nopaste
    " CTRL-X CTRL-T (thesaurus complete)
!   call writefile(['angry furious mad enraged'], 'Xthesaurus')
    set thesaurus=Xthesaurus
    call setline(1, 'mad')
    call cursor(1, 1)
--- 840,846 ----
    call assert_equal(["\<tab>abcxyz"], getline(1, '$'))
    set nopaste
    " CTRL-X CTRL-T (thesaurus complete)
!   call writefile(['angry furious mad enraged'], 'Xthesaurus', 'D')
    set thesaurus=Xthesaurus
    call setline(1, 'mad')
    call cursor(1, 1)
***************
*** 899,911 ****
      let v:testing = 0
    endtry
    call assert_equal(['mad'], getline(1, '$'))
-   call delete('Xthesaurus')
    bw!
  endfunc
  
  " Test thesaurus completion with different encodings
  func Test_thesaurus_complete_with_encoding()
!   call writefile(['angry furious mad enraged'], 'Xthesaurus')
    set thesaurus=Xthesaurus
    for e in ['latin1', 'utf-8']
      exe 'set encoding=' .. e
--- 897,908 ----
      let v:testing = 0
    endtry
    call assert_equal(['mad'], getline(1, '$'))
    bw!
  endfunc
  
  " Test thesaurus completion with different encodings
  func Test_thesaurus_complete_with_encoding()
!   call writefile(['angry furious mad enraged'], 'Xthesaurus', 'D')
    set thesaurus=Xthesaurus
    for e in ['latin1', 'utf-8']
      exe 'set encoding=' .. e
***************
*** 917,923 ****
      bw!
    endfor
    set thesaurus=
-   call delete('Xthesaurus')
  endfunc
  
  " Test 'thesaurusfunc'
--- 914,919 ----
***************
*** 1495,1501 ****
    let dirname = getcwd() . "/Xlongdir"
    let longdirname = dirname . repeat('/' . repeat('d', 255), 4)
    try
!     call mkdir(longdirname, 'p')
    catch /E739:/
      " Long directory name probably not supported.
      call delete(dirname, 'rf')
--- 1491,1497 ----
    let dirname = getcwd() . "/Xlongdir"
    let longdirname = dirname . repeat('/' . repeat('d', 255), 4)
    try
!     call mkdir(longdirname, 'pR')
    catch /E739:/
      " Long directory name probably not supported.
      call delete(dirname, 'rf')
***************
*** 1535,1541 ****
  
    bwipe!
    exe 'bwipe! ' . longfilename
-   call delete(dirname, 'rf')
    let &columns = save_columns
    if winposx >= 0 && winposy >= 0
      exe 'winpos ' . winposx . ' ' . winposy
--- 1531,1536 ----
***************
*** 1754,1772 ****
  " Test for editing a file using invalid file encoding
  func Test_edit_invalid_encoding()
    CheckEnglish
!   call writefile([], 'Xinvfile')
    redir => msg
    new ++enc=axbyc Xinvfile
    redir END
    call assert_match('\[NOT converted\]', msg)
-   call delete('Xinvfile')
    close!
  endfunc
  
  " Test for the "charconvert" option
  func Test_edit_charconvert()
    CheckEnglish
!   call writefile(['one', 'two'], 'Xccfile')
  
    " set 'charconvert' to a non-existing function
    set charconvert=NonExitingFunc()
--- 1749,1766 ----
  " Test for editing a file using invalid file encoding
  func Test_edit_invalid_encoding()
    CheckEnglish
!   call writefile([], 'Xinvfile', 'D')
    redir => msg
    new ++enc=axbyc Xinvfile
    redir END
    call assert_match('\[NOT converted\]', msg)
    close!
  endfunc
  
  " Test for the "charconvert" option
  func Test_edit_charconvert()
    CheckEnglish
!   call writefile(['one', 'two'], 'Xccfile', 'D')
  
    " set 'charconvert' to a non-existing function
    set charconvert=NonExitingFunc()
***************
*** 1826,1833 ****
    close!
    delfunc Cconv3
    set charconvert&
- 
-   call delete('Xccfile')
  endfunc
  
  " Test for editing a file without read permission
--- 1820,1825 ----
***************
*** 1835,1841 ****
    CheckUnix
    CheckNotRoot
  
!   call writefile(['one', 'two'], 'Xnrpfile')
    call setfperm('Xnrpfile', '-w-------')
    new
    redir => msg
--- 1827,1833 ----
    CheckUnix
    CheckNotRoot
  
!   call writefile(['one', 'two'], 'Xnrpfile', 'D')
    call setfperm('Xnrpfile', '-w-------')
    new
    redir => msg
***************
*** 1845,1851 ****
    call assert_equal([''], getline(1, '$'))
    call assert_match('\[Permission Denied\]', msg)
    close!
-   call delete('Xnrpfile')
  endfunc
  
  " Using :edit without leaving 'insertmode' should not cause Insert mode to be
--- 1837,1842 ----
***************
*** 1857,1875 ****
      set insertmode noruler
      inoremap <C-B> <Cmd>edit Xfoo<CR>
    END
!   call writefile(lines, 'Xtest_edit_insertmode_ex_edit')
  
!   let buf = RunVimInTerminal('-S Xtest_edit_insertmode_ex_edit', #{rows: 6})
!   " Somehow this can be very slow with valgrind. A separate TermWait() works
!   " better than a longer time with WaitForAssert() (why?)
!   call TermWait(buf, 1000)
    call WaitForAssert({-> assert_match('^-- INSERT --\s*$', term_getline(buf, 
6))})
    call term_sendkeys(buf, "\<C-B>\<C-L>")
    call WaitForAssert({-> assert_notmatch('^-- INSERT --\s*$', 
term_getline(buf, 6))})
  
    " clean up
    call StopVimInTerminal(buf)
-   call delete('Xtest_edit_insertmode_ex_edit')
  endfunc
  
  " Pressing escape in 'insertmode' should beep
--- 1848,1871 ----
      set insertmode noruler
      inoremap <C-B> <Cmd>edit Xfoo<CR>
    END
!   call writefile(lines, 'Xtest_edit_insertmode_ex_edit', 'D')
  
!   let buf = RunVimInTerminal('-S Xtest_edit_insertmode_ex_edit', #{rows: 6, 
wait_for_ruler: 0})
!   " Somehow when using valgrind "INSERT" does not show up unless we send
!   " something to the terminal.
!   for i in range(30)
!     if term_getline(buf, 6) =~ 'INSERT'
!       break
!     endif
!     call term_sendkeys(buf, "-")
!     sleep 100m
!   endfor
    call WaitForAssert({-> assert_match('^-- INSERT --\s*$', term_getline(buf, 
6))})
    call term_sendkeys(buf, "\<C-B>\<C-L>")
    call WaitForAssert({-> assert_notmatch('^-- INSERT --\s*$', 
term_getline(buf, 6))})
  
    " clean up
    call StopVimInTerminal(buf)
  endfunc
  
  " Pressing escape in 'insertmode' should beep
***************
*** 2083,2089 ****
    let lines =<< trim END
      call setline(1, ['abc'])
    END
!   call writefile(lines, 'Xtest_edit_shift_bs')
  
    let buf = RunVimInTerminal('-S Xtest_edit_shift_bs', #{rows: 3})
    call term_sendkeys(buf, "A\<S-BS>-\<esc>")
--- 2079,2085 ----
    let lines =<< trim END
      call setline(1, ['abc'])
    END
!   call writefile(lines, 'Xtest_edit_shift_bs', 'D')
  
    let buf = RunVimInTerminal('-S Xtest_edit_shift_bs', #{rows: 3})
    call term_sendkeys(buf, "A\<S-BS>-\<esc>")
***************
*** 2092,2098 ****
  
    " clean up
    call StopVimInTerminal(buf)
-   call delete('Xtest_edit_shift_bs')
  endfunc
  
  " vim: shiftwidth=2 sts=2 expandtab
--- 2088,2093 ----
*** ../vim-9.0.0531/src/version.c       2022-09-21 14:34:24.926995254 +0100
--- src/version.c       2022-09-21 15:13:08.459278519 +0100
***************
*** 701,702 ****
--- 701,704 ----
  {   /* Add new patch number below this line */
+ /**/
+     532,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
122. You ask if the Netaholics Anonymous t-shirt you ordered can be
     sent to you via e-mail.

 /// 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/20220921141418.720621C0EC3%40moolenaar.net.

Raspunde prin e-mail lui