To: vim_dev@googlegroups.com Subject: Patch 9.0.0363 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0363 Problem: Common names in test files causes tests to be flaky. Solution: Use more specific names. Files: src/testdir/test_autocmd.vim, src/testdir/test_eval_stuff.vim, src/testdir/test_excmd.vim, src/testdir/test_expand.vim, src/testdir/test_file_perm.vim, src/testdir/test_filechanged.vim, src/testdir/test_fileformat.vim, src/testdir/test_filetype.vim, src/testdir/test_fold.vim, src/testdir/test_functions.vim, src/testdir/test_gf.vim, src/testdir/test_gui.vim, src/testdir/test_indent.vim, src/testdir/test_ins_complete.vim, src/testdir/test_mksession.vim, src/testdir/test_modeline.vim, src/testdir/test_normal.vim, src/testdir/test_options.vim, src/testdir/test_plus_arg_edit.vim, src/testdir/test_popupwin.vim, src/testdir/test_python2.vim, src/testdir/test_python3.vim, src/testdir/test_source.vim, src/testdir/test_stat.vim, src/testdir/test_substitute.vim, src/testdir/test_tabpage.vim, src/testdir/test_tagjump.vim, src/testdir/test_terminal.vim, src/testdir/test_terminal2.vim, src/testdir/test_vim9_assign.vim, src/testdir/test_vim9_cmd.vim, src/testdir/test_vim9_import.vim, src/testdir/test_vim9_script.vim, src/testdir/test_visual.vim, src/testdir/test_window_cmd.vim, src/testdir/test_writefile.vim *** ../vim-9.0.0362/src/testdir/test_autocmd.vim 2022-08-30 21:46:03.657214444 +0100 --- src/testdir/test_autocmd.vim 2022-09-02 20:31:16.332171196 +0100 *************** *** 3062,3068 **** augroup END let save_cpo = &cpo set cpo+=f ! call assert_fails('r Xfile', ['E812:', 'E484:']) call assert_equal('somefile', @%) let &cpo = save_cpo augroup TestAuCmd --- 3062,3068 ---- augroup END let save_cpo = &cpo set cpo+=f ! call assert_fails('r Xchangebuf', ['E812:', 'E484:']) call assert_equal('somefile', @%) let &cpo = save_cpo augroup TestAuCmd *** ../vim-9.0.0362/src/testdir/test_eval_stuff.vim 2022-09-02 16:47:12.915042726 +0100 --- src/testdir/test_eval_stuff.vim 2022-09-02 20:32:44.172061865 +0100 *************** *** 35,43 **** call assert_report('mkdir(..., "p") failed for an existing directory') endtry " 'p' doesn't suppress real errors ! call writefile([], 'Xfile') ! call assert_fails('call mkdir("Xfile", "p")', 'E739:') ! call delete('Xfile') call delete('Xmkdir', 'rf') call assert_equal(0, mkdir(test_null_string())) call assert_fails('call mkdir([])', 'E730:') --- 35,43 ---- call assert_report('mkdir(..., "p") failed for an existing directory') endtry " 'p' doesn't suppress real errors ! call writefile([], 'Xmkdirfile') ! call assert_fails('call mkdir("Xmkdirfile", "p")', 'E739:') ! call delete('Xmkdirfile') call delete('Xmkdir', 'rf') call assert_equal(0, mkdir(test_null_string())) call assert_fails('call mkdir([])', 'E730:') *** ../vim-9.0.0362/src/testdir/test_excmd.vim 2022-08-29 22:31:15.919685279 +0100 --- src/testdir/test_excmd.vim 2022-09-02 20:34:54.955977364 +0100 *************** *** 83,105 **** " Test for the :drop command func Test_drop_cmd() ! call writefile(['L1', 'L2'], 'Xfile') enew | only ! drop Xfile call assert_equal('L2', getline(2)) " Test for switching to an existing window below new ! drop Xfile call assert_equal(1, winnr()) " Test for splitting the current window enew | only set modified ! drop Xfile call assert_equal(2, winnr('$')) " Check for setting the argument list ! call assert_equal(['Xfile'], argv()) enew | only! ! call delete('Xfile') endfunc " Test for the :append command --- 83,105 ---- " Test for the :drop command func Test_drop_cmd() ! call writefile(['L1', 'L2'], 'Xdropfile') enew | only ! drop Xdropfile call assert_equal('L2', getline(2)) " Test for switching to an existing window below new ! drop Xdropfile call assert_equal(1, winnr()) " Test for splitting the current window enew | only set modified ! drop Xdropfile call assert_equal(2, winnr('$')) " Check for setting the argument list ! call assert_equal(['Xdropfile'], argv()) enew | only! ! call delete('Xdropfile') endfunc " Test for the :append command *************** *** 509,518 **** CheckNotRoot " Redirecting to a read-only file ! call writefile([], 'Xfile') ! call setfperm('Xfile', 'r--r--r--') ! call assert_fails('redir! > Xfile', 'E190:') ! call delete('Xfile') endfunc " Test for the :filetype command --- 509,518 ---- CheckNotRoot " Redirecting to a read-only file ! call writefile([], 'Xredirfile') ! call setfperm('Xredirfile', 'r--r--r--') ! call assert_fails('redir! > Xredirfile', 'E190:') ! call delete('Xredirfile') endfunc " Test for the :filetype command *************** *** 532,552 **** " Test for the :read command func Test_read_cmd() ! call writefile(['one'], 'Xfile') new call assert_fails('read', 'E32:') ! edit Xfile read call assert_equal(['one', 'one'], getline(1, '$')) close! new ! read Xfile call assert_equal(['', 'one'], getline(1, '$')) call deletebufline('', 1, '$') ! call feedkeys("Qr Xfile\visual\", 'xt') call assert_equal(['one'], getline(1, '$')) close! ! call delete('Xfile') endfunc " Test for running Ex commands when text is locked. --- 532,552 ---- " Test for the :read command func Test_read_cmd() ! call writefile(['one'], 'Xcmdfile') new call assert_fails('read', 'E32:') ! edit Xcmdfile read call assert_equal(['one', 'one'], getline(1, '$')) close! new ! read Xcmdfile call assert_equal(['', 'one'], getline(1, '$')) call deletebufline('', 1, '$') ! call feedkeys("Qr Xcmdfile\visual\", 'xt') call assert_equal(['one'], getline(1, '$')) close! ! call delete('Xcmdfile') endfunc " Test for running Ex commands when text is locked. *************** *** 633,641 **** endif call assert_fails("let $TESTVAR=1", 'E48:') call assert_fails("call feedkeys('ivim')", 'E48:') ! call assert_fails("source! Xfile", 'E48:') ! call assert_fails("call delete('Xfile')", 'E48:') ! call assert_fails("call writefile([], 'Xfile')", 'E48:') call assert_fails('!ls', 'E48:') call assert_fails('shell', 'E48:') call assert_fails('stop', 'E48:') --- 633,641 ---- endif call assert_fails("let $TESTVAR=1", 'E48:') call assert_fails("call feedkeys('ivim')", 'E48:') ! call assert_fails("source! Xsomefile", 'E48:') ! call assert_fails("call delete('Xthatfile')", 'E48:') ! call assert_fails("call writefile([], 'Xanotherfile')", 'E48:') call assert_fails('!ls', 'E48:') call assert_fails('shell', 'E48:') call assert_fails('stop', 'E48:') *************** *** 660,666 **** if has('terminal') call assert_fails('terminal', 'E48:') call assert_fails('call term_start("vim")', 'E48:') ! call assert_fails('call term_dumpwrite(1, "Xfile")', 'E48:') endif if has('channel') call assert_fails("call ch_logfile('chlog')", 'E48:') --- 660,666 ---- if has('terminal') call assert_fails('terminal', 'E48:') call assert_fails('call term_start("vim")', 'E48:') ! call assert_fails('call term_dumpwrite(1, "Xdumpfile")', 'E48:') endif if has('channel') call assert_fails("call ch_logfile('chlog')", 'E48:') *************** *** 727,743 **** " Test :write after changing name with :file and loading it with :edit func Test_write_after_rename() ! call writefile(['text'], 'Xfile') enew ! file Xfile call assert_fails('write', 'E13: File exists (add ! to override)') " works OK after ":edit" edit write ! call delete('Xfile') bwipe! endfunc --- 727,743 ---- " Test :write after changing name with :file and loading it with :edit func Test_write_after_rename() ! call writefile(['text'], 'Xafterfile') enew ! file Xafterfile call assert_fails('write', 'E13: File exists (add ! to override)') " works OK after ":edit" edit write ! call delete('Xafterfile') bwipe! endfunc *** ../vim-9.0.0362/src/testdir/test_expand.vim 2022-05-06 17:43:03.000000000 +0100 --- src/testdir/test_expand.vim 2022-09-02 20:37:12.580013070 +0100 *************** *** 57,82 **** unlet $FOO new ! edit Xfile1 ! call assert_equal('e Xfile1', expandcmd('e %')) ! edit Xfile2 ! edit Xfile1 ! call assert_equal('e Xfile2', 'e #'->expandcmd()) ! edit Xfile2 ! edit Xfile3 ! edit Xfile4 ! let bnum = bufnr('Xfile2') ! call assert_equal('e Xfile2', expandcmd('e #' . bnum)) call setline('.', 'Vim!@#') call assert_equal('e Vim', expandcmd('e ')) call assert_equal('e Vim!@#', expandcmd('e ')) enew! ! edit Xfile.java ! call assert_equal('e Xfile.py', expandcmd('e %:r.py')) call assert_equal('make abc.java', expandcmd('make abc.%:e')) ! call assert_equal('make Xabc.java', expandcmd('make %:s?file?abc?')) edit a1a2a3.rb ! call assert_equal('make b1b2b3.rb a1a2a3 Xfile.o', expandcmd('make %:gs?a?b? %< #<.o')) call assert_equal('make ', expandcmd("make ")) call assert_equal('make ', expandcmd("make ")) --- 57,82 ---- unlet $FOO new ! edit Xpandfile1 ! call assert_equal('e Xpandfile1', expandcmd('e %')) ! edit Xpandfile2 ! edit Xpandfile1 ! call assert_equal('e Xpandfile2', 'e #'->expandcmd()) ! edit Xpandfile2 ! edit Xpandfile3 ! edit Xpandfile4 ! let bnum = bufnr('Xpandfile2') ! call assert_equal('e Xpandfile2', expandcmd('e #' . bnum)) call setline('.', 'Vim!@#') call assert_equal('e Vim', expandcmd('e ')) call assert_equal('e Vim!@#', expandcmd('e ')) enew! ! edit Xpandfile.java ! call assert_equal('e Xpandfile.py', expandcmd('e %:r.py')) call assert_equal('make abc.java', expandcmd('make abc.%:e')) ! call assert_equal('make Xabc.java', expandcmd('make %:s?pandfile?abc?')) edit a1a2a3.rb ! call assert_equal('make b1b2b3.rb a1a2a3 Xpandfile.o', expandcmd('make %:gs?a?b? %< #<.o')) call assert_equal('make ', expandcmd("make ")) call assert_equal('make ', expandcmd("make ")) *** ../vim-9.0.0362/src/testdir/test_file_perm.vim 2020-03-25 21:12:13.000000000 +0000 --- src/testdir/test_file_perm.vim 2022-09-02 20:37:56.336015531 +0100 *************** *** 22,30 **** call assert_equal(1, setfperm('Xtest', 'rwx------')) call delete('Xtest') ! call assert_fails("call setfperm(['Xfile'], 'rw-rw-rw-')", 'E730:') ! call assert_fails("call setfperm('Xfile', [])", 'E730:') ! call assert_fails("call setfperm('Xfile', 'rwxrwxrwxrw')", 'E475:') endfunc " vim: shiftwidth=2 sts=2 expandtab --- 22,30 ---- call assert_equal(1, setfperm('Xtest', 'rwx------')) call delete('Xtest') ! call assert_fails("call setfperm(['Xpermfile'], 'rw-rw-rw-')", 'E730:') ! call assert_fails("call setfperm('Xpermfile', [])", 'E730:') ! call assert_fails("call setfperm('Xpermfile', 'rwxrwxrwxrw')", 'E475:') endfunc " vim: shiftwidth=2 sts=2 expandtab *** ../vim-9.0.0362/src/testdir/test_filechanged.vim 2022-02-12 11:01:47.000000000 +0000 --- src/testdir/test_filechanged.vim 2022-09-02 20:38:27.420015015 +0100 *************** *** 253,267 **** " Test for editing a new buffer from a FileChangedShell autocmd func Test_FileChangedShell_newbuf() ! call writefile(['one', 'two'], 'Xfile') ! new Xfile augroup testnewbuf autocmd FileChangedShell * enew augroup END ! call writefile(['red'], 'Xfile') call assert_fails('checktime', 'E811:') au! testnewbuf ! call delete('Xfile') endfunc " vim: shiftwidth=2 sts=2 expandtab --- 253,267 ---- " Test for editing a new buffer from a FileChangedShell autocmd func Test_FileChangedShell_newbuf() ! call writefile(['one', 'two'], 'Xchfile') ! new Xchfile augroup testnewbuf autocmd FileChangedShell * enew augroup END ! call writefile(['red'], 'Xchfile') call assert_fails('checktime', 'E811:') au! testnewbuf ! call delete('Xchfile') endfunc " vim: shiftwidth=2 sts=2 expandtab *** ../vim-9.0.0362/src/testdir/test_fileformat.vim 2021-06-16 14:36:35.000000000 +0100 --- src/testdir/test_fileformat.vim 2022-09-02 20:40:17.963999740 +0100 *************** *** 22,37 **** func Test_fileformat_autocommand() let filecnt = ["", "foobar\", "eins\", "\", "zwei\", "drei", "vier", "fünf", ""] let ffs = &ffs ! call writefile(filecnt, 'Xfile', 'b') ! au BufReadPre Xfile set ffs=dos ff=dos ! new Xfile call assert_equal('dos', &l:ff) call assert_equal('dos', &ffs) " cleanup ! call delete('Xfile') let &ffs = ffs ! au! BufReadPre Xfile bw! endfunc --- 22,37 ---- func Test_fileformat_autocommand() let filecnt = ["", "foobar\", "eins\", "\", "zwei\", "drei", "vier", "fünf", ""] let ffs = &ffs ! call writefile(filecnt, 'Xffafile', 'b') ! au BufReadPre Xffafile set ffs=dos ff=dos ! new Xffafile call assert_equal('dos', &l:ff) call assert_equal('dos', &ffs) " cleanup ! call delete('Xffafile') let &ffs = ffs ! au! BufReadPre Xffafile bw! endfunc *************** *** 314,327 **** " used as the 'fileformat'. func Test_fileformat_on_startup() let after =<< trim END ! call writefile([&fileformat], 'Xfile', 'a') quit END call RunVim(["set ffs=dos,unix,mac"], after, '') call RunVim(["set ffs=mac,dos,unix"], after, '') call RunVim(["set ffs=unix,mac,dos"], after, '') ! call assert_equal(['dos', 'mac', 'unix'], readfile('Xfile')) ! call delete('Xfile') endfunc " vim: shiftwidth=2 sts=2 expandtab --- 314,327 ---- " used as the 'fileformat'. func Test_fileformat_on_startup() let after =<< trim END ! call writefile([&fileformat], 'Xonsfile', 'a') quit END call RunVim(["set ffs=dos,unix,mac"], after, '') call RunVim(["set ffs=mac,dos,unix"], after, '') call RunVim(["set ffs=unix,mac,dos"], after, '') ! call assert_equal(['dos', 'mac', 'unix'], readfile('Xonsfile')) ! call delete('Xonsfile') endfunc " vim: shiftwidth=2 sts=2 expandtab *** ../vim-9.0.0362/src/testdir/test_filetype.vim 2022-09-01 15:00:17.992986820 +0100 --- src/testdir/test_filetype.vim 2022-09-02 20:43:48.791923806 +0100 *************** *** 14,28 **** func Test_conf_type() filetype on ! call writefile(['# some comment', 'must be conf'], 'Xfile') augroup filetypedetect au BufNewFile,BufRead * call assert_equal(0, did_filetype()) augroup END ! split Xfile call assert_equal('conf', &filetype) bwipe! ! call delete('Xfile') filetype off endfunc --- 14,28 ---- func Test_conf_type() filetype on ! call writefile(['# some comment', 'must be conf'], 'Xconffile') augroup filetypedetect au BufNewFile,BufRead * call assert_equal(0, did_filetype()) augroup END ! split Xconffile call assert_equal('conf', &filetype) bwipe! ! call delete('Xconffile') filetype off endfunc *************** *** 30,44 **** filetype on augroup filetypedetect au BufNewFile,BufRead * call assert_equal(0, did_filetype()) ! au BufNewFile,BufRead Xfile setf testfile au BufNewFile,BufRead * call assert_equal(1, did_filetype()) augroup END ! call writefile(['# some comment', 'must be conf'], 'Xfile') ! split Xfile call assert_equal('testfile', &filetype) bwipe! ! call delete('Xfile') filetype off endfunc --- 30,44 ---- filetype on augroup filetypedetect au BufNewFile,BufRead * call assert_equal(0, did_filetype()) ! au BufNewFile,BufRead Xotherfile setf testfile au BufNewFile,BufRead * call assert_equal(1, did_filetype()) augroup END ! call writefile(['# some comment', 'must be conf'], 'Xotherfile') ! split Xotherfile call assert_equal('testfile', &filetype) bwipe! ! call delete('Xotherfile') filetype off endfunc *** ../vim-9.0.0362/src/testdir/test_fold.vim 2022-06-29 12:54:48.068572061 +0100 --- src/testdir/test_fold.vim 2022-09-02 20:44:45.039895469 +0100 *************** *** 137,145 **** call assert_equal(1, foldlevel(n)) endfor ! call writefile(["a", "", "\a"], 'Xfile') foldopen ! 2read Xfile %foldclose call assert_equal(1, foldlevel(1)) call assert_equal(2, foldclosedend(1)) --- 137,145 ---- call assert_equal(1, foldlevel(n)) endfor ! call writefile(["a", "", "\a"], 'Xinfofile') foldopen ! 2read Xinfofile %foldclose call assert_equal(1, foldlevel(1)) call assert_equal(2, foldclosedend(1)) *************** *** 150,156 **** bwipe! set foldmethod& ! call delete('Xfile') endfunc func Test_combining_folds_indent() --- 150,156 ---- bwipe! set foldmethod& ! call delete('Xinfofile') endfunc func Test_combining_folds_indent() *************** *** 216,223 **** set foldexpr=s:TestFoldExpr(v:lnum) 2 foldopen ! call writefile(['b', 'b', 'a', 'a', 'd', 'a', 'a', 'c'], 'Xfile') ! read Xfile %foldclose call assert_equal(2, foldclosedend(1)) call assert_equal(0, foldlevel(3)) --- 216,223 ---- set foldexpr=s:TestFoldExpr(v:lnum) 2 foldopen ! call writefile(['b', 'b', 'a', 'a', 'd', 'a', 'a', 'c'], 'Xupfofile') ! read Xupfofile %foldclose call assert_equal(2, foldclosedend(1)) call assert_equal(0, foldlevel(3)) *************** *** 226,232 **** call assert_equal(10, foldclosedend(7)) call assert_equal(14, foldclosedend(11)) ! call delete('Xfile') bwipe! set foldmethod& foldexpr& endfunc --- 226,232 ---- call assert_equal(10, foldclosedend(7)) call assert_equal(14, foldclosedend(11)) ! call delete('Xupfofile') bwipe! set foldmethod& foldexpr& endfunc *** ../vim-9.0.0362/src/testdir/test_functions.vim 2022-09-02 15:15:11.063569185 +0100 --- src/testdir/test_functions.vim 2022-09-02 20:45:36.575867077 +0100 *************** *** 375,396 **** " test for shortcut file if executable('cscript') ! new Xfile wq let lines =<< trim END Set fs = CreateObject("Scripting.FileSystemObject") Set ws = WScript.CreateObject("WScript.Shell") Set shortcut = ws.CreateShortcut("Xlink.lnk") ! shortcut.TargetPath = fs.BuildPath(ws.CurrentDirectory, "Xfile") shortcut.Save END call writefile(lines, 'link.vbs') silent !cscript link.vbs call delete('link.vbs') ! call assert_equal(s:normalize_fname(getcwd() . '\Xfile'), s:normalize_fname(resolve('./Xlink.lnk'))) ! call delete('Xfile') ! call assert_equal(s:normalize_fname(getcwd() . '\Xfile'), s:normalize_fname(resolve('./Xlink.lnk'))) call delete('Xlink.lnk') else echomsg 'skipped test for shortcut file' --- 375,396 ---- " test for shortcut file if executable('cscript') ! new Xresfile wq let lines =<< trim END Set fs = CreateObject("Scripting.FileSystemObject") Set ws = WScript.CreateObject("WScript.Shell") Set shortcut = ws.CreateShortcut("Xlink.lnk") ! shortcut.TargetPath = fs.BuildPath(ws.CurrentDirectory, "Xresfile") shortcut.Save END call writefile(lines, 'link.vbs') silent !cscript link.vbs call delete('link.vbs') ! call assert_equal(s:normalize_fname(getcwd() . '\Xresfile'), s:normalize_fname(resolve('./Xlink.lnk'))) ! call delete('Xresfile') ! call assert_equal(s:normalize_fname(getcwd() . '\Xresfile'), s:normalize_fname(resolve('./Xlink.lnk'))) call delete('Xlink.lnk') else echomsg 'skipped test for shortcut file' *************** *** 399,418 **** " remove files call delete('Xlink') call delete('Xdir', 'd') ! call delete('Xfile') " test for symbolic link to a file ! new Xfile wq ! call assert_equal('Xfile', resolve('Xfile')) ! silent !mklink Xlink Xfile if !v:shell_error ! call assert_equal(s:normalize_fname(getcwd() . '\Xfile'), s:normalize_fname(resolve('./Xlink'))) call delete('Xlink') else echomsg 'skipped test for symbolic link to a file' endif ! call delete('Xfile') " test for junction to a directory call mkdir('Xdir') --- 399,418 ---- " remove files call delete('Xlink') call delete('Xdir', 'd') ! call delete('Xresfile') " test for symbolic link to a file ! new Xresfile wq ! call assert_equal('Xresfile', resolve('Xresfile')) ! silent !mklink Xlink Xresfile if !v:shell_error ! call assert_equal(s:normalize_fname(getcwd() . '\Xresfile'), s:normalize_fname(resolve('./Xlink'))) call delete('Xlink') else echomsg 'skipped test for symbolic link to a file' endif ! call delete('Xresfile') " test for junction to a directory call mkdir('Xdir') *************** *** 447,455 **** endif " test for buffer name ! new Xfile wq ! silent !mklink Xlink Xfile if !v:shell_error edit Xlink call assert_equal('Xlink', bufname('%')) --- 447,455 ---- endif " test for buffer name ! new Xbuffile wq ! silent !mklink Xlink Xbuffile if !v:shell_error edit Xlink call assert_equal('Xlink', bufname('%')) *************** *** 458,464 **** else echomsg 'skipped test for buffer name' endif ! call delete('Xfile') " test for reparse point call mkdir('Xdir') --- 458,464 ---- else echomsg 'skipped test for buffer name' endif ! call delete('Xbuffile') " test for reparse point call mkdir('Xdir') *** ../vim-9.0.0362/src/testdir/test_gf.vim 2022-08-01 11:38:13.515497865 +0100 --- src/testdir/test_gf.vim 2022-09-02 20:46:33.735833169 +0100 *************** *** 49,86 **** func Test_gF() new call setline(1, ['111', '222', '333', '444']) ! w! Xfile close new set isfname-=: ! call setline(1, ['one', 'Xfile:3', 'three']) 2 call assert_fails('normal gF', 'E37:') call assert_equal(2, getcurpos()[1]) ! w! Xfile2 normal gF ! call assert_equal('Xfile', bufname('%')) call assert_equal(3, getcurpos()[1]) enew! ! call setline(1, ['one', 'the Xfile line 2, and more', 'three']) ! w! Xfile2 normal 2GfX normal gF ! call assert_equal('Xfile', bufname('%')) call assert_equal(2, getcurpos()[1]) " jumping to the file/line with CTRL-W_F %bw! edit Xfile1 ! call setline(1, ['one', 'Xfile:4', 'three']) exe "normal 2G\F" ! call assert_equal('Xfile', bufname('%')) call assert_equal(4, getcurpos()[1]) set isfname& ! call delete('Xfile') ! call delete('Xfile2') %bw! endfunc --- 49,86 ---- func Test_gF() new call setline(1, ['111', '222', '333', '444']) ! w! Xgffile close new set isfname-=: ! call setline(1, ['one', 'Xgffile:3', 'three']) 2 call assert_fails('normal gF', 'E37:') call assert_equal(2, getcurpos()[1]) ! w! Xgffile2 normal gF ! call assert_equal('Xgffile', bufname('%')) call assert_equal(3, getcurpos()[1]) enew! ! call setline(1, ['one', 'the Xgffile line 2, and more', 'three']) ! w! Xgffile2 normal 2GfX normal gF ! call assert_equal('Xgffile', bufname('%')) call assert_equal(2, getcurpos()[1]) " jumping to the file/line with CTRL-W_F %bw! edit Xfile1 ! call setline(1, ['one', 'Xgffile:4', 'three']) exe "normal 2G\F" ! call assert_equal('Xgffile', bufname('%')) call assert_equal(4, getcurpos()[1]) set isfname& ! call delete('Xgffile') ! call delete('Xgffile2') %bw! endfunc *** ../vim-9.0.0362/src/testdir/test_gui.vim 2022-09-01 14:37:57.862658253 +0100 --- src/testdir/test_gui.vim 2022-09-02 20:47:08.943811128 +0100 *************** *** 1602,1608 **** func Test_gui_dialog_file() let lines =<< trim END ! file Xfile normal axxx confirm qa END --- 1602,1608 ---- func Test_gui_dialog_file() let lines =<< trim END ! file Xdialfile normal axxx confirm qa END *************** *** 1614,1623 **** execute prefix .. GetVimCommand() .. ' -g -f --clean --gui-dialog-file Xdialog -S Xlines' call WaitForAssert({-> assert_true(filereadable('Xdialog'))}) ! call assert_match('Question: Save changes to "Xfile"?', readfile('Xdialog')->join('')) call delete('Xdialog') ! call delete('Xfile') call delete('Xlines') endfunc --- 1614,1623 ---- execute prefix .. GetVimCommand() .. ' -g -f --clean --gui-dialog-file Xdialog -S Xlines' call WaitForAssert({-> assert_true(filereadable('Xdialog'))}) ! call assert_match('Question: Save changes to "Xdialfile"?', readfile('Xdialog')->join('')) call delete('Xdialog') ! call delete('Xdialfile') call delete('Xlines') endfunc *** ../vim-9.0.0362/src/testdir/test_indent.vim 2022-06-18 12:34:10.000000000 +0100 --- src/testdir/test_indent.vim 2022-09-02 21:01:58.143087251 +0100 *************** *** 161,169 **** func GetIndent() return line('.') * 2 endfunc ! call writefile(['# vim: indentexpr=GetIndent()'], 'Xfile.txt') set modelineexpr ! new Xfile.txt call assert_equal('GetIndent()', &indentexpr) exe "normal Oa\nb\n" call assert_equal([' a', ' b'], getline(1, 2)) --- 161,169 ---- func GetIndent() return line('.') * 2 endfunc ! call writefile(['# vim: indentexpr=GetIndent()'], 'Xmlfile.txt') set modelineexpr ! new Xmlfile.txt call assert_equal('GetIndent()', &indentexpr) exe "normal Oa\nb\n" call assert_equal([' a', ' b'], getline(1, 2)) *************** *** 172,178 **** delfunc GetIndent let &modeline = modeline close! ! call delete('Xfile.txt') endfunc func Test_indent_func_with_gq() --- 172,178 ---- delfunc GetIndent let &modeline = modeline close! ! call delete('Xmlfile.txt') endfunc func Test_indent_func_with_gq() *** ../vim-9.0.0362/src/testdir/test_ins_complete.vim 2022-09-01 12:22:19.751659183 +0100 --- src/testdir/test_ins_complete.vim 2022-09-02 21:02:38.427050349 +0100 *************** *** 1226,1239 **** CheckUnix CheckNotRoot ! call writefile(['about', 'above'], 'Xfile') ! call setfperm('Xfile', '---r--r--') new set complete=sXfile exe "normal! ia\" call assert_equal('a', getline(1)) bw! ! call delete('Xfile') set complete& endfunc --- 1226,1239 ---- CheckUnix CheckNotRoot ! call writefile(['about', 'above'], 'Xunrfile') ! call setfperm('Xunrfile', '---r--r--') new set complete=sXfile exe "normal! ia\" call assert_equal('a', getline(1)) bw! ! call delete('Xunrfile') set complete& endfunc *** ../vim-9.0.0362/src/testdir/test_mksession.vim 2022-06-19 17:12:39.000000000 +0100 --- src/testdir/test_mksession.vim 2022-09-02 21:03:18.027013906 +0100 *************** *** 1235,1242 **** " Test for creating views with manual folds func Test_mkview_manual_fold() ! call writefile(range(1,10), 'Xfile') ! new Xfile " create recursive folds 5,6fold 4,7fold --- 1235,1242 ---- " Test for creating views with manual folds func Test_mkview_manual_fold() ! call writefile(range(1,10), 'Xmkvfile') ! new Xmkvfile " create recursive folds 5,6fold 4,7fold *************** *** 1259,1265 **** source Xview call assert_equal([-1, -1, -1, -1, -1, -1], [foldclosed(3), foldclosed(4), \ foldclosed(5), foldclosed(6), foldclosed(7), foldclosed(8)]) ! call delete('Xfile') call delete('Xview') bw! endfunc --- 1259,1265 ---- source Xview call assert_equal([-1, -1, -1, -1, -1, -1], [foldclosed(3), foldclosed(4), \ foldclosed(5), foldclosed(6), foldclosed(7), foldclosed(8)]) ! call delete('Xmkvfile') call delete('Xview') bw! endfunc *** ../vim-9.0.0362/src/testdir/test_modeline.vim 2021-08-28 19:16:28.000000000 +0100 --- src/testdir/test_modeline.vim 2022-09-02 21:04:27.254949808 +0100 *************** *** 350,362 **** " Some options cannot be set from the modeline when 'diff' option is set func Test_modeline_diff_buffer() ! call writefile(['vim: diff foldmethod=marker wrap'], 'Xfile') set foldmethod& nowrap ! new Xfile call assert_equal('manual', &foldmethod) call assert_false(&wrap) set wrap& ! call delete('Xfile') bw endfunc --- 350,362 ---- " Some options cannot be set from the modeline when 'diff' option is set func Test_modeline_diff_buffer() ! call writefile(['vim: diff foldmethod=marker wrap'], 'Xmdifile') set foldmethod& nowrap ! new Xmdifile call assert_equal('manual', &foldmethod) call assert_false(&wrap) set wrap& ! call delete('Xmdifile') bw endfunc *** ../vim-9.0.0362/src/testdir/test_normal.vim 2022-07-06 12:57:27.964846666 +0100 --- src/testdir/test_normal.vim 2022-09-02 21:06:19.662844904 +0100 *************** *** 1709,1722 **** func Test_normal20_exmode() " Reading from redirected file doesn't work on MS-Windows CheckNotMSWindows ! call writefile(['1a', 'foo', 'bar', '.', 'w! Xfile2', 'q!'], 'Xscript') ! call writefile(['1', '2'], 'Xfile') ! call system(GetVimCommand() .. ' -e -s < Xscript Xfile') ! let a=readfile('Xfile2') call assert_equal(['1', 'foo', 'bar', '2'], a) " clean up ! for file in ['Xfile', 'Xfile2', 'Xscript'] call delete(file) endfor bw! --- 1709,1722 ---- func Test_normal20_exmode() " Reading from redirected file doesn't work on MS-Windows CheckNotMSWindows ! call writefile(['1a', 'foo', 'bar', '.', 'w! Xn20file2', 'q!'], 'Xn20script') ! call writefile(['1', '2'], 'Xn20file') ! call system(GetVimCommand() .. ' -e -s < Xn20script Xn20file') ! let a=readfile('Xn20file2') call assert_equal(['1', 'foo', 'bar', '2'], a) " clean up ! for file in ['Xn20file', 'Xn20file2', 'Xn20script'] call delete(file) endfor bw! *************** *** 1758,1779 **** " Test for ZZ " let shell = &shell " let &shell = 'sh' ! call writefile(['1', '2'], 'Xfile') let args = ' -N -i NONE --noplugins -X --not-a-term' ! call system(GetVimCommand() .. args .. ' -c "%d" -c ":norm! ZZ" Xfile') ! let a = readfile('Xfile') call assert_equal([], a) " Test for ZQ ! call writefile(['1', '2'], 'Xfile') ! call system(GetVimCommand() . args . ' -c "%d" -c ":norm! ZQ" Xfile') ! let a = readfile('Xfile') call assert_equal(['1', '2'], a) " Unsupported Z command call assert_beeps('normal! ZW') " clean up ! for file in ['Xfile'] call delete(file) endfor " let &shell = shell --- 1758,1779 ---- " Test for ZZ " let shell = &shell " let &shell = 'sh' ! call writefile(['1', '2'], 'Xn22file') let args = ' -N -i NONE --noplugins -X --not-a-term' ! call system(GetVimCommand() .. args .. ' -c "%d" -c ":norm! ZZ" Xn22file') ! let a = readfile('Xn22file') call assert_equal([], a) " Test for ZQ ! call writefile(['1', '2'], 'Xn22file') ! call system(GetVimCommand() . args . ' -c "%d" -c ":norm! ZQ" Xn22file') ! let a = readfile('Xn22file') call assert_equal(['1', '2'], a) " Unsupported Z command call assert_beeps('normal! ZW') " clean up ! for file in ['Xn22file'] call delete(file) endfor " let &shell = shell *** ../vim-9.0.0362/src/testdir/test_options.vim 2022-08-25 16:02:09.681816465 +0100 --- src/testdir/test_options.vim 2022-09-02 21:06:48.534817804 +0100 *************** *** 883,889 **** new call setline(1, ['L1']) set nowrite ! call assert_fails('write Xfile', 'E142:') set write close! endfunc --- 883,889 ---- new call setline(1, ['L1']) set nowrite ! call assert_fails('write Xwrfile', 'E142:') set write close! endfunc *** ../vim-9.0.0362/src/testdir/test_plus_arg_edit.vim 2020-08-12 17:43:41.000000000 +0100 --- src/testdir/test_plus_arg_edit.vim 2022-09-02 21:07:11.534796184 +0100 *************** *** 12,37 **** func Test_edit_bad() " Test loading a utf8 file with bad utf8 sequences. ! call writefile(["[\xff][\xc0][\xe2\x89\xf0][\xc2\xc2]"], "Xfile") new " Without ++bad=..., the default behavior is like ++bad=? ! e! ++enc=utf8 Xfile call assert_equal('[?][?][???][??]', getline(1)) ! e! ++encoding=utf8 ++bad=_ Xfile call assert_equal('[_][_][___][__]', getline(1)) ! e! ++enc=utf8 ++bad=drop Xfile call assert_equal('[][][][]', getline(1)) ! e! ++enc=utf8 ++bad=keep Xfile call assert_equal("[\xff][\xc0][\xe2\x89\xf0][\xc2\xc2]", getline(1)) ! call assert_fails('e! ++enc=utf8 ++bad=foo Xfile', 'E474:') bw! ! call delete('Xfile') endfunc " Test for ++bin and ++nobin arguments --- 12,37 ---- func Test_edit_bad() " Test loading a utf8 file with bad utf8 sequences. ! call writefile(["[\xff][\xc0][\xe2\x89\xf0][\xc2\xc2]"], "Xbadfile") new " Without ++bad=..., the default behavior is like ++bad=? ! e! ++enc=utf8 Xbadfile call assert_equal('[?][?][???][??]', getline(1)) ! e! ++encoding=utf8 ++bad=_ Xbadfile call assert_equal('[_][_][___][__]', getline(1)) ! e! ++enc=utf8 ++bad=drop Xbadfile call assert_equal('[][][][]', getline(1)) ! e! ++enc=utf8 ++bad=keep Xbadfile call assert_equal("[\xff][\xc0][\xe2\x89\xf0][\xc2\xc2]", getline(1)) ! call assert_fails('e! ++enc=utf8 ++bad=foo Xbadfile', 'E474:') bw! ! call delete('Xbadfile') endfunc " Test for ++bin and ++nobin arguments *** ../vim-9.0.0362/src/testdir/test_popupwin.vim 2022-08-30 19:48:17.206760205 +0100 --- src/testdir/test_popupwin.vim 2022-09-02 21:08:02.902747769 +0100 *************** *** 4104,4110 **** func Test_popup_setoptions_other_tab() ! new Xfile let winid = win_getid() call setline(1, 'some text') call prop_type_add('textprop', {}) --- 4104,4110 ---- func Test_popup_setoptions_other_tab() ! new Xpotfile let winid = win_getid() call setline(1, 'some text') call prop_type_add('textprop', {}) *************** *** 4116,4122 **** tabclose call popup_close(id) ! bwipe! Xfile call prop_type_delete('textprop') endfunc --- 4116,4122 ---- tabclose call popup_close(id) ! bwipe! Xpotfile call prop_type_delete('textprop') endfunc *** ../vim-9.0.0362/src/testdir/test_python2.vim 2021-11-21 11:32:04.000000000 +0000 --- src/testdir/test_python2.vim 2022-09-02 21:10:05.990897396 +0100 *************** *** 1565,1575 **** %bw! " Range object for a deleted buffer ! new Xfile call setline(1, ['one', 'two', 'three']) py b = vim.current.buffer py r = vim.current.buffer.range(0, 2) ! call assert_equal('', pyeval('repr(r)')) %bw! call AssertException(['py r[:] = []'], \ 'Vim(python):vim.error: attempt to refer to deleted buffer') --- 1565,1575 ---- %bw! " Range object for a deleted buffer ! new Xpbuffile call setline(1, ['one', 'two', 'three']) py b = vim.current.buffer py r = vim.current.buffer.range(0, 2) ! call assert_equal('', pyeval('repr(r)')) %bw! call AssertException(['py r[:] = []'], \ 'Vim(python):vim.error: attempt to refer to deleted buffer') *************** *** 1598,1604 **** " Test vim.buffers object func Test_python_buffers() %bw! ! edit Xfile py cb = vim.current.buffer set hidden edit a --- 1598,1604 ---- " Test vim.buffers object func Test_python_buffers() %bw! ! edit Xpbuffile py cb = vim.current.buffer set hidden edit a *************** *** 1626,1633 **** cb.append('i3:' + str(next(i3))) del i3 EOF ! call assert_equal(['i:', ! \ 'i2:', 'i:', 'i3:'], \ getline(2, '$')) %d --- 1626,1633 ---- cb.append('i3:' + str(next(i3))) del i3 EOF ! call assert_equal(['i:', ! \ 'i2:', 'i:', 'i3:'], \ getline(2, '$')) %d *************** *** 1645,1651 **** cb.append(str(len(vim.buffers))) EOF ! call assert_equal([bufnr('Xfile') .. ':=', \ bufnr('a') .. ':=', \ bufnr('b') .. ':=', \ bufnr('c') .. ':=', '4'], getline(2, '$')) --- 1645,1651 ---- cb.append(str(len(vim.buffers))) EOF ! call assert_equal([bufnr('Xpbuffile') .. ':=', \ bufnr('a') .. ':=', \ bufnr('b') .. ':=', \ bufnr('c') .. ':=', '4'], getline(2, '$')) *************** *** 1675,1689 **** del i4 del bnums EOF ! call assert_equal(['i4:', ! \ 'i4:', 'StopIteration'], getline(2, '$')) %bw! endfunc " Test vim.{tabpage,window}list and vim.{tabpage,window} objects func Test_python_tabpage_window() %bw ! edit Xfile py cb = vim.current.buffer tabnew 0 tabnew 1 --- 1675,1689 ---- del i4 del bnums EOF ! call assert_equal(['i4:', ! \ 'i4:', 'StopIteration'], getline(2, '$')) %bw! endfunc " Test vim.{tabpage,window}list and vim.{tabpage,window} objects func Test_python_tabpage_window() %bw ! edit Xpbuffile py cb = vim.current.buffer tabnew 0 tabnew 1 *************** *** 1748,1754 **** Current tab pages: (1): 1 windows, current is Windows: ! (1): displays buffer ; cursor is at (2, 0) (2): 1 windows, current is Windows: (1): displays buffer ; cursor is at (1, 0) --- 1748,1754 ---- Current tab pages: (1): 1 windows, current is Windows: ! (1): displays buffer ; cursor is at (2, 0) (2): 1 windows, current is Windows: (1): displays buffer ; cursor is at (1, 0) *************** *** 1764,1777 **** (4): displays buffer ; cursor is at (1, 0) Number of windows in current tab page: 4 END ! call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$')) %bw! endfunc " Test vim.current func Test_python_vim_current() %bw ! edit Xfile py cb = vim.current.buffer tabnew 0 tabnew 1 --- 1764,1777 ---- (4): displays buffer ; cursor is at (1, 0) Number of windows in current tab page: 4 END ! call assert_equal(expected, getbufline(bufnr('Xpbuffile'), 2, '$')) %bw! endfunc " Test vim.current func Test_python_vim_current() %bw ! edit Xpbuffile py cb = vim.current.buffer tabnew 0 tabnew 1 *************** *** 1797,1804 **** Current window: : is Current buffer: : is is END ! call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$')) ! call deletebufline(bufnr('Xfile'), 1, '$') " Assigning: fails py << trim EOF --- 1797,1804 ---- Current window: : is Current buffer: : is is END ! call assert_equal(expected, getbufline(bufnr('Xpbuffile'), 2, '$')) ! call deletebufline(bufnr('Xpbuffile'), 1, '$') " Assigning: fails py << trim EOF *************** *** 1821,1830 **** Type error at assigning None to vim.current.tabpage Type error at assigning None to vim.current.buffer END ! call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$')) ! call deletebufline(bufnr('Xfile'), 1, '$') ! call setbufline(bufnr('Xfile'), 1, 'python interface') py << trim EOF # Assigning: success vim.current.tabpage = vim.tabpages[-2] --- 1821,1830 ---- Type error at assigning None to vim.current.tabpage Type error at assigning None to vim.current.buffer END ! call assert_equal(expected, getbufline(bufnr('Xpbuffile'), 2, '$')) ! call deletebufline(bufnr('Xpbuffile'), 1, '$') ! call setbufline(bufnr('Xpbuffile'), 1, 'python interface') py << trim EOF # Assigning: success vim.current.tabpage = vim.tabpages[-2] *************** *** 1840,1852 **** let expected =<< trim END Current tab page: Current window: ! Current buffer: Current line: 'python interface' END ! call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$')) py vim.current.line = 'one line' call assert_equal('one line', getline('.')) ! call deletebufline(bufnr('Xfile'), 1, '$') py << trim EOF ws = list(vim.windows) --- 1840,1852 ---- let expected =<< trim END Current tab page: Current window: ! Current buffer: Current line: 'python interface' END ! call assert_equal(expected, getbufline(bufnr('Xpbuffile'), 2, '$')) py vim.current.line = 'one line' call assert_equal('one line', getline('.')) ! call deletebufline(bufnr('Xpbuffile'), 1, '$') py << trim EOF ws = list(vim.windows) *************** *** 1866,1872 **** w.valid: [True, False] t.valid: [True, False, True, False] END ! call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$')) %bw! endfunc --- 1866,1872 ---- w.valid: [True, False] t.valid: [True, False, True, False] END ! call assert_equal(expected, getbufline(bufnr('Xpbuffile'), 2, '$')) %bw! endfunc *************** *** 2409,2415 **** " Test chdir func Test_python_chdir() ! new Xfile py cb = vim.current.buffer py << trim EOF import os --- 2409,2415 ---- " Test chdir func Test_python_chdir() ! new Xpycfile py cb = vim.current.buffer py << trim EOF import os *************** *** 2420,2426 **** path = fnamemodify('.', ':p:h:t') if path != 'src' and path != 'src2': # Running tests from a shadow directory, so move up another level ! # This will result in @% looking like shadow/testdir/Xfile, hence the # extra fnamemodify os.chdir('..') cb.append(fnamemodify('.', ':p:h:t')) --- 2420,2426 ---- path = fnamemodify('.', ':p:h:t') if path != 'src' and path != 'src2': # Running tests from a shadow directory, so move up another level ! # This will result in @% looking like shadow/testdir/Xpycfile, hence the # extra fnamemodify os.chdir('..') cb.append(fnamemodify('.', ':p:h:t')) *************** *** 2436,2443 **** cb.append(vim.eval('@%')) del fnamemodify EOF ! call assert_equal(['testdir', 'Xfile', 'src', 'testdir/Xfile', 'testdir', ! \ 'Xfile'], getline(2, '$')) close! call AssertException(["py vim.chdir(None)"], "Vim(python):TypeError:") endfunc --- 2436,2443 ---- cb.append(vim.eval('@%')) del fnamemodify EOF ! call assert_equal(['testdir', 'Xpycfile', 'src', 'testdir/Xpycfile', 'testdir', ! \ 'Xpycfile'], getline(2, '$')) close! call AssertException(["py vim.chdir(None)"], "Vim(python):TypeError:") endfunc *** ../vim-9.0.0362/src/testdir/test_python3.vim 2022-05-27 20:20:27.000000000 +0100 --- src/testdir/test_python3.vim 2022-09-02 21:11:16.526979508 +0100 *************** *** 1762,1772 **** %bw! " Range object for a deleted buffer ! new Xfile call setline(1, ['one', 'two', 'three']) py3 b = vim.current.buffer py3 r = vim.current.buffer.range(0, 2) ! call assert_equal('', py3eval('repr(r)')) %bw! call AssertException(['py3 r[:] = []'], \ 'Vim(py3):vim.error: attempt to refer to deleted buffer') --- 1762,1772 ---- %bw! " Range object for a deleted buffer ! new Xp3buffile call setline(1, ['one', 'two', 'three']) py3 b = vim.current.buffer py3 r = vim.current.buffer.range(0, 2) ! call assert_equal('', py3eval('repr(r)')) %bw! call AssertException(['py3 r[:] = []'], \ 'Vim(py3):vim.error: attempt to refer to deleted buffer') *************** *** 1795,1801 **** " Test vim.buffers object func Test_python3_buffers() %bw! ! edit Xfile py3 cb = vim.current.buffer set hidden edit a --- 1795,1801 ---- " Test vim.buffers object func Test_python3_buffers() %bw! ! edit Xp3buffile py3 cb = vim.current.buffer set hidden edit a *************** *** 1819,1826 **** cb.append('i3:' + str(next(i3))) del i3 EOF ! call assert_equal(['i:', ! \ 'i2:', 'i:', 'i3:'], \ getline(2, '$')) %d --- 1819,1826 ---- cb.append('i3:' + str(next(i3))) del i3 EOF ! call assert_equal(['i:', ! \ 'i2:', 'i:', 'i3:'], \ getline(2, '$')) %d *************** *** 1838,1844 **** cb.append(str(len(vim.buffers))) EOF ! call assert_equal([bufnr('Xfile') .. ':=', \ bufnr('a') .. ':=', \ bufnr('b') .. ':=', \ bufnr('c') .. ':=', '4'], getline(2, '$')) --- 1838,1844 ---- cb.append(str(len(vim.buffers))) EOF ! call assert_equal([bufnr('Xp3buffile') .. ':=', \ bufnr('a') .. ':=', \ bufnr('b') .. ':=', \ bufnr('c') .. ':=', '4'], getline(2, '$')) *************** *** 1868,1882 **** del i4 del bnums EOF ! call assert_equal(['i4:', ! \ 'i4:', 'StopIteration'], getline(2, '$')) %bw! endfunc " Test vim.{tabpage,window}list and vim.{tabpage,window} objects func Test_python3_tabpage_window() %bw ! edit Xfile py3 cb = vim.current.buffer tabnew 0 tabnew 1 --- 1868,1882 ---- del i4 del bnums EOF ! call assert_equal(['i4:', ! \ 'i4:', 'StopIteration'], getline(2, '$')) %bw! endfunc " Test vim.{tabpage,window}list and vim.{tabpage,window} objects func Test_python3_tabpage_window() %bw ! edit Xp3buffile py3 cb = vim.current.buffer tabnew 0 tabnew 1 *************** *** 1937,1943 **** Current tab pages: (1): 1 windows, current is Windows: ! (1): displays buffer ; cursor is at (2, 0) (2): 1 windows, current is Windows: (1): displays buffer ; cursor is at (1, 0) --- 1937,1943 ---- Current tab pages: (1): 1 windows, current is Windows: ! (1): displays buffer ; cursor is at (2, 0) (2): 1 windows, current is Windows: (1): displays buffer ; cursor is at (1, 0) *************** *** 1953,1966 **** (4): displays buffer ; cursor is at (1, 0) Number of windows in current tab page: 4 END ! call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$')) %bw! endfunc " Test vim.current func Test_python3_vim_current() %bw ! edit Xfile py3 cb = vim.current.buffer tabnew 0 tabnew 1 --- 1953,1966 ---- (4): displays buffer ; cursor is at (1, 0) Number of windows in current tab page: 4 END ! call assert_equal(expected, getbufline(bufnr('Xp3buffile'), 2, '$')) %bw! endfunc " Test vim.current func Test_python3_vim_current() %bw ! edit Xpy3cfile py3 cb = vim.current.buffer tabnew 0 tabnew 1 *************** *** 1986,1993 **** Current window: : is Current buffer: : is is END ! call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$')) ! call deletebufline(bufnr('Xfile'), 1, '$') " Assigning: fails py3 << trim EOF --- 1986,1993 ---- Current window: : is Current buffer: : is is END ! call assert_equal(expected, getbufline(bufnr('Xpy3cfile'), 2, '$')) ! call deletebufline(bufnr('Xpy3cfile'), 1, '$') " Assigning: fails py3 << trim EOF *************** *** 2010,2019 **** Type error at assigning None to vim.current.tabpage Type error at assigning None to vim.current.buffer END ! call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$')) ! call deletebufline(bufnr('Xfile'), 1, '$') ! call setbufline(bufnr('Xfile'), 1, 'python interface') py3 << trim EOF # Assigning: success vim.current.tabpage = vim.tabpages[-2] --- 2010,2019 ---- Type error at assigning None to vim.current.tabpage Type error at assigning None to vim.current.buffer END ! call assert_equal(expected, getbufline(bufnr('Xpy3cfile'), 2, '$')) ! call deletebufline(bufnr('Xpy3cfile'), 1, '$') ! call setbufline(bufnr('Xpy3cfile'), 1, 'python interface') py3 << trim EOF # Assigning: success vim.current.tabpage = vim.tabpages[-2] *************** *** 2029,2041 **** let expected =<< trim END Current tab page: Current window: ! Current buffer: Current line: 'python interface' END ! call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$')) py3 vim.current.line = 'one line' call assert_equal('one line', getline('.')) ! call deletebufline(bufnr('Xfile'), 1, '$') py3 << trim EOF ws = list(vim.windows) --- 2029,2041 ---- let expected =<< trim END Current tab page: Current window: ! Current buffer: Current line: 'python interface' END ! call assert_equal(expected, getbufline(bufnr('Xpy3cfile'), 2, '$')) py3 vim.current.line = 'one line' call assert_equal('one line', getline('.')) ! call deletebufline(bufnr('Xpy3cfile'), 1, '$') py3 << trim EOF ws = list(vim.windows) *************** *** 2055,2061 **** w.valid: [True, False] t.valid: [True, False, True, False] END ! call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$')) %bw! endfunc --- 2055,2061 ---- w.valid: [True, False] t.valid: [True, False, True, False] END ! call assert_equal(expected, getbufline(bufnr('Xpy3cfile'), 2, '$')) %bw! endfunc *************** *** 2598,2604 **** " Test chdir func Test_python3_chdir() ! new Xfile py3 cb = vim.current.buffer py3 << trim EOF import os --- 2598,2604 ---- " Test chdir func Test_python3_chdir() ! new Xp3cdfile py3 cb = vim.current.buffer py3 << trim EOF import os *************** *** 2609,2615 **** path = fnamemodify('.', ':p:h:t') if path != b'src' and path != b'src2': # Running tests from a shadow directory, so move up another level ! # This will result in @% looking like shadow/testdir/Xfile, hence the # slicing to remove the leading path and path separator os.chdir('..') cb.append(str(fnamemodify('.', ':p:h:t'))) --- 2609,2615 ---- path = fnamemodify('.', ':p:h:t') if path != b'src' and path != b'src2': # Running tests from a shadow directory, so move up another level ! # This will result in @% looking like shadow/testdir/Xp3cdfile, hence the # slicing to remove the leading path and path separator os.chdir('..') cb.append(str(fnamemodify('.', ':p:h:t'))) *************** *** 2625,2632 **** cb.append(vim.eval('@%')) del fnamemodify EOF ! call assert_equal(["b'testdir'", 'Xfile', "b'src'", 'testdir/Xfile', ! \"b'testdir'", 'Xfile'], getline(2, '$')) close! call AssertException(["py3 vim.chdir(None)"], "Vim(py3):TypeError:") endfunc --- 2625,2632 ---- cb.append(vim.eval('@%')) del fnamemodify EOF ! call assert_equal(["b'testdir'", 'Xp3cdfile', "b'src'", 'testdir/Xp3cdfile', ! \"b'testdir'", 'Xp3cdfile'], getline(2, '$')) close! call AssertException(["py3 vim.chdir(None)"], "Vim(py3):TypeError:") endfunc *** ../vim-9.0.0362/src/testdir/test_source.vim 2022-05-17 17:45:30.000000000 +0100 --- src/testdir/test_source.vim 2022-09-02 21:15:41.943155870 +0100 *************** *** 63,72 **** " When sourcing a vim script, shebang should be ignored. func Test_source_ignore_shebang() ! call writefile(['#!./xyzabc', 'let g:val=369'], 'Xfile.vim') ! source Xfile.vim call assert_equal(g:val, 369) ! call delete('Xfile.vim') endfunc " Test for expanding in an autocmd and for and --- 63,72 ---- " When sourcing a vim script, shebang should be ignored. func Test_source_ignore_shebang() ! call writefile(['#!./xyzabc', 'let g:val=369'], 'Xsisfile.vim') ! source Xsisfile.vim call assert_equal(g:val, 369) ! call delete('Xsisfile.vim') endfunc " Test for expanding in an autocmd and for and *************** *** 480,491 **** augroup Test au! ! au BufNewFile Xfile g:readFile = 1 | g:readExtra = 2 augroup END g:readFile = 0 g:readExtra = 0 ! new Xfile bwipe! augroup Test au! --- 480,491 ---- augroup Test au! ! au BufNewFile Xsubfile g:readFile = 1 | g:readExtra = 2 augroup END g:readFile = 0 g:readExtra = 0 ! new Xsubfile bwipe! augroup Test au! *** ../vim-9.0.0362/src/testdir/test_stat.vim 2021-10-18 14:33:53.000000000 +0100 --- src/testdir/test_stat.vim 2022-09-02 21:16:20.767167929 +0100 *************** *** 171,177 **** return endif ! silent !ln -s Xfile Xlink call assert_equal('link', getftype('Xlink')) call delete('Xlink') --- 171,177 ---- return endif ! silent !ln -s Xlinkfile Xlink call assert_equal('link', getftype('Xlink')) call delete('Xlink') *** ../vim-9.0.0362/src/testdir/test_substitute.vim 2022-06-21 22:13:30.000000000 +0100 --- src/testdir/test_substitute.vim 2022-09-02 21:17:04.567178194 +0100 *************** *** 141,147 **** func Test_substitute_repeat() " This caused an invalid memory access. ! split Xfile s/^/x call feedkeys("Qsc\y", 'tx') bwipe! --- 141,147 ---- func Test_substitute_repeat() " This caused an invalid memory access. ! split Xsubfile s/^/x call feedkeys("Qsc\y", 'tx') bwipe! *************** *** 1068,1074 **** new norm o0000000000000000000000000000000000000000000000000000 func EditScript() ! silent! scr! Xfile endfunc s/\%')/\=EditScript() --- 1068,1074 ---- new norm o0000000000000000000000000000000000000000000000000000 func EditScript() ! silent! scr! Xsedfile endfunc s/\%')/\=EditScript() *** ../vim-9.0.0362/src/testdir/test_tabpage.vim 2022-04-03 11:14:32.000000000 +0100 --- src/testdir/test_tabpage.vim 2022-09-02 21:17:20.807181158 +0100 *************** *** 768,781 **** func Test_tabpage_close_on_switch() tabnew tabnew ! edit Xfile augroup T2 au! ! au BufLeave Xfile 1tabclose augroup END tabfirst call assert_equal(2, tabpagenr()) ! call assert_equal('Xfile', @%) augroup T2 au! augroup END --- 768,781 ---- func Test_tabpage_close_on_switch() tabnew tabnew ! edit Xtabfile augroup T2 au! ! au BufLeave Xtabfile 1tabclose augroup END tabfirst call assert_equal(2, tabpagenr()) ! call assert_equal('Xtabfile', @%) augroup T2 au! augroup END *** ../vim-9.0.0362/src/testdir/test_tagjump.vim 2022-09-02 15:15:11.063569185 +0100 --- src/testdir/test_tagjump.vim 2022-09-02 21:23:36.291152824 +0100 *************** *** 15,34 **** func Test_ptjump() CheckFeature quickfix ! set tags=Xtags call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", ! \ "one\tXfile\t1", ! \ "three\tXfile\t3", ! \ "two\tXfile\t2"], ! \ 'Xtags') ! call writefile(['one', 'two', 'three'], 'Xfile') %bw! ptjump two call assert_equal(2, winnr()) wincmd p call assert_equal(1, &previewwindow) ! call assert_equal('Xfile', expand("%:p:t")) call assert_equal(2, line('.')) call assert_equal(2, winnr('$')) call assert_equal(1, winnr()) --- 15,34 ---- func Test_ptjump() CheckFeature quickfix ! set tags=Xpttags call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", ! \ "one\tXptfile\t1", ! \ "three\tXptfile\t3", ! \ "two\tXptfile\t2"], ! \ 'Xpttags') ! call writefile(['one', 'two', 'three'], 'Xptfile') %bw! ptjump two call assert_equal(2, winnr()) wincmd p call assert_equal(1, &previewwindow) ! call assert_equal('Xptfile', expand("%:p:t")) call assert_equal(2, line('.')) call assert_equal(2, winnr('$')) call assert_equal(1, winnr()) *************** *** 38,44 **** call assert_equal(2, winnr()) wincmd p call assert_equal(1, &previewwindow) ! call assert_equal('Xfile', expand("%:p:t")) call assert_equal(3, line('.')) call assert_equal(2, winnr('$')) call assert_equal(1, winnr()) --- 38,44 ---- call assert_equal(2, winnr()) wincmd p call assert_equal(1, &previewwindow) ! call assert_equal('Xptfile', expand("%:p:t")) call assert_equal(3, line('.')) call assert_equal(2, winnr('$')) call assert_equal(1, winnr()) *************** *** 48,55 **** call assert_equal(5, winheight(0)) close ! call delete('Xtags') ! call delete('Xfile') set tags& endfunc --- 48,55 ---- call assert_equal(5, winheight(0)) close ! call delete('Xpttags') ! call delete('Xptfile') set tags& endfunc *************** *** 73,84 **** endfunc func Test_static_tagjump() ! set tags=Xtags call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", ! \ "one\tXfile1\t/^one/;\"\tf\tfile:\tsignature:(void)", ! \ "word\tXfile2\tcmd2"], ! \ 'Xtags') ! new Xfile1 call setline(1, ['empty', 'one()', 'empty']) write tag one --- 73,84 ---- endfunc func Test_static_tagjump() ! set tags=Xtjtags call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", ! \ "one\tXtjfile1\t/^one/;\"\tf\tfile:\tsignature:(void)", ! \ "word\tXtjfile2\tcmd2"], ! \ 'Xtjtags') ! new Xtjfile1 call setline(1, ['empty', 'one()', 'empty']) write tag one *************** *** 86,104 **** bwipe! set tags& ! call delete('Xtags') ! call delete('Xfile1') endfunc func Test_duplicate_tagjump() ! set tags=Xtags call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", ! \ "thesame\tXfile1\t1;\"\td\tfile:", ! \ "thesame\tXfile1\t2;\"\td\tfile:", ! \ "thesame\tXfile1\t3;\"\td\tfile:", \ ], ! \ 'Xtags') ! new Xfile1 call setline(1, ['thesame one', 'thesame two', 'thesame three']) write tag thesame --- 86,104 ---- bwipe! set tags& ! call delete('Xtjtags') ! call delete('Xtjfile1') endfunc func Test_duplicate_tagjump() ! set tags=Xdttags call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", ! \ "thesame\tXdtfile1\t1;\"\td\tfile:", ! \ "thesame\tXdtfile1\t2;\"\td\tfile:", ! \ "thesame\tXdtfile1\t3;\"\td\tfile:", \ ], ! \ 'Xdttags') ! new Xdtfile1 call setline(1, ['thesame one', 'thesame two', 'thesame three']) write tag thesame *************** *** 110,128 **** bwipe! set tags& ! call delete('Xtags') ! call delete('Xfile1') endfunc func Test_tagjump_switchbuf() CheckFeature quickfix ! set tags=Xtags call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", ! \ "second\tXfile1\t2", ! \ "third\tXfile1\t3",], ! \ 'Xtags') ! call writefile(['first', 'second', 'third'], 'Xfile1') enew | only set switchbuf= --- 110,128 ---- bwipe! set tags& ! call delete('Xdttags') ! call delete('Xdtfile1') endfunc func Test_tagjump_switchbuf() CheckFeature quickfix ! set tags=Xswtags call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", ! \ "second\tXsbfile1\t2", ! \ "third\tXsbfile1\t3",], ! \ 'Xswtags') ! call writefile(['first', 'second', 'third'], 'Xsbfile1') enew | only set switchbuf= *************** *** 153,160 **** tabclose! enew | only ! call delete('Xfile1') ! call delete('Xtags') set tags& set switchbuf&vim endfunc --- 153,160 ---- tabclose! enew | only ! call delete('Xsbfile1') ! call delete('Xswtags') set tags& set switchbuf&vim endfunc *************** *** 205,218 **** call writefile([ \ "SECTION_OFF " . getcwd() . "/Xtest.dir/Xtest.c /^#define SECTION_OFF 3$/", \ '', ! \ ], 'Xtags') call writefile(['#define SECTION_OFF 3', \ '#define NUM_SECTIONS 3'], 'Xtest.c') " Try jumping to a tag, but with a path that contains a symbolic link. When " wrong, this will give the ATTENTION message. The next space will then be " eaten by hit-return, instead of moving the cursor to 'd'. ! set tags=Xtags enew! call append(0, 'SECTION_OFF') call cursor(1,1) --- 205,218 ---- call writefile([ \ "SECTION_OFF " . getcwd() . "/Xtest.dir/Xtest.c /^#define SECTION_OFF 3$/", \ '', ! \ ], 'Xsymtags') call writefile(['#define SECTION_OFF 3', \ '#define NUM_SECTIONS 3'], 'Xtest.c') " Try jumping to a tag, but with a path that contains a symbolic link. When " wrong, this will give the ATTENTION message. The next space will then be " eaten by hit-return, instead of moving the cursor to 'd'. ! set tags=Xsymtags enew! call append(0, 'SECTION_OFF') call cursor(1,1) *************** *** 223,229 **** set hidden& set tags& enew! ! call delete('Xtags') call delete('Xtest.c') call delete("Xtest.dir", "rf") %bwipe! --- 223,229 ---- set hidden& set tags& enew! ! call delete('Xsymtags') call delete('Xtest.c') call delete("Xtest.dir", "rf") %bwipe! *************** *** 263,274 **** new let content = ['!_TAG_FILE_ENCODING cp932 //', \ "\x82`\x82a\x82b Xtags2.txt /\x82`\x82a\x82b"] ! call writefile(content, 'Xtags') ! set tags=Xtags tag /.BC call assert_equal('Xtags2.txt', expand('%:t')) call assert_equal('ABC', getline('.')) ! call delete('Xtags') close " case3: --- 263,274 ---- new let content = ['!_TAG_FILE_ENCODING cp932 //', \ "\x82`\x82a\x82b Xtags2.txt /\x82`\x82a\x82b"] ! call writefile(content, 'Xenctags') ! set tags=Xenctags tag /.BC call assert_equal('Xtags2.txt', expand('%:t')) call assert_equal('ABC', getline('.')) ! call delete('Xenctags') close " case3: *************** *** 280,291 **** call add(contents, 'abc' .. i \ .. " Xtags3.txt /\x82`\x82a\x82b") endfor ! call writefile(contents, 'Xtags') ! set tags=Xtags tag abc50 call assert_equal('Xtags3.txt', expand('%:t')) call assert_equal('ABC', getline('.')) ! call delete('Xtags') close set tags& --- 280,291 ---- call add(contents, 'abc' .. i \ .. " Xtags3.txt /\x82`\x82a\x82b") endfor ! call writefile(contents, 'Xenctags') ! set tags=Xenctags tag abc50 call assert_equal('Xtags3.txt', expand('%:t')) call assert_equal('ABC', getline('.')) ! call delete('Xenctags') close set tags& *************** *** 314,321 **** \ "Xmain.c,64", \ "void foo() {}\x7ffoo\x011,0", \ "int main(int argc, char **argv)\x7fmain\x012,14", ! \ ], 'Xtags') ! set tags=Xtags ta foo call assert_equal('void foo() {}', getline('.')) --- 314,321 ---- \ "Xmain.c,64", \ "void foo() {}\x7ffoo\x011,0", \ "int main(int argc, char **argv)\x7fmain\x012,14", ! \ ], 'Xtetags') ! set tags=Xtetags ta foo call assert_equal('void foo() {}', getline('.')) *************** *** 328,334 **** \ "Xnonexisting,include", \ "\x0c", \ "Xtags2,include" ! \ ], 'Xtags') call writefile([ \ "\x0c", \ "Xmain.c,64", --- 328,334 ---- \ "Xnonexisting,include", \ "\x0c", \ "Xtags2,include" ! \ ], 'Xtetags') call writefile([ \ "\x0c", \ "Xmain.c,64", *************** *** 343,349 **** \ "\x0c", \ "Xmain.c,8", \ "int main" ! \ ], 'Xtags', 'b') call assert_fails('tag foo', 'E426:') " invalid line number --- 343,349 ---- \ "\x0c", \ "Xmain.c,8", \ "int main" ! \ ], 'Xtetags', 'b') call assert_fails('tag foo', 'E426:') " invalid line number *************** *** 351,357 **** \ "\x0c", \ "Xmain.c,64", \ "void foo() {}\x7ffoo\x0abc,0", ! \ ], 'Xtags') call assert_fails('tag foo', 'E426:') " invalid tag name --- 351,357 ---- \ "\x0c", \ "Xmain.c,64", \ "void foo() {}\x7ffoo\x0abc,0", ! \ ], 'Xtetags') call assert_fails('tag foo', 'E426:') " invalid tag name *************** *** 359,365 **** \ "\x0c", \ "Xmain.c,64", \ ";;;;\x7f1,0", ! \ ], 'Xtags') call assert_fails('tag foo', 'E431:') " end of file after a CTRL-L line --- 359,365 ---- \ "\x0c", \ "Xmain.c,64", \ ";;;;\x7f1,0", ! \ ], 'Xtetags') call assert_fails('tag foo', 'E431:') " end of file after a CTRL-L line *************** *** 368,381 **** \ "Xmain.c,64", \ "void foo() {}\x7ffoo\x011,0", \ "\x0c", ! \ ], 'Xtags') call assert_fails('tag main', 'E426:') " error in an included tags file call writefile([ \ "\x0c", \ "Xtags2,include" ! \ ], 'Xtags') call writefile([ \ "\x0c", \ "Xmain.c,64", --- 368,381 ---- \ "Xmain.c,64", \ "void foo() {}\x7ffoo\x011,0", \ "\x0c", ! \ ], 'Xtetags') call assert_fails('tag main', 'E426:') " error in an included tags file call writefile([ \ "\x0c", \ "Xtags2,include" ! \ ], 'Xtetags') call writefile([ \ "\x0c", \ "Xmain.c,64", *************** *** 383,389 **** \ ], 'Xtags2') call assert_fails('tag foo', 'E431:') ! call delete('Xtags') call delete('Xtags2') call delete('Xmain.c') set tags& --- 383,389 ---- \ ], 'Xtags2') call assert_fails('tag foo', 'E431:') ! call delete('Xtetags') call delete('Xtags2') call delete('Xmain.c') set tags& *************** *** 392,400 **** " Test for getting and modifying the tag stack func Test_getsettagstack() ! call writefile(['line1', 'line2', 'line3'], 'Xfile1') ! call writefile(['line1', 'line2', 'line3'], 'Xfile2') ! call writefile(['line1', 'line2', 'line3'], 'Xfile3') enew | only call settagstack(1, {'items' : []}) --- 392,400 ---- " Test for getting and modifying the tag stack func Test_getsettagstack() ! call writefile(['line1', 'line2', 'line3'], 'Xstsfile1') ! call writefile(['line1', 'line2', 'line3'], 'Xstsfile2') ! call writefile(['line1', 'line2', 'line3'], 'Xstsfile3') enew | only call settagstack(1, {'items' : []}) *************** *** 409,420 **** call assert_fails("call settagstack(1, {'items' : []}, 'b')", 'E962:') call assert_equal(-1, settagstack(0, test_null_dict())) ! set tags=Xtags call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", ! \ "one\tXfile1\t1", ! \ "three\tXfile3\t3", ! \ "two\tXfile2\t2"], ! \ 'Xtags') let stk = [] call add(stk, {'bufnr' : bufnr('%'), 'tagname' : 'one', --- 409,420 ---- call assert_fails("call settagstack(1, {'items' : []}, 'b')", 'E962:') call assert_equal(-1, settagstack(0, test_null_dict())) ! set tags=Xtsttags call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", ! \ "one\tXstsfile1\t1", ! \ "three\tXstsfile3\t3", ! \ "two\tXstsfile2\t2"], ! \ 'Xtsttags') let stk = [] call add(stk, {'bufnr' : bufnr('%'), 'tagname' : 'one', *************** *** 495,504 **** " Tag with multiple matches call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", ! \ "two\tXfile1\t1", ! \ "two\tXfile2\t3", ! \ "two\tXfile3\t2"], ! \ 'Xtags') call settagstack(1, {'items' : []}) tag two tnext --- 495,504 ---- " Tag with multiple matches call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", ! \ "two\tXstsfile1\t1", ! \ "two\tXstsfile2\t3", ! \ "two\tXstsfile3\t2"], ! \ 'Xtsttags') call settagstack(1, {'items' : []}) tag two tnext *************** *** 515,524 **** call assert_fails('call gettagstack()', 'E342:') call settagstack(1, {'items' : []}) ! call delete('Xfile1') ! call delete('Xfile2') ! call delete('Xfile3') ! call delete('Xtags') set tags& endfunc --- 515,524 ---- call assert_fails('call gettagstack()', 'E342:') call settagstack(1, {'items' : []}) ! call delete('Xstsfile1') ! call delete('Xstsfile2') ! call delete('Xstsfile3') ! call delete('Xtsttags') set tags& endfunc *************** *** 735,745 **** " Test for :ptag func Test_tag_preview() call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", ! \ "second\tXfile1\t2", ! \ "third\tXfile1\t3",], \ 'Xtags') set tags=Xtags ! call writefile(['first', 'second', 'third'], 'Xfile1') enew | only ptag third --- 735,745 ---- " Test for :ptag func Test_tag_preview() call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", ! \ "second\tXtpfile1\t2", ! \ "third\tXtpfile1\t3",], \ 'Xtags') set tags=Xtags ! call writefile(['first', 'second', 'third'], 'Xtpfile1') enew | only ptag third *************** *** 766,772 **** pclose call assert_equal(1, winnr('$')) ! call delete('Xfile1') call delete('Xtags') set tags& endfunc --- 766,772 ---- pclose call assert_equal(1, winnr('$')) ! call delete('Xtpfile1') call delete('Xtags') set tags& endfunc *************** *** 1453,1476 **** func Test_tag_length() set tags=Xtags call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", ! \ "tame\tXfile1\t1;", ! \ "tape\tXfile2\t1;"], 'Xtags') ! call writefile(['tame'], 'Xfile1') ! call writefile(['tape'], 'Xfile2') " Jumping to the tag 'tape', should instead jump to 'tame' new set taglength=2 tag tape ! call assert_equal('Xfile1', @%) " Tag search should jump to the right tag enew tag /^tape$ ! call assert_equal('Xfile2', @%) call delete('Xtags') ! call delete('Xfile1') ! call delete('Xfile2') set tags& taglength& endfunc --- 1453,1476 ---- func Test_tag_length() set tags=Xtags call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", ! \ "tame\tXtlfile1\t1;", ! \ "tape\tXtlfile2\t1;"], 'Xtags') ! call writefile(['tame'], 'Xtlfile1') ! call writefile(['tape'], 'Xtlfile2') " Jumping to the tag 'tape', should instead jump to 'tame' new set taglength=2 tag tape ! call assert_equal('Xtlfile1', @%) " Tag search should jump to the right tag enew tag /^tape$ ! call assert_equal('Xtlfile2', @%) call delete('Xtags') ! call delete('Xtlfile1') ! call delete('Xtlfile2') set tags& taglength& endfunc *** ../vim-9.0.0362/src/testdir/test_terminal.vim 2022-09-01 12:22:19.751659183 +0100 --- src/testdir/test_terminal.vim 2022-09-02 21:27:34.615070114 +0100 *************** *** 641,650 **** func Test_terminal_cwd_failure() " Case 1: Provided directory is not actually a directory. Attempt to make " the file executable as well. ! call writefile([], 'Xfile') ! call setfperm('Xfile', 'rwx------') ! call assert_fails("call term_start(&shell, {'cwd': 'Xfile'})", 'E475:') ! call delete('Xfile') " Case 2: Directory does not exist. call assert_fails("call term_start(&shell, {'cwd': 'Xdir'})", 'E475:') --- 641,650 ---- func Test_terminal_cwd_failure() " Case 1: Provided directory is not actually a directory. Attempt to make " the file executable as well. ! call writefile([], 'Xtcfile') ! call setfperm('Xftcile', 'rwx------') ! call assert_fails("call term_start(&shell, {'cwd': 'Xftcile'})", 'E475:') ! call delete('Xftcile') " Case 2: Directory does not exist. call assert_fails("call term_start(&shell, {'cwd': 'Xdir'})", 'E475:') *************** *** 878,889 **** func Test_terminal_redir_file() let g:test_is_flaky = 1 let cmd = Get_cat_123_cmd() ! let buf = term_start(cmd, {'out_io': 'file', 'out_name': 'Xfile'}) call TermWait(buf) " ConPTY may precede escape sequence. There are things that are not so. if !has('conpty') ! call WaitForAssert({-> assert_notequal(0, len(readfile("Xfile")))}) ! call assert_match('123', readfile('Xfile')[0]) endif let g:job = term_getjob(buf) call WaitForAssert({-> assert_equal("dead", job_status(g:job))}) --- 878,889 ---- func Test_terminal_redir_file() let g:test_is_flaky = 1 let cmd = Get_cat_123_cmd() ! let buf = term_start(cmd, {'out_io': 'file', 'out_name': 'Xtrfile'}) call TermWait(buf) " ConPTY may precede escape sequence. There are things that are not so. if !has('conpty') ! call WaitForAssert({-> assert_notequal(0, len(readfile("Xtrfile")))}) ! call assert_match('123', readfile('Xtrfile')[0]) endif let g:job = term_getjob(buf) call WaitForAssert({-> assert_equal("dead", job_status(g:job))}) *************** *** 894,911 **** " Just wait for a moment. sleep 50m endif ! call delete('Xfile') bwipe if has('unix') ! call writefile(['one line'], 'Xfile') ! let buf = term_start('cat', {'in_io': 'file', 'in_name': 'Xfile'}) call TermWait(buf) call WaitForAssert({-> assert_equal('one line', term_getline(buf, 1))}) let g:job = term_getjob(buf) call WaitForAssert({-> assert_equal('dead', job_status(g:job))}) bwipe ! call delete('Xfile') endif endfunc --- 894,911 ---- " Just wait for a moment. sleep 50m endif ! call delete('Xtrfile') bwipe if has('unix') ! call writefile(['one line'], 'Xtrfile') ! let buf = term_start('cat', {'in_io': 'file', 'in_name': 'Xtrfile'}) call TermWait(buf) call WaitForAssert({-> assert_equal('one line', term_getline(buf, 1))}) let g:job = term_getjob(buf) call WaitForAssert({-> assert_equal('dead', job_status(g:job))}) bwipe ! call delete('Xtrfile') endif endfunc *** ../vim-9.0.0362/src/testdir/test_terminal2.vim 2022-01-13 15:14:45.000000000 +0000 --- src/testdir/test_terminal2.vim 2022-09-02 21:28:23.283049242 +0100 *************** *** 415,425 **** \ ] for c in contents ! call writefile(c, 'Xfile') if has('win32') ! term cmd /c type Xfile else ! term cat Xfile endif let bnr = bufnr('$') call assert_equal('terminal', getbufvar(bnr, '&buftype')) --- 415,425 ---- \ ] for c in contents ! call writefile(c, 'Xdntfile') if has('win32') ! term cmd /c type Xdntfile else ! term cat Xdntfile endif let bnr = bufnr('$') call assert_equal('terminal', getbufvar(bnr, '&buftype')) *************** *** 429,435 **** quit endfor ! call delete('Xfile') endfunc func GetDummyCmd() --- 429,435 ---- quit endfor ! call delete('Xdntfile') endfunc func GetDummyCmd() *** ../vim-9.0.0362/src/testdir/test_vim9_assign.vim 2022-08-20 14:51:13.814510144 +0100 --- src/testdir/test_vim9_assign.vim 2022-09-02 21:29:10.243028099 +0100 *************** *** 2211,2217 **** END v9.CheckScriptFailure(lines, 'E476:', 1) ! edit! Xfile lines =<< trim END var edit: bool legacy edit --- 2211,2217 ---- END v9.CheckScriptFailure(lines, 'E476:', 1) ! edit! Xslfile lines =<< trim END var edit: bool legacy edit *** ../vim-9.0.0362/src/testdir/test_vim9_cmd.vim 2022-08-20 20:09:10.598693210 +0100 --- src/testdir/test_vim9_cmd.vim 2022-09-02 21:35:38.830824844 +0100 *************** *** 931,941 **** let lines =<< trim END call setline(1, 'changed') def Getout() ! confirm write Xfile enddef END call writefile(lines, 'Xconfirmscript') ! call writefile(['empty'], 'Xfile') let buf = RunVimInTerminal('-S Xconfirmscript', {'rows': 8}) call term_sendkeys(buf, ":call Getout()\n") call WaitForAssert({-> assert_match('(Y)es, \[N\]o: ', term_getline(buf, 8))}, 1000) --- 931,941 ---- let lines =<< trim END call setline(1, 'changed') def Getout() ! confirm write Xcmodfile enddef END call writefile(lines, 'Xconfirmscript') ! call writefile(['empty'], 'Xcmodfile') let buf = RunVimInTerminal('-S Xconfirmscript', {'rows': 8}) call term_sendkeys(buf, ":call Getout()\n") call WaitForAssert({-> assert_match('(Y)es, \[N\]o: ', term_getline(buf, 8))}, 1000) *************** *** 945,953 **** call TermWait(buf) call StopVimInTerminal(buf) ! call assert_equal(['changed'], readfile('Xfile')) ! call delete('Xfile') ! call delete('.Xfile.swp') " in case Vim was killed call delete('Xconfirmscript') endfunc --- 945,953 ---- call TermWait(buf) call StopVimInTerminal(buf) ! call assert_equal(['changed'], readfile('Xcmodfile')) ! call delete('Xcmodfile') ! call delete('.Xcmodfile.swp') " in case Vim was killed call delete('Xconfirmscript') endfunc *************** *** 1065,1077 **** edit Xsomefile bwipe! ! au BufNewFile Xfile g:readFile = 1 g:readFile = 0 ! edit Xfile assert_equal(1, g:readFile) bwipe! g:readFile = 0 ! noautocmd edit Xfile assert_equal(0, g:readFile) au! BufNewFile unlet g:readFile --- 1065,1077 ---- edit Xsomefile bwipe! ! au BufNewFile Xcmofile g:readFile = 1 g:readFile = 0 ! edit Xcmofile assert_equal(1, g:readFile) bwipe! g:readFile = 0 ! noautocmd edit Xcmofile assert_equal(0, g:readFile) au! BufNewFile unlet g:readFile *************** *** 1407,1413 **** enddef def Test_cmd_argument_without_colon() ! new Xfile setline(1, ['a', 'b', 'c', 'd']) write edit +3 % --- 1407,1413 ---- enddef def Test_cmd_argument_without_colon() ! new Xawcfile setline(1, ['a', 'b', 'c', 'd']) write edit +3 % *************** *** 1415,1421 **** edit +/a % assert_equal(1, getcurpos()[1]) bwipe ! delete('Xfile') enddef def Test_ambiguous_user_cmd() --- 1415,1421 ---- edit +/a % assert_equal(1, getcurpos()[1]) bwipe ! delete('Xawcfile') enddef def Test_ambiguous_user_cmd() *************** *** 1882,1888 **** var text: string redir => text echo 'hello' ! redir > Xfile redir END END v9.CheckDefFailure(lines, 'E1092:') --- 1882,1888 ---- var text: string redir => text echo 'hello' ! redir > Xnopfile redir END END v9.CheckDefFailure(lines, 'E1092:') *************** *** 2025,2034 **** " Test for the 'previewpopup' option def Test_previewpopup() set previewpopup=height:10,width:60 ! pedit Xfile var id = popup_findpreview() assert_notequal(id, 0) ! assert_match('Xfile', popup_getoptions(id).title) popup_clear() set previewpopup& enddef --- 2025,2034 ---- " Test for the 'previewpopup' option def Test_previewpopup() set previewpopup=height:10,width:60 ! pedit Xppfile var id = popup_findpreview() assert_notequal(id, 0) ! assert_match('Xppfile', popup_getoptions(id).title) popup_clear() set previewpopup& enddef *** ../vim-9.0.0362/src/testdir/test_vim9_import.vim 2022-08-29 22:31:15.923685244 +0100 --- src/testdir/test_vim9_import.vim 2022-09-02 21:36:15.962803488 +0100 *************** *** 1414,1426 **** END v9.CheckScriptSuccess(lines) ! writefile(['one', 'two'], 'Xfile') ! new Xfile ! write ++enc=ucase Xfile1 ! assert_equal(['ONE', 'TWO'], readfile('Xfile1')) ! delete('Xfile') ! delete('Xfile1') delete('Xconvert.vim') bwipe! set charconvert& --- 1414,1426 ---- END v9.CheckScriptSuccess(lines) ! writefile(['one', 'two'], 'Xiicfile') ! new Xiicfile ! write ++enc=ucase Xiicfile1 ! assert_equal(['ONE', 'TWO'], readfile('Xiicfile1')) ! delete('Xiicfile') ! delete('Xiicfile1') delete('Xconvert.vim') bwipe! set charconvert& *** ../vim-9.0.0362/src/testdir/test_vim9_script.vim 2022-09-01 16:00:49.734496290 +0100 --- src/testdir/test_vim9_script.vim 2022-09-02 21:37:24.982763143 +0100 *************** *** 968,978 **** var lines =<< trim END vim9script au BufEnter * eval 1 + 2 ! writefile(['text'], 'Xfile1') ! writefile(['text'], 'Xfile2') var items = [ ! {lnum: 1, filename: 'Xfile1', valid: true}, ! {lnum: 1, filename: 'Xfile2', valid: true} ] setqflist([], ' ', {items: items}) cwindow --- 968,978 ---- var lines =<< trim END vim9script au BufEnter * eval 1 + 2 ! writefile(['text'], 'Xcncfile1') ! writefile(['text'], 'Xcncfile2') var items = [ ! {lnum: 1, filename: 'Xcncfile1', valid: true}, ! {lnum: 1, filename: 'Xcncfile2', valid: true} ] setqflist([], ' ', {items: items}) cwindow *************** *** 988,1004 **** CnextOrCfirst() CnextOrCfirst() ! writefile([getqflist({idx: 0}).idx], 'Xresult') qall END writefile(lines, 'XCatchCnext') g:RunVim([], [], '--clean -S XCatchCnext') ! assert_equal(['1'], readfile('Xresult')) ! delete('Xfile1') ! delete('Xfile2') delete('XCatchCnext') ! delete('Xresult') enddef def Test_throw_skipped() --- 988,1004 ---- CnextOrCfirst() CnextOrCfirst() ! writefile([getqflist({idx: 0}).idx], 'Xcncresult') qall END writefile(lines, 'XCatchCnext') g:RunVim([], [], '--clean -S XCatchCnext') ! assert_equal(['1'], readfile('Xcncresult')) ! delete('Xcncfile1') ! delete('Xcncfile2') delete('XCatchCnext') ! delete('Xcncresult') enddef def Test_throw_skipped() *************** *** 2708,2714 **** '#{something', ], 'E1170:') ! split Xfile v9.CheckScriptSuccess([ 'vim9script', 'edit #something', --- 2708,2714 ---- '#{something', ], 'E1170:') ! split Xv9cfile v9.CheckScriptSuccess([ 'vim9script', 'edit #something', *************** *** 3544,3563 **** mkdir('Xhome') var lines =<< trim END vim9script ! writefile(['before: ' .. &cpo], 'Xresult') set cpo+=M ! writefile(['after: ' .. &cpo], 'Xresult', 'a') END writefile(lines, 'Xhome/.vimrc') lines =<< trim END ! call writefile(['later: ' .. &cpo], 'Xresult', 'a') END writefile(lines, 'Xlegacy') lines =<< trim END vim9script ! call writefile(['vim9: ' .. &cpo], 'Xresult', 'a') qa END writefile(lines, 'Xvim9') --- 3544,3563 ---- mkdir('Xhome') var lines =<< trim END vim9script ! writefile(['before: ' .. &cpo], 'Xrporesult') set cpo+=M ! writefile(['after: ' .. &cpo], 'Xrporesult', 'a') END writefile(lines, 'Xhome/.vimrc') lines =<< trim END ! call writefile(['later: ' .. &cpo], 'Xrporesult', 'a') END writefile(lines, 'Xlegacy') lines =<< trim END vim9script ! call writefile(['vim9: ' .. &cpo], 'Xrporesult', 'a') qa END writefile(lines, 'Xvim9') *************** *** 3570,3582 **** 'before: aABceFs', 'after: aABceFsM', 'later: aABceFsM', ! 'vim9: aABceFs'], readfile('Xresult')) $HOME = save_HOME delete('Xhome', 'rf') delete('Xlegacy') delete('Xvim9') ! delete('Xresult') endif enddef --- 3570,3582 ---- 'before: aABceFs', 'after: aABceFsM', 'later: aABceFsM', ! 'vim9: aABceFs'], readfile('Xrporesult')) $HOME = save_HOME delete('Xhome', 'rf') delete('Xlegacy') delete('Xvim9') ! delete('Xrporesult') endif enddef *** ../vim-9.0.0362/src/testdir/test_visual.vim 2022-08-13 14:09:40.979749238 +0100 --- src/testdir/test_visual.vim 2022-09-02 21:39:30.886687705 +0100 *************** *** 1472,1478 **** func Test_visual_area_adjusted_when_hiding() " The Visual area ended after the end of the line after :hide call setline(1, 'xxx') ! vsplit Xfile call setline(1, 'xxxxxxxx') norm! $o hid --- 1472,1478 ---- func Test_visual_area_adjusted_when_hiding() " The Visual area ended after the end of the line after :hide call setline(1, 'xxx') ! vsplit Xvaafile call setline(1, 'xxxxxxxx') norm! $o hid *** ../vim-9.0.0362/src/testdir/test_window_cmd.vim 2022-08-31 17:48:05.711547579 +0100 --- src/testdir/test_window_cmd.vim 2022-09-02 21:41:13.982624448 +0100 *************** *** 1083,1094 **** endtry endwhile ! call writefile(['first', 'second', 'third'], 'Xfile1') ! call writefile([], 'Xfile2') ! call writefile([], 'Xfile3') " Argument list related commands ! args Xfile1 Xfile2 Xfile3 next for cmd in ['sargument 2', 'snext', 'sprevious', 'sNext', 'srewind', \ 'sfirst', 'slast'] --- 1083,1094 ---- endtry endwhile ! call writefile(['first', 'second', 'third'], 'Xnorfile1') ! call writefile([], 'Xnorfile2') ! call writefile([], 'Xnorfile3') " Argument list related commands ! args Xnorfile1 Xnorfile2 Xnorfile3 next for cmd in ['sargument 2', 'snext', 'sprevious', 'sNext', 'srewind', \ 'sfirst', 'slast'] *************** *** 1099,1111 **** " Buffer related commands set modified hide enew ! for cmd in ['sbuffer Xfile1', 'sbnext', 'sbprevious', 'sbNext', 'sbrewind', \ 'sbfirst', 'sblast', 'sball', 'sbmodified', 'sunhide'] call assert_fails(dir .. cmd, 'E36:') endfor " Window related commands ! for cmd in ['split', 'split Xfile2', 'new', 'new Xfile3', 'sview Xfile1', \ 'sfind runtest.vim'] call assert_fails(dir .. cmd, 'E36:') endfor --- 1099,1111 ---- " Buffer related commands set modified hide enew ! for cmd in ['sbuffer Xnorfile1', 'sbnext', 'sbprevious', 'sbNext', 'sbrewind', \ 'sbfirst', 'sblast', 'sball', 'sbmodified', 'sunhide'] call assert_fails(dir .. cmd, 'E36:') endfor " Window related commands ! for cmd in ['split', 'split Xnorfile2', 'new', 'new Xnorfile3', 'sview Xnorfile1', \ 'sfind runtest.vim'] call assert_fails(dir .. cmd, 'E36:') endfor *************** *** 1128,1134 **** call assert_fails(dir .. 'lopen', 'E36:') " Preview window ! call assert_fails(dir .. 'pedit Xfile2', 'E36:') call setline(1, 'abc') call assert_fails(dir .. 'psearch abc', 'E36:') endif --- 1128,1134 ---- call assert_fails(dir .. 'lopen', 'E36:') " Preview window ! call assert_fails(dir .. 'pedit Xnorfile2', 'E36:') call setline(1, 'abc') call assert_fails(dir .. 'psearch abc', 'E36:') endif *************** *** 1136,1150 **** " Window commands (CTRL-W ^ and CTRL-W f) if a:dir_arg == 'h' call assert_fails('call feedkeys("\^", "xt")', 'E36:') ! call setline(1, 'Xfile1') call assert_fails('call feedkeys("gg\f", "xt")', 'E36:') endif enew! " Tag commands (:stag, :stselect and :stjump) call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", ! \ "second\tXfile1\t2", ! \ "third\tXfile1\t3",], \ 'Xtags') set tags=Xtags call assert_fails(dir .. 'stag second', 'E36:') --- 1136,1150 ---- " Window commands (CTRL-W ^ and CTRL-W f) if a:dir_arg == 'h' call assert_fails('call feedkeys("\^", "xt")', 'E36:') ! call setline(1, 'Xnorfile1') call assert_fails('call feedkeys("gg\f", "xt")', 'E36:') endif enew! " Tag commands (:stag, :stselect and :stjump) call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", ! \ "second\tXnorfile1\t2", ! \ "third\tXnorfile1\t3",], \ 'Xtags') set tags=Xtags call assert_fails(dir .. 'stag second', 'E36:') *************** *** 1166,1174 **** endif %bwipe! ! call delete('Xfile1') ! call delete('Xfile2') ! call delete('Xfile3') only endfunc --- 1166,1174 ---- endif %bwipe! ! call delete('Xnorfile1') ! call delete('Xnorfile2') ! call delete('Xnorfile3') only endfunc *************** *** 1387,1402 **** " window to another. func Test_close_dest_window() split ! edit Xfile " Test for BufLeave augroup T1 au! ! au BufLeave Xfile $wincmd c augroup END wincmd b call assert_equal(1, winnr('$')) ! call assert_equal('Xfile', @%) augroup T1 au! augroup END --- 1387,1402 ---- " window to another. func Test_close_dest_window() split ! edit Xdstfile " Test for BufLeave augroup T1 au! ! au BufLeave Xdstfile $wincmd c augroup END wincmd b call assert_equal(1, winnr('$')) ! call assert_equal('Xdstfile', @%) augroup T1 au! augroup END *************** *** 1410,1416 **** augroup END wincmd t call assert_equal(1, winnr('$')) ! call assert_equal('Xfile', @%) augroup T1 au! augroup END --- 1410,1416 ---- augroup END wincmd t call assert_equal(1, winnr('$')) ! call assert_equal('Xdstfile', @%) augroup T1 au! augroup END *************** *** 1595,1606 **** call assert_fails('split', 'E342:') call assert_equal(1, winnr('$')) ! edit Xfile1 ! edit Xfile2 call test_alloc_fail(GetAllocId('newwin_wvars'), 0, 0) ! call assert_fails('sb Xfile1', 'E342:') call assert_equal(1, winnr('$')) ! call assert_equal('Xfile2', @%) %bw! " FIXME: The following test crashes Vim --- 1595,1606 ---- call assert_fails('split', 'E342:') call assert_equal(1, winnr('$')) ! edit Xwaffile1 ! edit Xwaffile2 call test_alloc_fail(GetAllocId('newwin_wvars'), 0, 0) ! call assert_fails('sb Xwaffile1', 'E342:') call assert_equal(1, winnr('$')) ! call assert_equal('Xwaffile2', @%) %bw! " FIXME: The following test crashes Vim *** ../vim-9.0.0362/src/testdir/test_writefile.vim 2022-08-29 22:31:15.923685244 +0100 --- src/testdir/test_writefile.vim 2022-09-02 21:48:14.558936900 +0100 *************** *** 18,24 **** call assert_equal("vimmers", l[4]) call delete(f) ! call assert_fails('call writefile("text", "Xfile")', 'E475: Invalid argument: writefile() first argument must be a List or a Blob') endfunc func Test_writefile_ignore_regexp_error() --- 18,24 ---- call assert_equal("vimmers", l[4]) call delete(f) ! call assert_fails('call writefile("text", "Xwffile")', 'E475: Invalid argument: writefile() first argument must be a List or a Blob') endfunc func Test_writefile_ignore_regexp_error() *************** *** 27,43 **** endfunc func Test_writefile_fails_gently() ! call assert_fails('call writefile(["test"], "Xfile", [])', 'E730:') ! call assert_false(filereadable("Xfile")) ! call delete("Xfile") ! ! call assert_fails('call writefile(["test", [], [], [], "tset"], "Xfile")', 'E730:') ! call assert_false(filereadable("Xfile")) ! call delete("Xfile") ! ! call assert_fails('call writefile([], "Xfile", [])', 'E730:') ! call assert_false(filereadable("Xfile")) ! call delete("Xfile") call assert_fails('call writefile([], [])', 'E730:') endfunc --- 27,43 ---- endfunc func Test_writefile_fails_gently() ! call assert_fails('call writefile(["test"], "Xwffile", [])', 'E730:') ! call assert_false(filereadable("Xwffile")) ! call delete("Xwffile") ! ! call assert_fails('call writefile(["test", [], [], [], "tset"], "Xwffile")', 'E730:') ! call assert_false(filereadable("Xwffile")) ! call delete("Xwffile") ! ! call assert_fails('call writefile([], "Xwffile", [])', 'E730:') ! call assert_false(filereadable("Xwffile")) ! call delete("Xwffile") call assert_fails('call writefile([], [])', 'E730:') endfunc *************** *** 52,86 **** set nobackup nowritebackup backupdir=. backupskip= new let contents = ["line one", "line two"] ! call writefile(contents, 'Xfile') ! edit Xfile call setline(1, ["first line", "cannot convert \u010b", "third line"]) call assert_fails('write ++enc=cp932', 'E513:') ! call assert_equal(contents, readfile('Xfile')) " With 'backupcopy' set, if there is a conversion error, the backup file is " still created. set backupcopy=yes writebackup& backup& ! call delete('Xfile' .. &backupext) call assert_fails('write ++enc=cp932', 'E513:') ! call assert_equal(contents, readfile('Xfile')) ! call assert_equal(contents, readfile('Xfile' .. &backupext)) set backupcopy& %bw! " Conversion error during write new call setline(1, ["\U10000000"]) ! let output = execute('write! ++enc=utf-16 Xfile') call assert_match('CONVERSION ERROR', output) ! let output = execute('write! ++enc=ucs-2 Xfile') call assert_match('CONVERSION ERROR', output) call delete('Xfilz~') call delete('Xfily~') %bw! ! call delete('Xfile') ! call delete('Xfile' .. &backupext) bwipe! set backup& writebackup& backupdir&vim backupskip&vim endfunc --- 52,86 ---- set nobackup nowritebackup backupdir=. backupskip= new let contents = ["line one", "line two"] ! call writefile(contents, 'Xwfcfile') ! edit Xwfcfile call setline(1, ["first line", "cannot convert \u010b", "third line"]) call assert_fails('write ++enc=cp932', 'E513:') ! call assert_equal(contents, readfile('Xwfcfile')) " With 'backupcopy' set, if there is a conversion error, the backup file is " still created. set backupcopy=yes writebackup& backup& ! call delete('Xwfcfile' .. &backupext) call assert_fails('write ++enc=cp932', 'E513:') ! call assert_equal(contents, readfile('Xwfcfile')) ! call assert_equal(contents, readfile('Xwfcfile' .. &backupext)) set backupcopy& %bw! " Conversion error during write new call setline(1, ["\U10000000"]) ! let output = execute('write! ++enc=utf-16 Xwfcfile') call assert_match('CONVERSION ERROR', output) ! let output = execute('write! ++enc=ucs-2 Xwfcfile') call assert_match('CONVERSION ERROR', output) call delete('Xfilz~') call delete('Xfily~') %bw! ! call delete('Xwfcfile') ! call delete('Xwfcfile' .. &backupext) bwipe! set backup& writebackup& backupdir&vim backupskip&vim endfunc *************** *** 94,109 **** " but then the backup file must remain set nobackup writebackup backupdir=. backupskip= let contents = ["line one", "line two"] ! call writefile(contents, 'Xfile_conversion_err') ! edit Xfile_conversion_err call setline(1, ["first line", "cannot convert \u010b", "third line"]) set fileencoding=latin1 let output = execute('write') call assert_match('CONVERSION ERROR', output) ! call assert_equal(contents, readfile('Xfile_conversion_err~')) ! call delete('Xfile_conversion_err') ! call delete('Xfile_conversion_err~') bwipe! set backup& writebackup& backupdir&vim backupskip&vim endfunc --- 94,109 ---- " but then the backup file must remain set nobackup writebackup backupdir=. backupskip= let contents = ["line one", "line two"] ! call writefile(contents, 'Xwf2file_conversion_err') ! edit Xwf2file_conversion_err call setline(1, ["first line", "cannot convert \u010b", "third line"]) set fileencoding=latin1 let output = execute('write') call assert_match('CONVERSION ERROR', output) ! call assert_equal(contents, readfile('Xwf2file_conversion_err~')) ! call delete('Xwf2file_conversion_err') ! call delete('Xwf2file_conversion_err~') bwipe! set backup& writebackup& backupdir&vim backupskip&vim endfunc *************** *** 117,123 **** augroup testgroup autocmd BufWritePre * split augroup END ! e! Xfile call setline(1, 'nothing') wq --- 117,123 ---- augroup testgroup autocmd BufWritePre * split augroup END ! e! Xwqsfile call setline(1, 'nothing') wq *************** *** 130,142 **** unlet g:flag endif au! testgroup ! bwipe Xfile ! call delete('Xfile') endfunc func Test_nowrite_quit_split() " Prevent exiting by opening a help window. ! e! Xfile help wincmd w exe winnr() . 'q' --- 130,142 ---- unlet g:flag endif au! testgroup ! bwipe Xwqsfile ! call delete('Xwqsfile') endfunc func Test_nowrite_quit_split() " Prevent exiting by opening a help window. ! e! Xnqsfile help wincmd w exe winnr() . 'q' *************** *** 149,155 **** call assert_equal(1, g:flag) unlet g:flag endif ! bwipe Xfile endfunc func Test_writefile_sync_arg() --- 149,155 ---- call assert_equal(1, g:flag) unlet g:flag endif ! bwipe Xnqsfile endfunc func Test_writefile_sync_arg() *************** *** 213,235 **** CheckUnix new call setline(1, ['L1', 'L2', 'L3', 'L4']) ! 2,3w !cat > Xfile ! call assert_equal(['L2', 'L3'], readfile('Xfile')) close! ! call delete('Xfile') endfunc " Test for :saveas func Test_saveas() call assert_fails('saveas', 'E471:') ! call writefile(['L1'], 'Xfile') ! new Xfile new call setline(1, ['L1']) ! call assert_fails('saveas Xfile', 'E139:') close! enew | only ! call delete('Xfile') " :saveas should detect and set the file type. syntax on --- 213,235 ---- CheckUnix new call setline(1, ['L1', 'L2', 'L3', 'L4']) ! 2,3w !cat > Xptfile ! call assert_equal(['L2', 'L3'], readfile('Xptfile')) close! ! call delete('Xptfile') endfunc " Test for :saveas func Test_saveas() call assert_fails('saveas', 'E471:') ! call writefile(['L1'], 'Xsafile') ! new Xsafile new call setline(1, ['L1']) ! call assert_fails('saveas Xsafile', 'E139:') close! enew | only ! call delete('Xsafile') " :saveas should detect and set the file type. syntax on *************** *** 242,249 **** func Test_write_errors() " Test for writing partial buffer ! call writefile(['L1', 'L2', 'L3'], 'Xfile') ! new Xfile call assert_fails('1,2write', 'E140:') close! --- 242,249 ---- func Test_write_errors() " Test for writing partial buffer ! call writefile(['L1', 'L2', 'L3'], 'Xwefile') ! new Xwefile call assert_fails('1,2write', 'E140:') close! *************** *** 263,286 **** enew! " Test for writing a 'readonly' file ! new Xfile set readonly call assert_fails('write', 'E45:') close " Test for writing to a read-only file ! new Xfile ! call setfperm('Xfile', 'r--r--r--') call assert_fails('write', 'E505:') ! call setfperm('Xfile', 'rw-rw-rw-') close ! call delete('Xfile') ! call writefile(test_null_list(), 'Xfile') ! call assert_false(filereadable('Xfile')) ! call writefile(test_null_blob(), 'Xfile') ! call assert_false(filereadable('Xfile')) call assert_fails('call writefile([], "")', 'E482:') " very long file name --- 263,286 ---- enew! " Test for writing a 'readonly' file ! new Xwefile set readonly call assert_fails('write', 'E45:') close " Test for writing to a read-only file ! new Xwefile ! call setfperm('Xwefile', 'r--r--r--') call assert_fails('write', 'E505:') ! call setfperm('Xwefile', 'rw-rw-rw-') close ! call delete('Xwefile') ! call writefile(test_null_list(), 'Xwefile') ! call assert_false(filereadable('Xwefile')) ! call writefile(test_null_blob(), 'Xwefile') ! call assert_false(filereadable('Xwefile')) call assert_fails('call writefile([], "")', 'E482:') " very long file name *************** *** 305,313 **** CheckRunVimInTerminal " First read the file into a buffer ! call writefile(["Line1", "Line2"], 'Xfile') ! let old_ftime = getftime('Xfile') ! let buf = RunVimInTerminal('Xfile', #{rows : 10}) call TermWait(buf) call term_sendkeys(buf, ":set noswapfile\") call TermWait(buf) --- 305,313 ---- CheckRunVimInTerminal " First read the file into a buffer ! call writefile(["Line1", "Line2"], 'Xwfmfile') ! let old_ftime = getftime('Xwfmfile') ! let buf = RunVimInTerminal('Xwfmfile', #{rows : 10}) call TermWait(buf) call term_sendkeys(buf, ":set noswapfile\") call TermWait(buf) *************** *** 316,327 **** " different. Note that on Linux/Unix, the file is considered modified " outside, only if the difference is 2 seconds or more sleep 1 ! call writefile(["Line3", "Line4"], 'Xfile') ! let new_ftime = getftime('Xfile') while new_ftime - old_ftime < 2 sleep 100m ! call writefile(["Line3", "Line4"], 'Xfile') ! let new_ftime = getftime('Xfile') endwhile " Try to overwrite the file and check for the prompt --- 316,327 ---- " different. Note that on Linux/Unix, the file is considered modified " outside, only if the difference is 2 seconds or more sleep 1 ! call writefile(["Line3", "Line4"], 'Xwfmfile') ! let new_ftime = getftime('Xwfmfile') while new_ftime - old_ftime < 2 sleep 100m ! call writefile(["Line3", "Line4"], 'Xwfmfile') ! let new_ftime = getftime('Xwfmfile') endwhile " Try to overwrite the file and check for the prompt *************** *** 332,355 **** \ term_getline(buf, 10)) call term_sendkeys(buf, "n\") call TermWait(buf) ! call assert_equal(new_ftime, getftime('Xfile')) call term_sendkeys(buf, ":w\") call TermWait(buf) call term_sendkeys(buf, "y\") call TermWait(buf) ! call WaitForAssert({-> assert_equal('Line2', readfile('Xfile')[1])}) " clean up call StopVimInTerminal(buf) ! call delete('Xfile') endfunc " Test for an autocmd unloading a buffer during a write command func Test_write_autocmd_unloadbuf_lockmark() augroup WriteTest ! autocmd BufWritePre Xfile enew | write augroup END ! e Xfile call assert_fails('lockmarks write', ['E32:', 'E203:']) augroup WriteTest au! --- 332,355 ---- \ term_getline(buf, 10)) call term_sendkeys(buf, "n\") call TermWait(buf) ! call assert_equal(new_ftime, getftime('Xwfmfile')) call term_sendkeys(buf, ":w\") call TermWait(buf) call term_sendkeys(buf, "y\") call TermWait(buf) ! call WaitForAssert({-> assert_equal('Line2', readfile('Xwfmfile')[1])}) " clean up call StopVimInTerminal(buf) ! call delete('Xwfmfile') endfunc " Test for an autocmd unloading a buffer during a write command func Test_write_autocmd_unloadbuf_lockmark() augroup WriteTest ! autocmd BufWritePre Xwaufile enew | write augroup END ! e Xwaufile call assert_fails('lockmarks write', ['E32:', 'E203:']) augroup WriteTest au! *************** *** 359,365 **** " Test for writing a buffer with 'acwrite' but without autocmds func Test_write_acwrite_error() ! new Xfile call setline(1, ['line1', 'line2', 'line3']) set buftype=acwrite call assert_fails('write', 'E676:') --- 359,365 ---- " Test for writing a buffer with 'acwrite' but without autocmds func Test_write_acwrite_error() ! new Xwaefile call setline(1, ['line1', 'line2', 'line3']) set buftype=acwrite call assert_fails('write', 'E676:') *************** *** 370,404 **** " Test for adding and removing lines from an autocmd when writing a buffer func Test_write_autocmd_add_remove_lines() ! new Xfile call setline(1, ['aaa', 'bbb', 'ccc', 'ddd']) " Autocmd deleting lines from the file when writing a partial file augroup WriteTest2 au! ! autocmd FileWritePre Xfile 1,2d augroup END call assert_fails('2,3w!', 'E204:') " Autocmd adding lines to a file when writing a partial file augroup WriteTest2 au! ! autocmd FileWritePre Xfile call append(0, ['xxx', 'yyy']) augroup END %d call setline(1, ['aaa', 'bbb', 'ccc', 'ddd']) 1,2w! ! call assert_equal(['xxx', 'yyy', 'aaa', 'bbb'], readfile('Xfile')) " Autocmd deleting lines from the file when writing the whole file augroup WriteTest2 au! ! autocmd BufWritePre Xfile 1,2d augroup END %d call setline(1, ['aaa', 'bbb', 'ccc', 'ddd']) w ! call assert_equal(['ccc', 'ddd'], readfile('Xfile')) augroup WriteTest2 au! --- 370,404 ---- " Test for adding and removing lines from an autocmd when writing a buffer func Test_write_autocmd_add_remove_lines() ! new Xwaafile call setline(1, ['aaa', 'bbb', 'ccc', 'ddd']) " Autocmd deleting lines from the file when writing a partial file augroup WriteTest2 au! ! autocmd FileWritePre Xwaafile 1,2d augroup END call assert_fails('2,3w!', 'E204:') " Autocmd adding lines to a file when writing a partial file augroup WriteTest2 au! ! autocmd FileWritePre Xwaafile call append(0, ['xxx', 'yyy']) augroup END %d call setline(1, ['aaa', 'bbb', 'ccc', 'ddd']) 1,2w! ! call assert_equal(['xxx', 'yyy', 'aaa', 'bbb'], readfile('Xwaafile')) " Autocmd deleting lines from the file when writing the whole file augroup WriteTest2 au! ! autocmd BufWritePre Xwaafile 1,2d augroup END %d call setline(1, ['aaa', 'bbb', 'ccc', 'ddd']) w ! call assert_equal(['ccc', 'ddd'], readfile('Xwaafile')) augroup WriteTest2 au! *************** *** 406,419 **** augroup! WriteTest2 close! ! call delete('Xfile') endfunc " Test for writing to a readonly file func Test_write_readonly() ! call writefile([], 'Xfile') ! call setfperm('Xfile', "r--------") ! edit Xfile set noreadonly backupskip= call assert_fails('write', 'E505:') let save_cpo = &cpo --- 406,419 ---- augroup! WriteTest2 close! ! call delete('Xwaafile') endfunc " Test for writing to a readonly file func Test_write_readonly() ! call writefile([], 'Xwrofile') ! call setfperm('Xwrofile', "r--------") ! edit Xwrofile set noreadonly backupskip= call assert_fails('write', 'E505:') let save_cpo = &cpo *************** *** 422,432 **** let &cpo = save_cpo call setline(1, ['line1']) write! ! call assert_equal(['line1'], readfile('Xfile')) " Auto-saving a readonly file should fail with 'autowriteall' %bw! ! e Xfile set noreadonly autowriteall call setline(1, ['aaaa']) call assert_fails('n', 'E505:') --- 422,432 ---- let &cpo = save_cpo call setline(1, ['line1']) write! ! call assert_equal(['line1'], readfile('Xwrofile')) " Auto-saving a readonly file should fail with 'autowriteall' %bw! ! e Xwrofile set noreadonly autowriteall call setline(1, ['aaaa']) call assert_fails('n', 'E505:') *************** *** 436,474 **** set autowriteall& set backupskip& ! call delete('Xfile') %bw! endfunc " Test for 'patchmode' func Test_patchmode() ! call writefile(['one'], 'Xfile') set patchmode=.orig nobackup backupskip= writebackup ! new Xfile call setline(1, 'two') " first write should create the .orig file write ! call assert_equal(['one'], readfile('Xfile.orig')) call setline(1, 'three') " subsequent writes should not create/modify the .orig file write ! call assert_equal(['one'], readfile('Xfile.orig')) " use 'patchmode' with 'nobackup' and 'nowritebackup' to create an empty " original file ! call delete('Xfile') ! call delete('Xfile.orig') %bw! set patchmode=.orig nobackup nowritebackup ! edit Xfile call setline(1, ['xxx']) write ! call assert_equal(['xxx'], readfile('Xfile')) ! call assert_equal([], readfile('Xfile.orig')) set patchmode& backup& backupskip& writebackup& ! call delete('Xfile') ! call delete('Xfile.orig') endfunc " Test for writing to a file in a readonly directory --- 436,474 ---- set autowriteall& set backupskip& ! call delete('Xwrofile') %bw! endfunc " Test for 'patchmode' func Test_patchmode() ! call writefile(['one'], 'Xpafile') set patchmode=.orig nobackup backupskip= writebackup ! new Xpafile call setline(1, 'two') " first write should create the .orig file write ! call assert_equal(['one'], readfile('Xpafile.orig')) call setline(1, 'three') " subsequent writes should not create/modify the .orig file write ! call assert_equal(['one'], readfile('Xpafile.orig')) " use 'patchmode' with 'nobackup' and 'nowritebackup' to create an empty " original file ! call delete('Xpafile') ! call delete('Xpafile.orig') %bw! set patchmode=.orig nobackup nowritebackup ! edit Xpafile call setline(1, ['xxx']) write ! call assert_equal(['xxx'], readfile('Xpafile')) ! call assert_equal([], readfile('Xpafile.orig')) set patchmode& backup& backupskip& writebackup& ! call delete('Xpafile') ! call delete('Xpafile.orig') endfunc " Test for writing to a file in a readonly directory *************** *** 500,506 **** func Test_write_invalid_encoding() new call setline(1, 'abc') ! call assert_fails('write ++enc=axbyc Xfile', 'E213:') close! endfunc --- 500,506 ---- func Test_write_invalid_encoding() new call setline(1, 'abc') ! call assert_fails('write ++enc=axbyc Xiefile', 'E213:') close! endfunc *************** *** 515,615 **** 2 cp1251 text: Äëÿ Vim version 6.2. Ïîñëåäíåå èçìåíåíèå: 1970 Jan 01 3 cp866 text: „«ï Vim version 6.2. ®á«¥¤­¥¥ ¨§¬¥­¥­¨¥: 1970 Jan 01 END ! call writefile(text, 'Xfile') ! edit Xfile " write tests: " combine three values for 'encoding' with three values for 'fileencoding' " also write files for read tests call cursor(1, 1) set encoding=utf-8 ! .w! ++enc=utf-8 Xtest ! .w ++enc=cp1251 >> Xtest ! .w ++enc=cp866 >> Xtest .w! ++enc=utf-8 Xutf8 let expected =<< trim END 1 utf-8 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01 1 utf-8 text: Äëÿ Vim version 6.2. Ïîñëåäíåå èçìåíåíèå: 1970 Jan 01 1 utf-8 text: „«ï Vim version 6.2. ®á«¥¤­¥¥ ¨§¬¥­¥­¨¥: 1970 Jan 01 END ! call assert_equal(expected, readfile('Xtest')) call cursor(2, 1) set encoding=cp1251 ! .w! ++enc=utf-8 Xtest ! .w ++enc=cp1251 >> Xtest ! .w ++enc=cp866 >> Xtest .w! ++enc=cp1251 Xcp1251 let expected =<< trim END 2 cp1251 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01 2 cp1251 text: Äëÿ Vim version 6.2. Ïîñëåäíåå èçìåíåíèå: 1970 Jan 01 2 cp1251 text: „«ï Vim version 6.2. ®á«¥¤­¥¥ ¨§¬¥­¥­¨¥: 1970 Jan 01 END ! call assert_equal(expected, readfile('Xtest')) call cursor(3, 1) set encoding=cp866 ! .w! ++enc=utf-8 Xtest ! .w ++enc=cp1251 >> Xtest ! .w ++enc=cp866 >> Xtest .w! ++enc=cp866 Xcp866 let expected =<< trim END 3 cp866 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01 3 cp866 text: Äëÿ Vim version 6.2. Ïîñëåäíåå èçìåíåíèå: 1970 Jan 01 3 cp866 text: „«ï Vim version 6.2. ®á«¥¤­¥¥ ¨§¬¥­¥­¨¥: 1970 Jan 01 END ! call assert_equal(expected, readfile('Xtest')) " read three 'fileencoding's with utf-8 'encoding' set encoding=utf-8 fencs=utf-8,cp1251 e Xutf8 ! .w! ++enc=utf-8 Xtest e Xcp1251 ! .w ++enc=utf-8 >> Xtest set fencs=utf-8,cp866 e Xcp866 ! .w ++enc=utf-8 >> Xtest let expected =<< trim END 1 utf-8 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01 2 cp1251 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01 3 cp866 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01 END ! call assert_equal(expected, readfile('Xtest')) " read three 'fileencoding's with cp1251 'encoding' set encoding=utf-8 fencs=utf-8,cp1251 e Xutf8 ! .w! ++enc=cp1251 Xtest e Xcp1251 ! .w ++enc=cp1251 >> Xtest set fencs=utf-8,cp866 e Xcp866 ! .w ++enc=cp1251 >> Xtest let expected =<< trim END 1 utf-8 text: Äëÿ Vim version 6.2. Ïîñëåäíåå èçìåíåíèå: 1970 Jan 01 2 cp1251 text: Äëÿ Vim version 6.2. Ïîñëåäíåå èçìåíåíèå: 1970 Jan 01 3 cp866 text: Äëÿ Vim version 6.2. Ïîñëåäíåå èçìåíåíèå: 1970 Jan 01 END ! call assert_equal(expected, readfile('Xtest')) " read three 'fileencoding's with cp866 'encoding' set encoding=cp866 fencs=utf-8,cp1251 e Xutf8 ! .w! ++enc=cp866 Xtest e Xcp1251 ! .w ++enc=cp866 >> Xtest set fencs=utf-8,cp866 e Xcp866 ! .w ++enc=cp866 >> Xtest let expected =<< trim END 1 utf-8 text: „«ï Vim version 6.2. ®á«¥¤­¥¥ ¨§¬¥­¥­¨¥: 1970 Jan 01 2 cp1251 text: „«ï Vim version 6.2. ®á«¥¤­¥¥ ¨§¬¥­¥­¨¥: 1970 Jan 01 3 cp866 text: „«ï Vim version 6.2. ®á«¥¤­¥¥ ¨§¬¥­¥­¨¥: 1970 Jan 01 END ! call assert_equal(expected, readfile('Xtest')) ! call delete('Xfile') ! call delete('Xtest') call delete('Xutf8') call delete('Xcp1251') call delete('Xcp866') --- 515,615 ---- 2 cp1251 text: Äëÿ Vim version 6.2. Ïîñëåäíåå èçìåíåíèå: 1970 Jan 01 3 cp866 text: „«ï Vim version 6.2. ®á«¥¤­¥¥ ¨§¬¥­¥­¨¥: 1970 Jan 01 END ! call writefile(text, 'Xwfefile') ! edit Xwfefile " write tests: " combine three values for 'encoding' with three values for 'fileencoding' " also write files for read tests call cursor(1, 1) set encoding=utf-8 ! .w! ++enc=utf-8 Xwfetest ! .w ++enc=cp1251 >> Xwfetest ! .w ++enc=cp866 >> Xwfetest .w! ++enc=utf-8 Xutf8 let expected =<< trim END 1 utf-8 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01 1 utf-8 text: Äëÿ Vim version 6.2. Ïîñëåäíåå èçìåíåíèå: 1970 Jan 01 1 utf-8 text: „«ï Vim version 6.2. ®á«¥¤­¥¥ ¨§¬¥­¥­¨¥: 1970 Jan 01 END ! call assert_equal(expected, readfile('Xwfetest')) call cursor(2, 1) set encoding=cp1251 ! .w! ++enc=utf-8 Xwfetest ! .w ++enc=cp1251 >> Xwfetest ! .w ++enc=cp866 >> Xwfetest .w! ++enc=cp1251 Xcp1251 let expected =<< trim END 2 cp1251 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01 2 cp1251 text: Äëÿ Vim version 6.2. Ïîñëåäíåå èçìåíåíèå: 1970 Jan 01 2 cp1251 text: „«ï Vim version 6.2. ®á«¥¤­¥¥ ¨§¬¥­¥­¨¥: 1970 Jan 01 END ! call assert_equal(expected, readfile('Xwfetest')) call cursor(3, 1) set encoding=cp866 ! .w! ++enc=utf-8 Xwfetest ! .w ++enc=cp1251 >> Xwfetest ! .w ++enc=cp866 >> Xwfetest .w! ++enc=cp866 Xcp866 let expected =<< trim END 3 cp866 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01 3 cp866 text: Äëÿ Vim version 6.2. Ïîñëåäíåå èçìåíåíèå: 1970 Jan 01 3 cp866 text: „«ï Vim version 6.2. ®á«¥¤­¥¥ ¨§¬¥­¥­¨¥: 1970 Jan 01 END ! call assert_equal(expected, readfile('Xwfetest')) " read three 'fileencoding's with utf-8 'encoding' set encoding=utf-8 fencs=utf-8,cp1251 e Xutf8 ! .w! ++enc=utf-8 Xwfetest e Xcp1251 ! .w ++enc=utf-8 >> Xwfetest set fencs=utf-8,cp866 e Xcp866 ! .w ++enc=utf-8 >> Xwfetest let expected =<< trim END 1 utf-8 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01 2 cp1251 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01 3 cp866 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01 END ! call assert_equal(expected, readfile('Xwfetest')) " read three 'fileencoding's with cp1251 'encoding' set encoding=utf-8 fencs=utf-8,cp1251 e Xutf8 ! .w! ++enc=cp1251 Xwfetest e Xcp1251 ! .w ++enc=cp1251 >> Xwfetest set fencs=utf-8,cp866 e Xcp866 ! .w ++enc=cp1251 >> Xwfetest let expected =<< trim END 1 utf-8 text: Äëÿ Vim version 6.2. Ïîñëåäíåå èçìåíåíèå: 1970 Jan 01 2 cp1251 text: Äëÿ Vim version 6.2. Ïîñëåäíåå èçìåíåíèå: 1970 Jan 01 3 cp866 text: Äëÿ Vim version 6.2. Ïîñëåäíåå èçìåíåíèå: 1970 Jan 01 END ! call assert_equal(expected, readfile('Xwfetest')) " read three 'fileencoding's with cp866 'encoding' set encoding=cp866 fencs=utf-8,cp1251 e Xutf8 ! .w! ++enc=cp866 Xwfetest e Xcp1251 ! .w ++enc=cp866 >> Xwfetest set fencs=utf-8,cp866 e Xcp866 ! .w ++enc=cp866 >> Xwfetest let expected =<< trim END 1 utf-8 text: „«ï Vim version 6.2. ®á«¥¤­¥¥ ¨§¬¥­¥­¨¥: 1970 Jan 01 2 cp1251 text: „«ï Vim version 6.2. ®á«¥¤­¥¥ ¨§¬¥­¥­¨¥: 1970 Jan 01 3 cp866 text: „«ï Vim version 6.2. ®á«¥¤­¥¥ ¨§¬¥­¥­¨¥: 1970 Jan 01 END ! call assert_equal(expected, readfile('Xwfetest')) ! call delete('Xwfefile') ! call delete('Xwfetest') call delete('Xutf8') call delete('Xcp1251') call delete('Xcp866') *************** *** 635,748 **** set cpoptions+=S " Check that editing a latin1 file doesn't see a BOM ! call writefile(["\xFE\xFElatin-1"], 'Xtest1') ! edit Xtest1 call assert_equal('latin1', &fileencoding) call assert_equal(0, &bomb) set fenc=latin1 ! write Xfile2 ! call assert_equal(["\xFE\xFElatin-1", ''], readfile('Xfile2', 'b')) set bomb fenc=latin1 ! write Xtest3 ! call assert_equal(["\xFE\xFElatin-1", ''], readfile('Xtest3', 'b')) set bomb& " Check utf-8 BOM %bw! ! call writefile([utf8_bom .. "utf-8"], 'Xtest1') ! edit! Xtest1 call assert_equal('utf-8', &fileencoding) call assert_equal(1, &bomb) call assert_equal('utf-8', getline(1)) set fenc=latin1 ! write! Xfile2 ! call assert_equal(['utf-8', ''], readfile('Xfile2', 'b')) set fenc=utf-8 ! w! Xtest3 ! call assert_equal([utf8_bom .. "utf-8", ''], readfile('Xtest3', 'b')) " Check utf-8 with an error (will fall back to latin-1) %bw! ! call writefile([utf8_bom .. "utf-8\x80err"], 'Xtest1') ! edit! Xtest1 call assert_equal('latin1', &fileencoding) call assert_equal(0, &bomb) call assert_equal("\xC3\xAF\xC2\xBB\xC2\xBFutf-8\xC2\x80err", getline(1)) set fenc=latin1 ! write! Xfile2 ! call assert_equal([utf8_bom .. "utf-8\x80err", ''], readfile('Xfile2', 'b')) set fenc=utf-8 ! w! Xtest3 call assert_equal(["\xC3\xAF\xC2\xBB\xC2\xBFutf-8\xC2\x80err", ''], ! \ readfile('Xtest3', 'b')) " Check ucs-2 BOM %bw! ! call writefile([utf16be_bom .. "\nu\nc\ns\n-\n2\n"], 'Xtest1') ! edit! Xtest1 call assert_equal('utf-16', &fileencoding) call assert_equal(1, &bomb) call assert_equal('ucs-2', getline(1)) set fenc=latin1 ! write! Xfile2 ! call assert_equal(["ucs-2", ''], readfile('Xfile2', 'b')) set fenc=ucs-2 ! w! Xtest3 call assert_equal([utf16be_bom .. "\nu\nc\ns\n-\n2\n", ''], ! \ readfile('Xtest3', 'b')) " Check ucs-2le BOM %bw! ! call writefile([utf16le_bom .. "u\nc\ns\n-\n2\nl\ne\n"], 'Xtest1') " Need to add a NUL byte after the NL byte ! call writefile(0z00, 'Xtest1', 'a') ! edit! Xtest1 call assert_equal('utf-16le', &fileencoding) call assert_equal(1, &bomb) call assert_equal('ucs-2le', getline(1)) set fenc=latin1 ! write! Xfile2 ! call assert_equal(["ucs-2le", ''], readfile('Xfile2', 'b')) set fenc=ucs-2le ! w! Xtest3 call assert_equal([utf16le_bom .. "u\nc\ns\n-\n2\nl\ne\n", "\n"], ! \ readfile('Xtest3', 'b')) " Check ucs-4 BOM %bw! ! call writefile([utf32be_bom .. "\n\n\nu\n\n\nc\n\n\ns\n\n\n-\n\n\n4\n\n\n"], 'Xtest1') ! edit! Xtest1 call assert_equal('ucs-4', &fileencoding) call assert_equal(1, &bomb) call assert_equal('ucs-4', getline(1)) set fenc=latin1 ! write! Xfile2 ! call assert_equal(["ucs-4", ''], readfile('Xfile2', 'b')) set fenc=ucs-4 ! w! Xtest3 ! call assert_equal([utf32be_bom .. "\n\n\nu\n\n\nc\n\n\ns\n\n\n-\n\n\n4\n\n\n", ''], readfile('Xtest3', 'b')) " Check ucs-4le BOM %bw! ! call writefile([utf32le_bom .. "u\n\n\nc\n\n\ns\n\n\n-\n\n\n4\n\n\nl\n\n\ne\n\n\n"], 'Xtest1') " Need to add three NUL bytes after the NL byte ! call writefile(0z000000, 'Xtest1', 'a') ! edit! Xtest1 call assert_equal('ucs-4le', &fileencoding) call assert_equal(1, &bomb) call assert_equal('ucs-4le', getline(1)) set fenc=latin1 ! write! Xfile2 ! call assert_equal(["ucs-4le", ''], readfile('Xfile2', 'b')) set fenc=ucs-4le ! w! Xtest3 ! call assert_equal([utf32le_bom .. "u\n\n\nc\n\n\ns\n\n\n-\n\n\n4\n\n\nl\n\n\ne\n\n\n", "\n\n\n"], readfile('Xtest3', 'b')) set cpoptions-=S let &fileencoding = save_fileencoding ! call delete('Xtest1') ! call delete('Xfile2') ! call delete('Xtest3') %bw! endfunc --- 635,748 ---- set cpoptions+=S " Check that editing a latin1 file doesn't see a BOM ! call writefile(["\xFE\xFElatin-1"], 'Xrwtest1') ! edit Xrwtest1 call assert_equal('latin1', &fileencoding) call assert_equal(0, &bomb) set fenc=latin1 ! write Xrwfile2 ! call assert_equal(["\xFE\xFElatin-1", ''], readfile('Xrwfile2', 'b')) set bomb fenc=latin1 ! write Xrwtest3 ! call assert_equal(["\xFE\xFElatin-1", ''], readfile('Xrwtest3', 'b')) set bomb& " Check utf-8 BOM %bw! ! call writefile([utf8_bom .. "utf-8"], 'Xrwtest1') ! edit! Xrwtest1 call assert_equal('utf-8', &fileencoding) call assert_equal(1, &bomb) call assert_equal('utf-8', getline(1)) set fenc=latin1 ! write! Xrwfile2 ! call assert_equal(['utf-8', ''], readfile('Xrwfile2', 'b')) set fenc=utf-8 ! w! Xrwtest3 ! call assert_equal([utf8_bom .. "utf-8", ''], readfile('Xrwtest3', 'b')) " Check utf-8 with an error (will fall back to latin-1) %bw! ! call writefile([utf8_bom .. "utf-8\x80err"], 'Xrwtest1') ! edit! Xrwtest1 call assert_equal('latin1', &fileencoding) call assert_equal(0, &bomb) call assert_equal("\xC3\xAF\xC2\xBB\xC2\xBFutf-8\xC2\x80err", getline(1)) set fenc=latin1 ! write! Xrwfile2 ! call assert_equal([utf8_bom .. "utf-8\x80err", ''], readfile('Xrwfile2', 'b')) set fenc=utf-8 ! w! Xrwtest3 call assert_equal(["\xC3\xAF\xC2\xBB\xC2\xBFutf-8\xC2\x80err", ''], ! \ readfile('Xrwtest3', 'b')) " Check ucs-2 BOM %bw! ! call writefile([utf16be_bom .. "\nu\nc\ns\n-\n2\n"], 'Xrwtest1') ! edit! Xrwtest1 call assert_equal('utf-16', &fileencoding) call assert_equal(1, &bomb) call assert_equal('ucs-2', getline(1)) set fenc=latin1 ! write! Xrwfile2 ! call assert_equal(["ucs-2", ''], readfile('Xrwfile2', 'b')) set fenc=ucs-2 ! w! Xrwtest3 call assert_equal([utf16be_bom .. "\nu\nc\ns\n-\n2\n", ''], ! \ readfile('Xrwtest3', 'b')) " Check ucs-2le BOM %bw! ! call writefile([utf16le_bom .. "u\nc\ns\n-\n2\nl\ne\n"], 'Xrwtest1') " Need to add a NUL byte after the NL byte ! call writefile(0z00, 'Xrwtest1', 'a') ! edit! Xrwtest1 call assert_equal('utf-16le', &fileencoding) call assert_equal(1, &bomb) call assert_equal('ucs-2le', getline(1)) set fenc=latin1 ! write! Xrwfile2 ! call assert_equal(["ucs-2le", ''], readfile('Xrwfile2', 'b')) set fenc=ucs-2le ! w! Xrwtest3 call assert_equal([utf16le_bom .. "u\nc\ns\n-\n2\nl\ne\n", "\n"], ! \ readfile('Xrwtest3', 'b')) " Check ucs-4 BOM %bw! ! call writefile([utf32be_bom .. "\n\n\nu\n\n\nc\n\n\ns\n\n\n-\n\n\n4\n\n\n"], 'Xrwtest1') ! edit! Xrwtest1 call assert_equal('ucs-4', &fileencoding) call assert_equal(1, &bomb) call assert_equal('ucs-4', getline(1)) set fenc=latin1 ! write! Xrwfile2 ! call assert_equal(["ucs-4", ''], readfile('Xrwfile2', 'b')) set fenc=ucs-4 ! w! Xrwtest3 ! call assert_equal([utf32be_bom .. "\n\n\nu\n\n\nc\n\n\ns\n\n\n-\n\n\n4\n\n\n", ''], readfile('Xrwtest3', 'b')) " Check ucs-4le BOM %bw! ! call writefile([utf32le_bom .. "u\n\n\nc\n\n\ns\n\n\n-\n\n\n4\n\n\nl\n\n\ne\n\n\n"], 'Xrwtest1') " Need to add three NUL bytes after the NL byte ! call writefile(0z000000, 'Xrwtest1', 'a') ! edit! Xrwtest1 call assert_equal('ucs-4le', &fileencoding) call assert_equal(1, &bomb) call assert_equal('ucs-4le', getline(1)) set fenc=latin1 ! write! Xrwfile2 ! call assert_equal(["ucs-4le", ''], readfile('Xrwfile2', 'b')) set fenc=ucs-4le ! w! Xrwtest3 ! call assert_equal([utf32le_bom .. "u\n\n\nc\n\n\ns\n\n\n-\n\n\n4\n\n\nl\n\n\ne\n\n\n", "\n\n\n"], readfile('Xrwtest3', 'b')) set cpoptions-=S let &fileencoding = save_fileencoding ! call delete('Xrwtest1') ! call delete('Xrwfile2') ! call delete('Xrwtest3') %bw! endfunc *************** *** 773,855 **** " With the default 'backupcopy' setting, saving a symbolic link file " should not break the link. set backupcopy& ! call writefile(['1111'], 'Xfile1') ! silent !ln -s Xfile1 Xfile2 ! new Xfile2 call setline(1, ['2222']) write close ! call assert_equal(['2222'], readfile('Xfile1')) ! call assert_equal('Xfile1', resolve('Xfile2')) ! call assert_equal('link', getftype('Xfile2')) ! call delete('Xfile1') ! call delete('Xfile2') " With the 'backupcopy' set to 'breaksymlink', saving a symbolic link file " should break the link. set backupcopy=yes,breaksymlink ! call writefile(['1111'], 'Xfile1') ! silent !ln -s Xfile1 Xfile2 ! new Xfile2 call setline(1, ['2222']) write close ! call assert_equal(['1111'], readfile('Xfile1')) ! call assert_equal(['2222'], readfile('Xfile2')) ! call assert_equal('Xfile2', resolve('Xfile2')) ! call assert_equal('file', getftype('Xfile2')) ! call delete('Xfile1') ! call delete('Xfile2') set backupcopy& " With the default 'backupcopy' setting, saving a hard link file " should not break the link. set backupcopy& ! call writefile(['1111'], 'Xfile1') ! silent !ln Xfile1 Xfile2 ! new Xfile2 call setline(1, ['2222']) write close ! call assert_equal(['2222'], readfile('Xfile1')) ! call delete('Xfile1') ! call delete('Xfile2') " With the 'backupcopy' set to 'breaksymlink', saving a hard link file " should break the link. set backupcopy=yes,breakhardlink ! call writefile(['1111'], 'Xfile1') ! silent !ln Xfile1 Xfile2 ! new Xfile2 call setline(1, ['2222']) write ! call assert_equal(['1111'], readfile('Xfile1')) ! call assert_equal(['2222'], readfile('Xfile2')) ! call delete('Xfile1') ! call delete('Xfile2') " If a backup file is already present, then a slightly modified filename " should be used as the backup file. Try with 'backupcopy' set to 'yes' and " 'no'. %bw ! call writefile(['aaaa'], 'Xfile') ! call writefile(['bbbb'], 'Xfile.bak') set backupcopy=yes backupext=.bak ! new Xfile call setline(1, ['cccc']) write close ! call assert_equal(['cccc'], readfile('Xfile')) ! call assert_equal(['bbbb'], readfile('Xfile.bak')) set backupcopy=no backupext=.bak ! new Xfile call setline(1, ['dddd']) write close ! call assert_equal(['dddd'], readfile('Xfile')) ! call assert_equal(['bbbb'], readfile('Xfile.bak')) ! call delete('Xfile') ! call delete('Xfile.bak') " Write to a device file (in Unix-like systems) which cannot be backed up. if has('unix') --- 773,855 ---- " With the default 'backupcopy' setting, saving a symbolic link file " should not break the link. set backupcopy& ! call writefile(['1111'], 'Xbcfile1') ! silent !ln -s Xbcfile1 Xbcfile2 ! new Xbcfile2 call setline(1, ['2222']) write close ! call assert_equal(['2222'], readfile('Xbcfile1')) ! call assert_equal('Xbcfile1', resolve('Xbcfile2')) ! call assert_equal('link', getftype('Xbcfile2')) ! call delete('Xbcfile1') ! call delete('Xbcfile2') " With the 'backupcopy' set to 'breaksymlink', saving a symbolic link file " should break the link. set backupcopy=yes,breaksymlink ! call writefile(['1111'], 'Xbcfile1') ! silent !ln -s Xbcfile1 Xbcfile2 ! new Xbcfile2 call setline(1, ['2222']) write close ! call assert_equal(['1111'], readfile('Xbcfile1')) ! call assert_equal(['2222'], readfile('Xbcfile2')) ! call assert_equal('Xbcfile2', resolve('Xbcfile2')) ! call assert_equal('file', getftype('Xbcfile2')) ! call delete('Xbcfile1') ! call delete('Xbcfile2') set backupcopy& " With the default 'backupcopy' setting, saving a hard link file " should not break the link. set backupcopy& ! call writefile(['1111'], 'Xbcfile1') ! silent !ln Xbcfile1 Xbcfile2 ! new Xbcfile2 call setline(1, ['2222']) write close ! call assert_equal(['2222'], readfile('Xbcfile1')) ! call delete('Xbcfile1') ! call delete('Xbcfile2') " With the 'backupcopy' set to 'breaksymlink', saving a hard link file " should break the link. set backupcopy=yes,breakhardlink ! call writefile(['1111'], 'Xbcfile1') ! silent !ln Xbcfile1 Xbcfile2 ! new Xbcfile2 call setline(1, ['2222']) write ! call assert_equal(['1111'], readfile('Xbcfile1')) ! call assert_equal(['2222'], readfile('Xbcfile2')) ! call delete('Xbcfile1') ! call delete('Xbcfile2') " If a backup file is already present, then a slightly modified filename " should be used as the backup file. Try with 'backupcopy' set to 'yes' and " 'no'. %bw ! call writefile(['aaaa'], 'Xbcfile') ! call writefile(['bbbb'], 'Xbcfile.bak') set backupcopy=yes backupext=.bak ! new Xbcfile call setline(1, ['cccc']) write close ! call assert_equal(['cccc'], readfile('Xbcfile')) ! call assert_equal(['bbbb'], readfile('Xbcfile.bak')) set backupcopy=no backupext=.bak ! new Xbcfile call setline(1, ['dddd']) write close ! call assert_equal(['dddd'], readfile('Xbcfile')) ! call assert_equal(['bbbb'], readfile('Xbcfile.bak')) ! call delete('Xbcfile') ! call delete('Xbcfile.bak') " Write to a device file (in Unix-like systems) which cannot be backed up. if has('unix') *************** *** 880,889 **** func Test_write_utf16() new call setline(1, ["\U00010001"]) ! write ++enc=utf-16 Xfile bw! ! call assert_equal(0zD800DC01, readfile('Xfile', 'B')[0:3]) ! call delete('Xfile') endfunc " Test for trying to save a backup file when the backup file is a symbolic --- 880,889 ---- func Test_write_utf16() new call setline(1, ["\U00010001"]) ! write ++enc=utf-16 Xw16file bw! ! call assert_equal(0zD800DC01, readfile('Xw16file', 'B')[0:3]) ! call delete('Xw16file') endfunc " Test for trying to save a backup file when the backup file is a symbolic *************** *** 893,916 **** call mkdir('Xbackup') let save_backupdir = &backupdir set backupdir=.,./Xbackup ! call writefile(['1111'], 'Xfile') ! silent !ln -s Xfile Xfile.bak ! new Xfile set backup backupcopy=yes backupext=.bak write ! call assert_equal('link', getftype('Xfile.bak')) ! call assert_equal('Xfile', resolve('Xfile.bak')) " backup file should be created in the 'backup' directory if !has('bsd') " This check fails on FreeBSD ! call assert_true(filereadable('./Xbackup/Xfile.bak')) endif set backup& backupcopy& backupext& %bw ! call delete('Xfile') ! call delete('Xfile.bak') call delete('Xbackup', 'rf') let &backupdir = save_backupdir endfunc --- 893,916 ---- call mkdir('Xbackup') let save_backupdir = &backupdir set backupdir=.,./Xbackup ! call writefile(['1111'], 'Xwbsfile') ! silent !ln -s Xwbsfile Xwbsfile.bak ! new Xwbsfile set backup backupcopy=yes backupext=.bak write ! call assert_equal('link', getftype('Xwbsfile.bak')) ! call assert_equal('Xwbsfile', resolve('Xwbsfile.bak')) " backup file should be created in the 'backup' directory if !has('bsd') " This check fails on FreeBSD ! call assert_true(filereadable('./Xbackup/Xwbsfile.bak')) endif set backup& backupcopy& backupext& %bw ! call delete('Xwbsfile') ! call delete('Xwbsfile.bak') call delete('Xbackup', 'rf') let &backupdir = save_backupdir endfunc *************** *** 918,936 **** " 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 " Check that buffer is written before triggering QuitPre --- 918,936 ---- " Test for ':write ++bin' and ':write ++nobin' func Test_write_binary_file() " create a file without an eol/eof character ! call writefile(0z616161, 'Xwbfile1', 'b') ! new Xwbfile1 ! write ++bin Xwbfile2 ! write ++nobin Xwbfile3 ! call assert_equal(0z616161, readblob('Xwbfile2')) if has('win32') ! call assert_equal(0z6161610D.0A, readblob('Xwbfile3')) else ! call assert_equal(0z6161610A, readblob('Xwbfile3')) endif ! call delete('Xwbfile1') ! call delete('Xwbfile2') ! call delete('Xwbfile3') endfunc " Check that buffer is written before triggering QuitPre *** ../vim-9.0.0362/src/version.c 2022-09-02 19:45:12.215205522 +0100 --- src/version.c 2022-09-02 21:49:40.602980578 +0100 *************** *** 709,710 **** --- 709,712 ---- { /* Add new patch number below this line */ + /**/ + 363, /**/ -- "You're fired." (1980) "You're laid off." (1985) "You're downsized." (1990) "You're rightsized." (1992) (Scott Adams - The Dilbert principle) /// 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 ///