Patch 8.1.1980
Problem:    Fix for search stat not tested.
Solution:   Add a screenshot test. (Christian Brabandt)
Files:      src/testdir/test_search_stat.vim,
            src/testdir/dumps/Test_searchstat_1.dump,
            src/testdir/dumps/Test_searchstat_2.dump


*** ../vim-8.1.1979/src/testdir/test_search_stat.vim    2019-09-03 
22:23:34.484284108 +0200
--- src/testdir/test_search_stat.vim    2019-09-04 16:29:11.289246567 +0200
***************
*** 1,11 ****
  " Tests for search_stats, when "S" is not in 'shortmess'
- "
- " This test is fragile, it might not work interactively, but it works when run
- " as test!
  
! source shared.vim
  
! func! Test_search_stat()
    new
    set shortmess-=S
    " Append 50 lines with text to search for, "foobar" appears 20 times
--- 1,9 ----
  " Tests for search_stats, when "S" is not in 'shortmess'
  
! source check.vim
! source screendump.vim
  
! func Test_search_stat()
    new
    set shortmess-=S
    " Append 50 lines with text to search for, "foobar" appears 20 times
***************
*** 177,187 ****
    let stat = '\[1/2\]'
    call assert_notmatch(pat .. stat, g:b)
    call assert_match(stat, g:b)
    unmap n
  
    " Clean up
    set shortmess+=S
- 
    " close the window
    bwipe!
  endfunc
--- 175,215 ----
    let stat = '\[1/2\]'
    call assert_notmatch(pat .. stat, g:b)
    call assert_match(stat, g:b)
+   " Test that the message is not truncated
+   " it would insert '...' into the output.
+   call assert_match('^\s\+' .. stat, g:b)
    unmap n
  
    " Clean up
    set shortmess+=S
    " close the window
    bwipe!
  endfunc
+ 
+ func! Test_search_stat_screendump()
+   CheckScreendump
+ 
+   let lines =<< trim END
+     set shortmess-=S
+     " Append 50 lines with text to search for, "foobar" appears 20 times
+     call append(0, repeat(['foobar', 'foo', 'fooooobar', 'foba', 'foobar'], 
20))
+     call setline(2, 'find this')
+     call setline(70, 'find this')
+     nnoremap n n
+     let @/ = 'find this'
+     call cursor(1,1)
+     norm n
+   END
+   call writefile(lines, 'Xsearchstat')
+   let buf = RunVimInTerminal('-S Xsearchstat', #{rows: 10})
+   call term_wait(buf)
+   call VerifyScreenDump(buf, 'Test_searchstat_1', {})
+ 
+   call term_sendkeys(buf, ":nnoremap <silent> n n\<cr>")
+   call term_sendkeys(buf, "gg0n")
+   call term_wait(buf)
+   call VerifyScreenDump(buf, 'Test_searchstat_2', {})
+ 
+   call StopVimInTerminal(buf)
+   call delete('Xsearchstat')
+ endfunc
*** ../vim-8.1.1979/src/testdir/dumps/Test_searchstat_1.dump    2019-09-04 
16:31:47.364475970 +0200
--- src/testdir/dumps/Test_searchstat_1.dump    2019-09-04 16:27:26.965792343 
+0200
***************
*** 0 ****
--- 1,10 ----
+ |f+0&#ffffff0|o@1|b|a|r| @68
+ >f|i|n|d| |t|h|i|s| @65
+ |f|o@4|b|a|r| @65
+ |f|o|b|a| @70
+ |f|o@1|b|a|r| @68
+ |f|o@1|b|a|r| @68
+ |f|o@1| @71
+ |f|o@4|b|a|r| @65
+ |f|o|b|a| @70
+ |/|f|i|n|d| |t|h|i|s| @29|[|1|/|2|]| @11|2|,|1| @10|T|o|p| 
*** ../vim-8.1.1979/src/testdir/dumps/Test_searchstat_2.dump    2019-09-04 
16:31:47.368475950 +0200
--- src/testdir/dumps/Test_searchstat_2.dump    2019-09-04 16:27:26.965792343 
+0200
***************
*** 0 ****
--- 1,10 ----
+ |f+0&#ffffff0|o@1|b|a|r| @68
+ >f|i|n|d| |t|h|i|s| @65
+ |f|o@4|b|a|r| @65
+ |f|o|b|a| @70
+ |f|o@1|b|a|r| @68
+ |f|o@1|b|a|r| @68
+ |f|o@1| @71
+ |f|o@4|b|a|r| @65
+ |f|o|b|a| @70
+ @40|[|1|/|2|]| @11|2|,|1| @10|T|o|p| 
*** ../vim-8.1.1979/src/version.c       2019-09-04 15:54:23.920359687 +0200
--- src/version.c       2019-09-04 16:31:36.156529756 +0200
***************
*** 759,760 ****
--- 759,762 ----
  {   /* Add new patch number below this line */
+ /**/
+     1980,
  /**/

-- 
Rule #1: Don't give somebody a tool that he's going to hurt himself with.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            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/201909041433.x84EX3aR000697%40masaka.moolenaar.net.

Raspunde prin e-mail lui