To: vim_dev@googlegroups.com Subject: Patch 8.2.2850 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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 , , + " , , , , , or . + func Test_recalling_cmdline() + CheckFeature cmdline_hist + + let g:cmdlines = [] + cnoremap (save-cmdline) let g:cmdlines += [getcmdline()] + + let histories = [ + \ {'name': 'cmd', 'enter': ':', 'exit': "\"}, + \ {'name': 'search', 'enter': '/', 'exit': "\"}, + \ {'name': 'expr', 'enter': ":\=", 'exit': "\\"}, + \ {'name': 'input', 'enter': ":call input('')\", 'exit': "\"}, + "\ TODO: {'name': 'debug', ...} + \] + let keypairs = [ + \ {'older': "\", 'newer': "\", 'prefixmatch': v:true}, + \ {'older': "\", 'newer': "\", 'prefixmatch': v:false}, + \ {'older': "\", 'newer': "\", 'prefixmatch': v:false}, + \ {'older': "\", 'newer': "\", '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 .. "\(save-cmdline)", 2) + \ .. repeat(k.newer .. "\(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 (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 -- Bram@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 ///