Patch 8.2.2850
Problem:    Recalling commands from history is not tested.
Solution:   Add tests. (closes #8194)
Files:      src/testdir/test_cmdline.vim


*** ../vim-8.2.2849/src/testdir/test_cmdline.vim        2021-03-28 
15:29:39.646657785 +0200
--- src/testdir/test_cmdline.vim        2021-05-13 20:14:12.768253893 +0200
***************
*** 1751,1754 ****
--- 1751,1802 ----
    set wildmenu&
  endfunc
  
+ " Test for recalling newer or older cmdline from history with <Up>, <Down>,
+ " <S-Up>, <S-Down>, <PageUp>, <PageDown>, <C-p>, or <C-n>.
+ func Test_recalling_cmdline()
+   CheckFeature cmdline_hist
+ 
+   let g:cmdlines = []
+   cnoremap <Plug>(save-cmdline) <Cmd>let g:cmdlines += [getcmdline()]<CR>
+ 
+   let histories = [
+   \  {'name': 'cmd',    'enter': ':',                    'exit': "\<Esc>"},
+   \  {'name': 'search', 'enter': '/',                    'exit': "\<Esc>"},
+   \  {'name': 'expr',   'enter': ":\<C-r>=",             'exit': 
"\<Esc>\<Esc>"},
+   \  {'name': 'input',  'enter': ":call input('')\<CR>", 'exit': "\<CR>"},
+   "\ TODO: {'name': 'debug', ...}
+   \]
+   let keypairs = [
+   \  {'older': "\<Up>",     'newer': "\<Down>",     'prefixmatch': v:true},
+   \  {'older': "\<S-Up>",   'newer': "\<S-Down>",   'prefixmatch': v:false},
+   \  {'older': "\<PageUp>", 'newer': "\<PageDown>", 'prefixmatch': v:false},
+   \  {'older': "\<C-p>",    'newer': "\<C-n>",      'prefixmatch': v:false},
+   \]
+   let prefix = 'vi'
+   for h in histories
+     call histadd(h.name, 'vim')
+     call histadd(h.name, 'virtue')
+     call histadd(h.name, 'Virgo')
+     call histadd(h.name, 'vogue')
+     call histadd(h.name, 'emacs')
+     for k in keypairs
+       let g:cmdlines = []
+       let keyseqs = h.enter
+       \          .. prefix
+       \          .. repeat(k.older .. "\<Plug>(save-cmdline)", 2)
+       \          .. repeat(k.newer .. "\<Plug>(save-cmdline)", 2)
+       \          .. h.exit
+       call feedkeys(keyseqs, 'xt')
+       call histdel(h.name, -1) " delete the history added by feedkeys above
+       let expect = k.prefixmatch
+       \          ? ['virtue', 'vim',   'virtue', prefix]
+       \          : ['emacs',  'vogue', 'emacs',  prefix]
+       call assert_equal(expect, g:cmdlines)
+     endfor
+   endfor
+ 
+   unlet g:cmdlines
+   cunmap <Plug>(save-cmdline)
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.2849/src/version.c       2021-05-13 18:32:46.447394705 +0200
--- src/version.c       2021-05-13 20:15:56.023878670 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2850,
  /**/

-- 
GALAHAD:   Camelot ...
LAUNCELOT: Camelot ...
GAWAIN:    It's only a model.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/202105131823.14DINv192878163%40masaka.moolenaar.net.

Raspunde prin e-mail lui