To: vim_dev@googlegroups.com Subject: Patch 8.2.2873 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2873 Problem: Not enough tests for writing buffers. Solution: Add a few more tests. (Yegappan Lakshmanan, closes #8229) Files: src/testdir/test_buffer.vim, src/testdir/test_cmdline.vim, src/testdir/test_functions.vim, src/testdir/test_writefile.vim *** ../vim-8.2.2872/src/testdir/test_buffer.vim 2020-11-07 18:40:47.136725212 +0100 --- src/testdir/test_buffer.vim 2021-05-19 17:09:39.951433860 +0200 *************** *** 381,384 **** --- 381,404 ---- call assert_equal('OtherBuffer', bufname()) endfunc + " Test for the 'maxmem' and 'maxmemtot' options + func Test_buffer_maxmem() + " use 1KB per buffer and 2KB for all the buffers + set maxmem=1 maxmemtot=2 + new + let v:errmsg = '' + " try opening some files + edit test_arglist.vim + call assert_equal('test_arglist.vim', bufname()) + edit test_eval_stuff.vim + call assert_equal('test_eval_stuff.vim', bufname()) + b test_arglist.vim + call assert_equal('test_arglist.vim', bufname()) + b test_eval_stuff.vim + call assert_equal('test_eval_stuff.vim', bufname()) + close + call assert_equal('', v:errmsg) + set maxmem& maxmemtot& + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.2872/src/testdir/test_cmdline.vim 2021-05-18 21:38:41.931029807 +0200 --- src/testdir/test_cmdline.vim 2021-05-19 17:09:39.951433860 +0200 *************** *** 1309,1321 **** call delete('XtestCmdlineClearTabenter') endfunc ! " Test for failure in expanding special keywords in cmdline func Test_cmdline_expand_special() %bwipe! call assert_fails('e #', 'E499:') call assert_fails('e ', 'E495:') call assert_fails('e ', 'E496:') call assert_fails('e ', 'E497:') endfunc func Test_cmdwin_jump_to_win() --- 1309,1330 ---- call delete('XtestCmdlineClearTabenter') endfunc ! " Test for expanding special keywords in cmdline func Test_cmdline_expand_special() %bwipe! call assert_fails('e #', 'E499:') call assert_fails('e ', 'E495:') call assert_fails('e ', 'E496:') call assert_fails('e ', 'E497:') + + call writefile([], 'Xfile.cpp') + call writefile([], 'Xfile.java') + new Xfile.cpp + call feedkeys(":e %:r\\\"\", 'xt') + call assert_equal('"e Xfile.cpp Xfile.java', @:) + close + call delete('Xfile.cpp') + call delete('Xfile.java') endfunc func Test_cmdwin_jump_to_win() *************** *** 1823,1827 **** --- 1832,1855 ---- augroup END endfunc + " Test for the 'suffixes' option + func Test_suffixes_opt() + call writefile([], 'Xfile') + call writefile([], 'Xfile.c') + call writefile([], 'Xfile.o') + set suffixes= + call feedkeys(":e Xfi*\\\"\", 'xt') + call assert_equal('"e Xfile Xfile.c Xfile.o', @:) + set suffixes=.c + call feedkeys(":e Xfi*\\\"\", 'xt') + call assert_equal('"e Xfile Xfile.o Xfile.c', @:) + set suffixes=,, + call feedkeys(":e Xfi*\\\"\", 'xt') + call assert_equal('"e Xfile.c Xfile.o Xfile', @:) + set suffixes& + call delete('Xfile') + call delete('Xfile.c') + call delete('Xfile.o') + endfunc " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.2872/src/testdir/test_functions.vim 2021-05-13 14:55:51.620360842 +0200 --- src/testdir/test_functions.vim 2021-05-19 17:09:39.951433860 +0200 *************** *** 2630,2635 **** --- 2630,2636 ---- func Test_glob() call assert_equal('', glob(test_null_string())) call assert_equal('', globpath(test_null_string(), test_null_string())) + call assert_fails("let x = globpath(&rtp, 'syntax/c.vim', [])", 'E745:') call writefile([], 'Xglob1') call writefile([], 'XGLOB2') *** ../vim-8.2.2872/src/testdir/test_writefile.vim 2021-05-15 23:21:00.799930024 +0200 --- src/testdir/test_writefile.vim 2021-05-19 17:09:39.951433860 +0200 *************** *** 471,477 **** " Root can do it too. CheckNotRoot ! call mkdir('Xdir') call writefile(['one'], 'Xdir/Xfile1') call setfperm('Xdir', 'r-xr--r--') " try to create a new file in the directory --- 471,477 ---- " Root can do it too. CheckNotRoot ! call mkdir('Xdir/') call writefile(['one'], 'Xdir/Xfile1') call setfperm('Xdir', 'r-xr--r--') " try to create a new file in the directory *************** *** 754,760 **** call assert_equal(0z6E6F656F6C0A, readfile('XNoEolSetEol', 'B')) call delete('XNoEolSetEol') ! set ff& bwipe! XNoEolSetEol endfunc --- 754,760 ---- call assert_equal(0z6E6F656F6C0A, readfile('XNoEolSetEol', 'B')) call delete('XNoEolSetEol') ! set ff& fixeol& bwipe! XNoEolSetEol endfunc *************** *** 897,900 **** --- 897,918 ---- call delete('Xfile.bak') endfunc + " Test for ':write ++bin' and ':write ++nobin' + func Test_write_binary_file() + " create a file without an eol/eof character + call writefile(0z616161, 'Xfile1', 'b') + new Xfile1 + write ++bin Xfile2 + write ++nobin Xfile3 + call assert_equal(0z616161, readblob('Xfile2')) + if has('win32') + call assert_equal(0z6161610D.0A, readblob('Xfile3')) + else + call assert_equal(0z6161610A, readblob('Xfile3')) + endif + call delete('Xfile1') + call delete('Xfile2') + call delete('Xfile3') + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.2872/src/version.c 2021-05-19 00:16:09.679188079 +0200 --- src/version.c 2021-05-19 17:11:57.194763306 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2873, /**/ -- Not too long ago, cut and paste was done with scissors and glue... /// 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 ///