To: vim_dev@googlegroups.com Subject: Patch 9.0.0323 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0323 Problem: Using common name in tests leads to flaky tests. Solution: Rename files and directories to be more specific. Files: src/testdir/test_autocmd.vim, src/testdir/test_cd.vim, src/testdir/test_channel.vim, src/testdir/test_checkpath.vim, src/testdir/test_cmdline.vim, src/testdir/test_delete.vim, src/testdir/test_edit.vim, src/testdir/test_excmd.vim, src/testdir/test_findfile.vim, src/testdir/test_functions.vim, src/testdir/test_getcwd.vim, src/testdir/test_gui.vim, src/testdir/test_help.vim, src/testdir/test_ins_complete.vim, src/testdir/test_packadd.vim, src/testdir/test_quickfix.vim, src/testdir/test_startup.vim, src/testdir/test_terminal.vim, src/testdir/test_vim9_disassemble.vim, src/testdir/test_vim9_func.vim, src/testdir/test_vim9_import.vim, src/testdir/test_vim9_script.vim, src/testdir/test_viminfo.vim, src/testdir/test_writefile.vim *** ../vim-9.0.0322/src/testdir/test_autocmd.vim 2022-08-29 11:02:55.227279554 +0100 --- src/testdir/test_autocmd.vim 2022-08-29 20:57:49.100299112 +0100 *************** *** 717,730 **** call assert_equal('++', g:val) " Also get BufEnter when editing a directory ! call mkdir('Xdir') ! split Xdir call assert_equal('+++', g:val) " On MS-Windows we can't edit the directory, make sure we wipe the right " buffer. ! bwipe! Xdir ! call delete('Xdir', 'd') au! BufEnter " Editing a "nofile" buffer doesn't read the file but does trigger BufEnter --- 717,730 ---- call assert_equal('++', g:val) " Also get BufEnter when editing a directory ! call mkdir('Xbufenterdir') ! split Xbufenterdir call assert_equal('+++', g:val) " On MS-Windows we can't edit the directory, make sure we wipe the right " buffer. ! bwipe! Xbufenterdir ! call delete('Xbufenterdir', 'd') au! BufEnter " Editing a "nofile" buffer doesn't read the file but does trigger BufEnter *************** *** 2723,2738 **** endfunc func Test_autocmd_in_try_block() ! call mkdir('Xdir') au BufEnter * let g:fname = expand('%') try ! edit Xdir/ endtry ! call assert_match('Xdir', g:fname) unlet g:fname au! BufEnter ! call delete('Xdir', 'rf') endfunc func Test_autocmd_SafeState() --- 2723,2738 ---- endfunc func Test_autocmd_in_try_block() ! call mkdir('Xintrydir') au BufEnter * let g:fname = expand('%') try ! edit Xintrydir/ endtry ! call assert_match('Xintrydir', g:fname) unlet g:fname au! BufEnter ! call delete('Xintrydir', 'rf') endfunc func Test_autocmd_SafeState() *** ../vim-9.0.0322/src/testdir/test_cd.vim 2021-12-29 14:27:35.000000000 +0000 --- src/testdir/test_cd.vim 2022-08-29 20:58:43.080244006 +0100 *************** *** 69,79 **** " Test for chdir() func Test_chdir_func() let topdir = getcwd() ! call mkdir('Xdir/y/z', 'p') " Create a few tabpages and windows with different directories new ! cd Xdir tabnew tcd y below new --- 69,79 ---- " Test for chdir() func Test_chdir_func() let topdir = getcwd() ! call mkdir('Xchdir/y/z', 'p') " Create a few tabpages and windows with different directories new ! cd Xchdir tabnew tcd y below new *************** *** 81,102 **** lcd z tabfirst ! call assert_match('^\[global\] .*/Xdir$', trim(execute('verbose pwd'))) call chdir('..') call assert_equal('y', fnamemodify(getcwd(1, 2), ':t')) call assert_equal('z', fnamemodify(3->getcwd(2), ':t')) tabnext | wincmd t call assert_match('^\[tabpage\] .*/y$', trim(execute('verbose pwd'))) eval '..'->chdir() ! call assert_equal('Xdir', fnamemodify(getcwd(1, 2), ':t')) ! call assert_equal('Xdir', fnamemodify(getcwd(2, 2), ':t')) call assert_equal('z', fnamemodify(getcwd(3, 2), ':t')) call assert_equal('testdir', fnamemodify(getcwd(1, 1), ':t')) 3wincmd w call assert_match('^\[window\] .*/z$', trim(execute('verbose pwd'))) call chdir('..') ! call assert_equal('Xdir', fnamemodify(getcwd(1, 2), ':t')) ! call assert_equal('Xdir', fnamemodify(getcwd(2, 2), ':t')) call assert_equal('y', fnamemodify(getcwd(3, 2), ':t')) call assert_equal('testdir', fnamemodify(getcwd(1, 1), ':t')) --- 81,102 ---- lcd z tabfirst ! call assert_match('^\[global\] .*/Xchdir$', trim(execute('verbose pwd'))) call chdir('..') call assert_equal('y', fnamemodify(getcwd(1, 2), ':t')) call assert_equal('z', fnamemodify(3->getcwd(2), ':t')) tabnext | wincmd t call assert_match('^\[tabpage\] .*/y$', trim(execute('verbose pwd'))) eval '..'->chdir() ! call assert_equal('Xchdir', fnamemodify(getcwd(1, 2), ':t')) ! call assert_equal('Xchdir', fnamemodify(getcwd(2, 2), ':t')) call assert_equal('z', fnamemodify(getcwd(3, 2), ':t')) call assert_equal('testdir', fnamemodify(getcwd(1, 1), ':t')) 3wincmd w call assert_match('^\[window\] .*/z$', trim(execute('verbose pwd'))) call chdir('..') ! call assert_equal('Xchdir', fnamemodify(getcwd(1, 2), ':t')) ! call assert_equal('Xchdir', fnamemodify(getcwd(2, 2), ':t')) call assert_equal('y', fnamemodify(getcwd(3, 2), ':t')) call assert_equal('testdir', fnamemodify(getcwd(1, 1), ':t')) *************** *** 110,129 **** only | tabonly call chdir(topdir) ! call delete('Xdir', 'rf') endfunc " Test for changing to the previous directory '-' func Test_prev_dir() let topdir = getcwd() ! call mkdir('Xdir/a/b/c', 'p') " Create a few tabpages and windows with different directories new | only tabnew | new tabnew tabfirst ! cd Xdir tabnext | wincmd t tcd a wincmd w --- 110,129 ---- only | tabonly call chdir(topdir) ! call delete('Xchdir', 'rf') endfunc " Test for changing to the previous directory '-' func Test_prev_dir() let topdir = getcwd() ! call mkdir('Xprevdir/a/b/c', 'p') " Create a few tabpages and windows with different directories new | only tabnew | new tabnew tabfirst ! cd Xprevdir tabnext | wincmd t tcd a wincmd w *************** *** 143,149 **** " Check the directory of all the windows tabfirst ! call assert_equal('Xdir', fnamemodify(getcwd(), ':t')) tabnext | wincmd t call assert_equal('a', fnamemodify(getcwd(), ':t')) wincmd w --- 143,149 ---- " Check the directory of all the windows tabfirst ! call assert_equal('Xprevdir', fnamemodify(getcwd(), ':t')) tabnext | wincmd t call assert_equal('a', fnamemodify(getcwd(), ':t')) wincmd w *************** *** 163,169 **** " Check the directory of all the windows tabfirst ! call assert_equal('Xdir', fnamemodify(getcwd(), ':t')) tabnext | wincmd t call assert_equal('a', fnamemodify(getcwd(), ':t')) wincmd w --- 163,169 ---- " Check the directory of all the windows tabfirst ! call assert_equal('Xprevdir', fnamemodify(getcwd(), ':t')) tabnext | wincmd t call assert_equal('a', fnamemodify(getcwd(), ':t')) wincmd w *************** *** 173,179 **** only | tabonly call chdir(topdir) ! call delete('Xdir', 'rf') endfunc func Test_lcd_split() --- 173,179 ---- only | tabonly call chdir(topdir) ! call delete('Xprevdir', 'rf') endfunc func Test_lcd_split() *** ../vim-9.0.0322/src/testdir/test_channel.vim 2022-06-21 18:30:21.000000000 +0100 --- src/testdir/test_channel.vim 2022-08-29 21:00:00.452160355 +0100 *************** *** 2281,2289 **** let text = readfile('Xlog') call assert_match("hello there", text[1]) call assert_match("%s%s", text[2]) ! call mkdir("Xdir1") ! call assert_fails("call ch_logfile('Xdir1')", 'E484:') ! cal delete("Xdir1", 'd') call delete('Xlog') endfunc --- 2281,2289 ---- let text = readfile('Xlog') call assert_match("hello there", text[1]) call assert_match("%s%s", text[2]) ! call mkdir("Xchlogdir1") ! call assert_fails("call ch_logfile('Xchlogdir1')", 'E484:') ! cal delete("Xchlogdir1", 'd') call delete('Xlog') endfunc *** ../vim-9.0.0322/src/testdir/test_checkpath.vim 2020-09-23 21:29:29.000000000 +0100 --- src/testdir/test_checkpath.vim 2022-08-29 21:01:47.568036778 +0100 *************** *** 2,29 **** " Test for 'include' without \zs or \ze func Test_checkpath1() ! call mkdir("Xdir1/dir2", "p") ! call writefile(['#include "bar.a"'], 'Xdir1/dir2/foo.a') ! call writefile(['#include "baz.a"'], 'Xdir1/dir2/bar.a') ! call writefile(['#include "foo.a"'], 'Xdir1/dir2/baz.a') call writefile(['#include '], 'Xbase.a') edit Xbase.a ! set path=Xdir1/dir2 let res = split(execute("checkpath!"), "\n") call assert_equal([ \ '--- Included files in path ---', ! \ 'Xdir1/dir2/foo.a', ! \ 'Xdir1/dir2/foo.a -->', ! \ ' Xdir1/dir2/bar.a', ! \ ' Xdir1/dir2/bar.a -->', ! \ ' Xdir1/dir2/baz.a', ! \ ' Xdir1/dir2/baz.a -->', \ ' "foo.a" (Already listed)'], res) enew call delete("./Xbase.a") ! call delete("Xdir1", "rf") set path& endfunc --- 2,29 ---- " Test for 'include' without \zs or \ze func Test_checkpath1() ! call mkdir("Xcheckdir1/dir2", "p") ! call writefile(['#include "bar.a"'], 'Xcheckdir1/dir2/foo.a') ! call writefile(['#include "baz.a"'], 'Xcheckdir1/dir2/bar.a') ! call writefile(['#include "foo.a"'], 'Xcheckdir1/dir2/baz.a') call writefile(['#include '], 'Xbase.a') edit Xbase.a ! set path=Xcheckdir1/dir2 let res = split(execute("checkpath!"), "\n") call assert_equal([ \ '--- Included files in path ---', ! \ 'Xcheckdir1/dir2/foo.a', ! \ 'Xcheckdir1/dir2/foo.a -->', ! \ ' Xcheckdir1/dir2/bar.a', ! \ ' Xcheckdir1/dir2/bar.a -->', ! \ ' Xcheckdir1/dir2/baz.a', ! \ ' Xcheckdir1/dir2/baz.a -->', \ ' "foo.a" (Already listed)'], res) enew call delete("./Xbase.a") ! call delete("Xcheckdir1", "rf") set path& endfunc *************** *** 33,63 **** " Test for 'include' with \zs and \ze func Test_checkpath2() ! call mkdir("Xdir1/dir2", "p") ! call writefile(['%inc /bar/'], 'Xdir1/dir2/foo.b') ! call writefile(['%inc /baz/'], 'Xdir1/dir2/bar.b') ! call writefile(['%inc /foo/'], 'Xdir1/dir2/baz.b') call writefile(['%inc /foo/'], 'Xbase.b') let &include='^\s*%inc\s*/\zs[^/]\+\ze' let &includeexpr='DotsToSlashes()' edit Xbase.b ! set path=Xdir1/dir2 let res = split(execute("checkpath!"), "\n") call assert_equal([ \ '--- Included files in path ---', ! \ 'Xdir1/dir2/foo.b', ! \ 'Xdir1/dir2/foo.b -->', ! \ ' Xdir1/dir2/bar.b', ! \ ' Xdir1/dir2/bar.b -->', ! \ ' Xdir1/dir2/baz.b', ! \ ' Xdir1/dir2/baz.b -->', \ ' foo (Already listed)'], res) enew call delete("./Xbase.b") ! call delete("Xdir1", "rf") set path& set include& set includeexpr& --- 33,63 ---- " Test for 'include' with \zs and \ze func Test_checkpath2() ! call mkdir("Xcheckdir2/dir2", "p") ! call writefile(['%inc /bar/'], 'Xcheckdir2/dir2/foo.b') ! call writefile(['%inc /baz/'], 'Xcheckdir2/dir2/bar.b') ! call writefile(['%inc /foo/'], 'Xcheckdir2/dir2/baz.b') call writefile(['%inc /foo/'], 'Xbase.b') let &include='^\s*%inc\s*/\zs[^/]\+\ze' let &includeexpr='DotsToSlashes()' edit Xbase.b ! set path=Xcheckdir2/dir2 let res = split(execute("checkpath!"), "\n") call assert_equal([ \ '--- Included files in path ---', ! \ 'Xcheckdir2/dir2/foo.b', ! \ 'Xcheckdir2/dir2/foo.b -->', ! \ ' Xcheckdir2/dir2/bar.b', ! \ ' Xcheckdir2/dir2/bar.b -->', ! \ ' Xcheckdir2/dir2/baz.b', ! \ ' Xcheckdir2/dir2/baz.b -->', \ ' foo (Already listed)'], res) enew call delete("./Xbase.b") ! call delete("Xcheckdir2", "rf") set path& set include& set includeexpr& *************** *** 72,103 **** " Test for 'include' with \zs and no \ze func Test_checkpath3() ! call mkdir("Xdir1/dir2", "p") ! call writefile(['%inc bar.c'], 'Xdir1/dir2/foo.c') ! call writefile(['%inc baz.c'], 'Xdir1/dir2/bar.c') ! call writefile(['%inc foo.c'], 'Xdir1/dir2/baz.c') ! call writefile(['%inc foo.c'], 'Xdir1/dir2/FALSE.c') call writefile(['%inc FALSE.c foo.c'], 'Xbase.c') let &include='^\s*%inc\s*\%([[:upper:]][^[:space:]]*\s\+\)\?\zs\S\+\ze' let &includeexpr='StripNewlineChar()' edit Xbase.c ! set path=Xdir1/dir2 let res = split(execute("checkpath!"), "\n") call assert_equal([ \ '--- Included files in path ---', ! \ 'Xdir1/dir2/foo.c', ! \ 'Xdir1/dir2/foo.c -->', ! \ ' Xdir1/dir2/bar.c', ! \ ' Xdir1/dir2/bar.c -->', ! \ ' Xdir1/dir2/baz.c', ! \ ' Xdir1/dir2/baz.c -->', \ ' foo.c (Already listed)'], res) enew call delete("./Xbase.c") ! call delete("Xdir1", "rf") set path& set include& set includeexpr& --- 72,103 ---- " Test for 'include' with \zs and no \ze func Test_checkpath3() ! call mkdir("Xcheckdir3/dir2", "p") ! call writefile(['%inc bar.c'], 'Xcheckdir3/dir2/foo.c') ! call writefile(['%inc baz.c'], 'Xcheckdir3/dir2/bar.c') ! call writefile(['%inc foo.c'], 'Xcheckdir3/dir2/baz.c') ! call writefile(['%inc foo.c'], 'Xcheckdir3/dir2/FALSE.c') call writefile(['%inc FALSE.c foo.c'], 'Xbase.c') let &include='^\s*%inc\s*\%([[:upper:]][^[:space:]]*\s\+\)\?\zs\S\+\ze' let &includeexpr='StripNewlineChar()' edit Xbase.c ! set path=Xcheckdir3/dir2 let res = split(execute("checkpath!"), "\n") call assert_equal([ \ '--- Included files in path ---', ! \ 'Xcheckdir3/dir2/foo.c', ! \ 'Xcheckdir3/dir2/foo.c -->', ! \ ' Xcheckdir3/dir2/bar.c', ! \ ' Xcheckdir3/dir2/bar.c -->', ! \ ' Xcheckdir3/dir2/baz.c', ! \ ' Xcheckdir3/dir2/baz.c -->', \ ' foo.c (Already listed)'], res) enew call delete("./Xbase.c") ! call delete("Xcheckdir3", "rf") set path& set include& set includeexpr& *** ../vim-9.0.0322/src/testdir/test_cmdline.vim 2022-08-29 16:21:21.453992376 +0100 --- src/testdir/test_cmdline.vim 2022-08-29 21:04:25.843840994 +0100 *************** *** 83,120 **** endfunc func Test_complete_wildmenu() ! call mkdir('Xdir1/Xdir2', 'p') ! call writefile(['testfile1'], 'Xdir1/Xtestfile1') ! call writefile(['testfile2'], 'Xdir1/Xtestfile2') ! call writefile(['testfile3'], 'Xdir1/Xdir2/Xtestfile3') ! call writefile(['testfile3'], 'Xdir1/Xdir2/Xtestfile4') set wildmenu " Pressing completes, and moves to next files when pressing again. ! call feedkeys(":e Xdir1/\\\", 'tx') call assert_equal('testfile1', getline(1)) ! call feedkeys(":e Xdir1/\\\\", 'tx') call assert_equal('testfile2', getline(1)) " is like but begin with the last match and then go to " previous. ! call feedkeys(":e Xdir1/Xtest\\", 'tx') call assert_equal('testfile2', getline(1)) ! call feedkeys(":e Xdir1/Xtest\\\", 'tx') call assert_equal('testfile1', getline(1)) " / to move to previous/next file. ! call feedkeys(":e Xdir1/\\\", 'tx') call assert_equal('testfile1', getline(1)) ! call feedkeys(":e Xdir1/\\\\", 'tx') call assert_equal('testfile2', getline(1)) ! call feedkeys(":e Xdir1/\\\\\", 'tx') call assert_equal('testfile1', getline(1)) " / to go up/down directories. ! call feedkeys(":e Xdir1/\\\", 'tx') call assert_equal('testfile3', getline(1)) ! call feedkeys(":e Xdir1/\\\\\", 'tx') call assert_equal('testfile1', getline(1)) " this fails in some Unix GUIs, not sure why --- 83,120 ---- endfunc func Test_complete_wildmenu() ! call mkdir('Xwilddir1/Xdir2', 'p') ! call writefile(['testfile1'], 'Xwilddir1/Xtestfile1') ! call writefile(['testfile2'], 'Xwilddir1/Xtestfile2') ! call writefile(['testfile3'], 'Xwilddir1/Xdir2/Xtestfile3') ! call writefile(['testfile3'], 'Xwilddir1/Xdir2/Xtestfile4') set wildmenu " Pressing completes, and moves to next files when pressing again. ! call feedkeys(":e Xwilddir1/\\\", 'tx') call assert_equal('testfile1', getline(1)) ! call feedkeys(":e Xwilddir1/\\\\", 'tx') call assert_equal('testfile2', getline(1)) " is like but begin with the last match and then go to " previous. ! call feedkeys(":e Xwilddir1/Xtest\\", 'tx') call assert_equal('testfile2', getline(1)) ! call feedkeys(":e Xwilddir1/Xtest\\\", 'tx') call assert_equal('testfile1', getline(1)) " / to move to previous/next file. ! call feedkeys(":e Xwilddir1/\\\", 'tx') call assert_equal('testfile1', getline(1)) ! call feedkeys(":e Xwilddir1/\\\\", 'tx') call assert_equal('testfile2', getline(1)) ! call feedkeys(":e Xwilddir1/\\\\\", 'tx') call assert_equal('testfile1', getline(1)) " / to go up/down directories. ! call feedkeys(":e Xwilddir1/\\\", 'tx') call assert_equal('testfile3', getline(1)) ! call feedkeys(":e Xwilddir1/\\\\\", 'tx') call assert_equal('testfile1', getline(1)) " this fails in some Unix GUIs, not sure why *************** *** 124,132 **** set wildcharm= cnoremap cnoremap ! call feedkeys(":e Xdir1/\\\", 'tx') call assert_equal('testfile3', getline(1)) ! call feedkeys(":e Xdir1/\\\\", 'tx') call assert_equal('testfile1', getline(1)) set wildcharm=0 cunmap --- 124,132 ---- set wildcharm= cnoremap cnoremap ! call feedkeys(":e Xwilddir1/\\\", 'tx') call assert_equal('testfile3', getline(1)) ! call feedkeys(":e Xwilddir1/\\\\", 'tx') call assert_equal('testfile1', getline(1)) set wildcharm=0 cunmap *************** *** 135,155 **** " Test for canceling the wild menu by adding a character redrawstatus ! call feedkeys(":e Xdir1/\x\\"\", 'xt') ! call assert_equal('"e Xdir1/Xdir2/x', @:) " Completion using a relative path ! cd Xdir1/Xdir2 call feedkeys(":e ../\\\\\\"\", 'tx') call assert_equal('"e Xtestfile3 Xtestfile4', @:) cd - " test for wildmenumode() cnoremap wildmenumode() ! call feedkeys(":cd Xdir\\\\"\", 'tx') ! call assert_equal('"cd Xdir1/0', @:) ! call feedkeys(":e Xdir1/\\\\"\", 'tx') ! call assert_equal('"e Xdir1/Xdir2/1', @:) cunmap " Test for canceling the wild menu by pressing or . --- 135,155 ---- " Test for canceling the wild menu by adding a character redrawstatus ! call feedkeys(":e Xwilddir1/\x\\"\", 'xt') ! call assert_equal('"e Xwilddir1/Xdir2/x', @:) " Completion using a relative path ! cd Xwilddir1/Xdir2 call feedkeys(":e ../\\\\\\"\", 'tx') call assert_equal('"e Xtestfile3 Xtestfile4', @:) cd - " test for wildmenumode() cnoremap wildmenumode() ! call feedkeys(":cd Xwilddir\\\\"\", 'tx') ! call assert_equal('"cd Xwilddir1/0', @:) ! call feedkeys(":e Xwilddir1/\\\\"\", 'tx') ! call assert_equal('"e Xwilddir1/Xdir2/1', @:) cunmap " Test for canceling the wild menu by pressing or . *************** *** 162,168 **** " cleanup %bwipe ! call delete('Xdir1', 'rf') set nowildmenu endfunc --- 162,168 ---- " cleanup %bwipe ! call delete('Xwilddir1', 'rf') set nowildmenu endfunc *************** *** 1930,1947 **** func Test_wildmenu_dirstack() CheckUnix %bw! ! call mkdir('Xdir1/dir2/dir3/dir4', 'p') ! call writefile([], 'Xdir1/file1_1.txt') ! call writefile([], 'Xdir1/file1_2.txt') ! call writefile([], 'Xdir1/dir2/file2_1.txt') ! call writefile([], 'Xdir1/dir2/file2_2.txt') ! call writefile([], 'Xdir1/dir2/dir3/file3_1.txt') ! call writefile([], 'Xdir1/dir2/dir3/file3_2.txt') ! call writefile([], 'Xdir1/dir2/dir3/dir4/file4_1.txt') ! call writefile([], 'Xdir1/dir2/dir3/dir4/file4_2.txt') set wildmenu ! cd Xdir1/dir2/dir3/dir4 call feedkeys(":e \\\"\", 'xt') call assert_equal('"e file4_1.txt', @:) call feedkeys(":e \\\\"\", 'xt') --- 1930,1947 ---- func Test_wildmenu_dirstack() CheckUnix %bw! ! call mkdir('Xwildmenu/dir2/dir3/dir4', 'p') ! call writefile([], 'Xwildmenu/file1_1.txt') ! call writefile([], 'Xwildmenu/file1_2.txt') ! call writefile([], 'Xwildmenu/dir2/file2_1.txt') ! call writefile([], 'Xwildmenu/dir2/file2_2.txt') ! call writefile([], 'Xwildmenu/dir2/dir3/file3_1.txt') ! call writefile([], 'Xwildmenu/dir2/dir3/file3_2.txt') ! call writefile([], 'Xwildmenu/dir2/dir3/dir4/file4_1.txt') ! call writefile([], 'Xwildmenu/dir2/dir3/dir4/file4_2.txt') set wildmenu ! cd Xwildmenu/dir2/dir3/dir4 call feedkeys(":e \\\"\", 'xt') call assert_equal('"e file4_1.txt', @:) call feedkeys(":e \\\\"\", 'xt') *************** *** 1955,1964 **** call feedkeys(":e \\\\\\\"\", 'xt') call assert_equal('"e ../../dir3/dir4/file4_1.txt', @:) cd - ! call feedkeys(":e Xdir1/\\\\\\"\", 'xt') ! call assert_equal('"e Xdir1/dir2/dir3/dir4/file4_1.txt', @:) ! call delete('Xdir1', 'rf') set wildmenu& endfunc --- 1955,1964 ---- call feedkeys(":e \\\\\\\"\", 'xt') call assert_equal('"e ../../dir3/dir4/file4_1.txt', @:) cd - ! call feedkeys(":e Xwildmenu/\\\\\\"\", 'xt') ! call assert_equal('"e Xwildmenu/dir2/dir3/dir4/file4_1.txt', @:) ! call delete('Xwildmenu', 'rf') set wildmenu& endfunc *** ../vim-9.0.0322/src/testdir/test_delete.vim 2021-01-28 13:49:24.000000000 +0000 --- src/testdir/test_delete.vim 2022-08-29 21:07:08.635627164 +0100 *************** *** 14,45 **** endfunc func Test_dir_delete() ! call mkdir('Xdir1') ! call assert_true(isdirectory('Xdir1')) ! call assert_equal(0, delete('Xdir1', 'd')) ! call assert_false(isdirectory('Xdir1')) ! call assert_equal(-1, delete('Xdir1', 'd')) endfunc func Test_recursive_delete() ! call mkdir('Xdir1') ! call mkdir('Xdir1/subdir') ! call mkdir('Xdir1/empty') ! split Xdir1/Xfile call setline(1, ['a', 'b']) w ! w Xdir1/subdir/Xfile close ! call assert_true(isdirectory('Xdir1')) ! call assert_equal(['a', 'b'], readfile('Xdir1/Xfile')) ! call assert_true(isdirectory('Xdir1/subdir')) ! call assert_equal(['a', 'b'], readfile('Xdir1/subdir/Xfile')) ! call assert_true('Xdir1/empty'->isdirectory()) ! call assert_equal(0, delete('Xdir1', 'rf')) ! call assert_false(isdirectory('Xdir1')) ! call assert_equal(-1, delete('Xdir1', 'd')) ! bwipe Xdir1/Xfile ! bwipe Xdir1/subdir/Xfile endfunc func Test_symlink_delete() --- 14,45 ---- endfunc func Test_dir_delete() ! call mkdir('Xdirdel') ! call assert_true(isdirectory('Xdirdel')) ! call assert_equal(0, delete('Xdirdel', 'd')) ! call assert_false(isdirectory('Xdirdel')) ! call assert_equal(-1, delete('Xdirdel', 'd')) endfunc func Test_recursive_delete() ! call mkdir('Xrecdel') ! call mkdir('Xrecdel/subdir') ! call mkdir('Xrecdel/empty') ! split Xrecdel/Xfile call setline(1, ['a', 'b']) w ! w Xrecdel/subdir/Xfile close ! call assert_true(isdirectory('Xrecdel')) ! call assert_equal(['a', 'b'], readfile('Xrecdel/Xfile')) ! call assert_true(isdirectory('Xrecdel/subdir')) ! call assert_equal(['a', 'b'], readfile('Xrecdel/subdir/Xfile')) ! call assert_true('Xrecdel/empty'->isdirectory()) ! call assert_equal(0, delete('Xrecdel', 'rf')) ! call assert_false(isdirectory('Xrecdel')) ! call assert_equal(-1, delete('Xrecdel', 'd')) ! bwipe Xrecdel/Xfile ! bwipe Xrecdel/subdir/Xfile endfunc func Test_symlink_delete() *************** *** 47,105 **** split Xfile call setline(1, ['a', 'b']) wq ! silent !ln -s Xfile Xlink " Delete the link, not the file ! call assert_equal(0, delete('Xlink')) ! call assert_equal(-1, delete('Xlink')) call assert_equal(0, delete('Xfile')) bwipe Xfile endfunc func Test_symlink_dir_delete() CheckUnix ! call mkdir('Xdir1') ! silent !ln -s Xdir1 Xlink ! call assert_true(isdirectory('Xdir1')) ! call assert_true(isdirectory('Xlink')) " Delete the link, not the directory ! call assert_equal(0, delete('Xlink')) ! call assert_equal(-1, delete('Xlink')) ! call assert_equal(0, delete('Xdir1', 'd')) endfunc func Test_symlink_recursive_delete() CheckUnix ! call mkdir('Xdir3') ! call mkdir('Xdir3/subdir') ! call mkdir('Xdir4') ! split Xdir3/Xfile call setline(1, ['a', 'b']) w ! w Xdir3/subdir/Xfile ! w Xdir4/Xfile close ! silent !ln -s ../Xdir4 Xdir3/Xlink ! call assert_true(isdirectory('Xdir3')) ! call assert_equal(['a', 'b'], readfile('Xdir3/Xfile')) ! call assert_true(isdirectory('Xdir3/subdir')) ! call assert_equal(['a', 'b'], readfile('Xdir3/subdir/Xfile')) ! call assert_true(isdirectory('Xdir4')) ! call assert_true(isdirectory('Xdir3/Xlink')) ! call assert_equal(['a', 'b'], readfile('Xdir4/Xfile')) ! ! call assert_equal(0, delete('Xdir3', 'rf')) ! call assert_false(isdirectory('Xdir3')) ! call assert_equal(-1, delete('Xdir3', 'd')) " symlink is deleted, not the directory it points to ! call assert_true(isdirectory('Xdir4')) ! call assert_equal(['a', 'b'], readfile('Xdir4/Xfile')) ! call assert_equal(0, delete('Xdir4/Xfile')) ! call assert_equal(0, delete('Xdir4', 'd')) ! ! bwipe Xdir3/Xfile ! bwipe Xdir3/subdir/Xfile ! bwipe Xdir4/Xfile endfunc func Test_delete_errors() --- 47,105 ---- split Xfile call setline(1, ['a', 'b']) wq ! silent !ln -s Xfile Xdellink " Delete the link, not the file ! call assert_equal(0, delete('Xdellink')) ! call assert_equal(-1, delete('Xdellink')) call assert_equal(0, delete('Xfile')) bwipe Xfile endfunc func Test_symlink_dir_delete() CheckUnix ! call mkdir('Xsymdir') ! silent !ln -s Xsymdir Xdirlink ! call assert_true(isdirectory('Xsymdir')) ! call assert_true(isdirectory('Xdirlink')) " Delete the link, not the directory ! call assert_equal(0, delete('Xdirlink')) ! call assert_equal(-1, delete('Xdirlink')) ! call assert_equal(0, delete('Xsymdir', 'd')) endfunc func Test_symlink_recursive_delete() CheckUnix ! call mkdir('Xrecdir3') ! call mkdir('Xrecdir3/subdir') ! call mkdir('Xrecdir4') ! split Xrecdir3/Xfile call setline(1, ['a', 'b']) w ! w Xrecdir3/subdir/Xfile ! w Xrecdir4/Xfile close ! silent !ln -s ../Xrecdir4 Xrecdir3/Xreclink ! call assert_true(isdirectory('Xrecdir3')) ! call assert_equal(['a', 'b'], readfile('Xrecdir3/Xfile')) ! call assert_true(isdirectory('Xrecdir3/subdir')) ! call assert_equal(['a', 'b'], readfile('Xrecdir3/subdir/Xfile')) ! call assert_true(isdirectory('Xrecdir4')) ! call assert_true(isdirectory('Xrecdir3/Xreclink')) ! call assert_equal(['a', 'b'], readfile('Xrecdir4/Xfile')) ! ! call assert_equal(0, delete('Xrecdir3', 'rf')) ! call assert_false(isdirectory('Xrecdir3')) ! call assert_equal(-1, delete('Xrecdir3', 'd')) " symlink is deleted, not the directory it points to ! call assert_true(isdirectory('Xrecdir4')) ! call assert_equal(['a', 'b'], readfile('Xrecdir4/Xfile')) ! call assert_equal(0, delete('Xrecdir4/Xfile')) ! call assert_equal(0, delete('Xrecdir4', 'd')) ! ! bwipe Xrecdir3/Xfile ! bwipe Xrecdir3/subdir/Xfile ! bwipe Xrecdir4/Xfile endfunc func Test_delete_errors() *** ../vim-9.0.0322/src/testdir/test_edit.vim 2022-07-26 18:12:35.094727070 +0100 --- src/testdir/test_edit.vim 2022-08-29 21:14:31.174136825 +0100 *************** *** 1492,1498 **** " Long directory names only work on Unix. CheckUnix ! let dirname = getcwd() . "/Xdir" let longdirname = dirname . repeat('/' . repeat('d', 255), 4) try call mkdir(longdirname, 'p') --- 1492,1498 ---- " Long directory names only work on Unix. CheckUnix ! let dirname = getcwd() . "/Xlongdir" let longdirname = dirname . repeat('/' . repeat('d', 255), 4) try call mkdir(longdirname, 'p') *************** *** 1729,1735 **** " Test for editing a directory func Test_edit_is_a_directory() CheckEnglish ! let dirname = getcwd() . "/Xdir" call mkdir(dirname, 'p') new --- 1729,1735 ---- " Test for editing a directory func Test_edit_is_a_directory() CheckEnglish ! let dirname = getcwd() . "/Xeditdir" call mkdir(dirname, 'p') new *** ../vim-9.0.0322/src/testdir/test_excmd.vim 2022-07-26 19:44:52.916896633 +0100 --- src/testdir/test_excmd.vim 2022-08-29 21:15:27.562470759 +0100 *************** *** 489,497 **** if has('unix') " Redirecting to a directory name ! call mkdir('Xdir') ! call assert_fails('redir > Xdir', 'E17:') ! call delete('Xdir', 'd') endif " Test for redirecting to a register --- 489,497 ---- if has('unix') " Redirecting to a directory name ! call mkdir('Xredir') ! call assert_fails('redir > Xredir', 'E17:') ! call delete('Xredir', 'd') endif " Test for redirecting to a register *** ../vim-9.0.0322/src/testdir/test_findfile.vim 2021-07-25 13:56:59.000000000 +0100 --- src/testdir/test_findfile.vim 2022-08-29 21:16:47.370884052 +0100 *************** *** 1,14 **** " Test findfile() and finddir() ! let s:files = [ 'Xdir1/foo', ! \ 'Xdir1/bar', ! \ 'Xdir1/Xdir2/foo', ! \ 'Xdir1/Xdir2/foobar', ! \ 'Xdir1/Xdir2/Xdir3/bar', ! \ 'Xdir1/Xdir2/Xdir3/barfoo' ] func CreateFiles() ! call mkdir('Xdir1/Xdir2/Xdir3/Xdir2', 'p') for f in s:files call writefile([], f) endfor --- 1,14 ---- " Test findfile() and finddir() ! let s:files = [ 'Xfinddir1/foo', ! \ 'Xfinddir1/bar', ! \ 'Xfinddir1/Xdir2/foo', ! \ 'Xfinddir1/Xdir2/foobar', ! \ 'Xfinddir1/Xdir2/Xdir3/bar', ! \ 'Xfinddir1/Xdir2/Xdir3/barfoo' ] func CreateFiles() ! call mkdir('Xfinddir1/Xdir2/Xdir3/Xdir2', 'p') for f in s:files call writefile([], f) endfor *************** *** 16,30 **** func CleanFiles() " Safer to delete each file even if it's more verbose ! " than doing a recursive delete('Xdir1', 'rf'). for f in s:files call delete(f) endfor ! call delete('Xdir1/Xdir2/Xdir3/Xdir2', 'd') ! call delete('Xdir1/Xdir2/Xdir3', 'd') ! call delete('Xdir1/Xdir2', 'd') ! call delete('Xdir1', 'd') endfunc " Test findfile({name} [, {path} [, {count}]]) --- 16,30 ---- func CleanFiles() " Safer to delete each file even if it's more verbose ! " than doing a recursive delete('Xfinddir1', 'rf'). for f in s:files call delete(f) endfor ! call delete('Xfinddir1/Xdir2/Xdir3/Xdir2', 'd') ! call delete('Xfinddir1/Xdir2/Xdir3', 'd') ! call delete('Xfinddir1/Xdir2', 'd') ! call delete('Xfinddir1', 'd') endfunc " Test findfile({name} [, {path} [, {count}]]) *************** *** 34,40 **** let save_dir = getcwd() set shellslash call CreateFiles() ! cd Xdir1 e Xdir2/foo " With ,, in path, findfile() searches in current directory. --- 34,40 ---- let save_dir = getcwd() set shellslash call CreateFiles() ! cd Xfinddir1 e Xdir2/foo " With ,, in path, findfile() searches in current directory. *************** *** 83,116 **** " Test upwards search. cd Xdir2/Xdir3 call assert_equal('bar', findfile('bar', ';')) ! call assert_match('.*/Xdir1/Xdir2/foo', findfile('foo', ';')) ! call assert_match('.*/Xdir1/Xdir2/foo', findfile('foo', ';', 1)) ! call assert_match('.*/Xdir1/foo', findfile('foo', ';', 2)) ! call assert_match('.*/Xdir1/foo', findfile('foo', ';', 2)) ! call assert_match('.*/Xdir1/Xdir2/foo', findfile('foo', 'Xdir2;', 1)) call assert_equal('', findfile('foo', 'Xdir2;', 2)) " List l should have at least 2 values (possibly more if foo file ! " happens to be found upwards above Xdir1). let l = findfile('foo', ';', -1) ! call assert_match('.*/Xdir1/Xdir2/foo', l[0]) ! call assert_match('.*/Xdir1/foo', l[1]) " Test upwards search with stop-directory. cd Xdir2 ! let l = findfile('bar', ';' . save_dir . '/Xdir1/Xdir2/', -1) call assert_equal(1, len(l)) ! call assert_match('.*/Xdir1/Xdir2/Xdir3/bar', l[0]) ! let l = findfile('bar', ';' . save_dir . '/Xdir1/', -1) call assert_equal(2, len(l)) ! call assert_match('.*/Xdir1/Xdir2/Xdir3/bar', l[0]) ! call assert_match('.*/Xdir1/bar', l[1]) " Test combined downwards and upwards search from Xdir2/. cd ../.. call assert_equal('Xdir3/bar', findfile('bar', '**;', 1)) ! call assert_match('.*/Xdir1/bar', findfile('bar', '**;', 2)) bwipe! call chdir(save_dir) --- 83,116 ---- " Test upwards search. cd Xdir2/Xdir3 call assert_equal('bar', findfile('bar', ';')) ! call assert_match('.*/Xfinddir1/Xdir2/foo', findfile('foo', ';')) ! call assert_match('.*/Xfinddir1/Xdir2/foo', findfile('foo', ';', 1)) ! call assert_match('.*/Xfinddir1/foo', findfile('foo', ';', 2)) ! call assert_match('.*/Xfinddir1/foo', findfile('foo', ';', 2)) ! call assert_match('.*/Xfinddir1/Xdir2/foo', findfile('foo', 'Xdir2;', 1)) call assert_equal('', findfile('foo', 'Xdir2;', 2)) " List l should have at least 2 values (possibly more if foo file ! " happens to be found upwards above Xfinddir1). let l = findfile('foo', ';', -1) ! call assert_match('.*/Xfinddir1/Xdir2/foo', l[0]) ! call assert_match('.*/Xfinddir1/foo', l[1]) " Test upwards search with stop-directory. cd Xdir2 ! let l = findfile('bar', ';' . save_dir . '/Xfinddir1/Xdir2/', -1) call assert_equal(1, len(l)) ! call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) ! let l = findfile('bar', ';' . save_dir . '/Xfinddir1/', -1) call assert_equal(2, len(l)) ! call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) ! call assert_match('.*/Xfinddir1/bar', l[1]) " Test combined downwards and upwards search from Xdir2/. cd ../.. call assert_equal('Xdir3/bar', findfile('bar', '**;', 1)) ! call assert_match('.*/Xfinddir1/bar', findfile('bar', '**;', 2)) bwipe! call chdir(save_dir) *************** *** 134,140 **** let save_dir = getcwd() set path=,, call CreateFiles() ! cd Xdir1 call assert_equal('Xdir2', finddir('Xdir2')) call assert_equal('', 'Xdir3'->finddir()) --- 134,140 ---- let save_dir = getcwd() set path=,, call CreateFiles() ! cd Xfinddir1 call assert_equal('Xdir2', finddir('Xdir2')) call assert_equal('', 'Xdir3'->finddir()) *************** *** 157,173 **** " Test upwards dir search. cd Xdir2/Xdir3 ! call assert_match('.*/Xdir1', finddir('Xdir1', ';')) " Test upwards search with stop-directory. ! call assert_match('.*/Xdir1', finddir('Xdir1', ';' . save_dir . '/')) ! call assert_equal('', finddir('Xdir1', ';' . save_dir . '/Xdir1/')) " Test combined downwards and upwards dir search from Xdir2/. cd .. ! call assert_match('.*/Xdir1', finddir('Xdir1', '**;', 1)) call assert_equal('Xdir3/Xdir2', finddir('Xdir2', '**;', 1)) ! call assert_match('.*/Xdir1/Xdir2', finddir('Xdir2', '**;', 2)) call assert_equal('Xdir3', finddir('Xdir3', '**;', 1)) call chdir(save_dir) --- 157,173 ---- " Test upwards dir search. cd Xdir2/Xdir3 ! call assert_match('.*/Xfinddir1', finddir('Xfinddir1', ';')) " Test upwards search with stop-directory. ! call assert_match('.*/Xfinddir1', finddir('Xfinddir1', ';' . save_dir . '/')) ! call assert_equal('', finddir('Xfinddir1', ';' . save_dir . '/Xfinddir1/')) " Test combined downwards and upwards dir search from Xdir2/. cd .. ! call assert_match('.*/Xfinddir1', finddir('Xfinddir1', '**;', 1)) call assert_equal('Xdir3/Xdir2', finddir('Xdir2', '**;', 1)) ! call assert_match('.*/Xfinddir1/Xdir2', finddir('Xdir2', '**;', 2)) call assert_equal('Xdir3', finddir('Xdir3', '**;', 1)) call chdir(save_dir) *************** *** 191,197 **** let save_dir = getcwd() set path=.,./**/* call CreateFiles() ! cd Xdir1 " Test for :find find foo --- 191,197 ---- let save_dir = getcwd() set path=.,./**/* call CreateFiles() ! cd Xfinddir1 " Test for :find find foo *** ../vim-9.0.0322/src/testdir/test_functions.vim 2022-08-26 15:34:48.248902161 +0100 --- src/testdir/test_functions.vim 2022-08-29 21:30:52.360830425 +0100 *************** *** 347,355 **** call delete('Xlink2') call delete('Xlink3') ! silent !ln -s -f Xdir//Xfile Xlink ! call assert_equal('Xdir/Xfile', resolve('Xlink')) ! call delete('Xlink') silent !ln -s -f Xlink2/ Xlink1 call assert_equal('Xlink2', 'Xlink1'->resolve()) --- 347,355 ---- call delete('Xlink2') call delete('Xlink3') ! silent !ln -s -f Xresolvedir//Xfile Xresolvelink ! call assert_equal('Xresolvedir/Xfile', resolve('Xresolvelink')) ! call delete('Xresolvelink') silent !ln -s -f Xlink2/ Xlink1 call assert_equal('Xlink2', 'Xlink1'->resolve()) *************** *** 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' *************** *** 398,449 **** " 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') ! silent !mklink /J Xlink Xdir if !v:shell_error ! call assert_equal(s:normalize_fname(getcwd() . '\Xdir'), s:normalize_fname(resolve(getcwd() . '/Xlink'))) ! call delete('Xdir', 'd') " test for junction already removed call assert_equal(s:normalize_fname(getcwd() . '\Xlink'), s:normalize_fname(resolve(getcwd() . '/Xlink'))) call delete('Xlink') else echomsg 'skipped test for junction to a directory' ! call delete('Xdir', 'd') endif " test for symbolic link to a directory ! call mkdir('Xdir') ! silent !mklink /D Xlink Xdir if !v:shell_error ! call assert_equal(s:normalize_fname(getcwd() . '\Xdir'), s:normalize_fname(resolve(getcwd() . '/Xlink'))) ! call delete('Xdir', 'd') " test for symbolic link already removed call assert_equal(s:normalize_fname(getcwd() . '\Xlink'), s:normalize_fname(resolve(getcwd() . '/Xlink'))) call delete('Xlink') else echomsg 'skipped test for symbolic link to a directory' ! call delete('Xdir', 'd') endif " test for buffer name --- 398,448 ---- " remove files call delete('Xlink') ! call delete('Xresfile') " test for symbolic link to a file ! new Xslinkfile wq ! call assert_equal('Xslinkfile', resolve('Xslinkfile')) ! silent !mklink Xlink Xslinkfile if !v:shell_error ! call assert_equal(s:normalize_fname(getcwd() . '\Xslinkfile'), s:normalize_fname(resolve('./Xlink'))) call delete('Xlink') else echomsg 'skipped test for symbolic link to a file' endif ! call delete('Xslinkfile') " test for junction to a directory ! call mkdir('Xjuncdir') ! silent !mklink /J Xlink Xjuncdir if !v:shell_error ! call assert_equal(s:normalize_fname(getcwd() . '\Xjuncdir'), s:normalize_fname(resolve(getcwd() . '/Xlink'))) ! call delete('Xjuncdir', 'd') " test for junction already removed call assert_equal(s:normalize_fname(getcwd() . '\Xlink'), s:normalize_fname(resolve(getcwd() . '/Xlink'))) call delete('Xlink') else echomsg 'skipped test for junction to a directory' ! call delete('Xjuncdir', 'd') endif " test for symbolic link to a directory ! call mkdir('Xjuncdir') ! silent !mklink /D Xlink Xjuncdir if !v:shell_error ! call assert_equal(s:normalize_fname(getcwd() . '\Xjuncdir'), s:normalize_fname(resolve(getcwd() . '/Xlink'))) ! call delete('Xjuncdir', 'd') " test for symbolic link already removed call assert_equal(s:normalize_fname(getcwd() . '\Xlink'), s:normalize_fname(resolve(getcwd() . '/Xlink'))) call delete('Xlink') else echomsg 'skipped test for symbolic link to a directory' ! call delete('Xjuncdir', 'd') endif " test for buffer name *************** *** 461,480 **** call delete('Xfile') " test for reparse point ! call mkdir('Xdir') ! call assert_equal('Xdir', resolve('Xdir')) ! silent !mklink /D Xdirlink Xdir if !v:shell_error ! w Xdir/text.txt ! call assert_equal('Xdir/text.txt', resolve('Xdir/text.txt')) ! call assert_equal(s:normalize_fname(getcwd() . '\Xdir\text.txt'), s:normalize_fname(resolve('Xdirlink\text.txt'))) ! call assert_equal(s:normalize_fname(getcwd() . '\Xdir'), s:normalize_fname(resolve('Xdirlink'))) call delete('Xdirlink') else echomsg 'skipped test for reparse point' endif ! call delete('Xdir', 'rf') endfunc func Test_simplify() --- 460,479 ---- call delete('Xfile') " test for reparse point ! call mkdir('Xparsedir') ! call assert_equal('Xdir', resolve('Xparsedir')) ! silent !mklink /D Xdirlink Xparsedir if !v:shell_error ! w Xparsedir/text.txt ! call assert_equal('Xparsedir/text.txt', resolve('Xparsedir/text.txt')) ! call assert_equal(s:normalize_fname(getcwd() . '\Xparsedir\text.txt'), s:normalize_fname(resolve('Xdirlink\text.txt'))) ! call assert_equal(s:normalize_fname(getcwd() . '\Xparsedir'), s:normalize_fname(resolve('Xdirlink'))) call delete('Xdirlink') else echomsg 'skipped test for reparse point' endif ! call delete('Xparsedir', 'rf') endfunc func Test_simplify() *************** *** 497,505 **** call assert_equal('./file', simplify('dir/.././file')) call assert_equal('../dir', simplify('./../dir')) call assert_equal('..', simplify('../testdir/..')) ! call mkdir('Xdir') ! call assert_equal('.', simplify('Xdir/../.')) ! call delete('Xdir', 'd') call assert_fails('call simplify({->0})', 'E729:') call assert_fails('call simplify([])', 'E730:') --- 496,504 ---- call assert_equal('./file', simplify('dir/.././file')) call assert_equal('../dir', simplify('./../dir')) call assert_equal('..', simplify('../testdir/..')) ! call mkdir('Xsimpdir') ! call assert_equal('.', simplify('Xsimpdir/../.')) ! call delete('Xsimpdir', 'd') call assert_fails('call simplify({->0})', 'E729:') call assert_fails('call simplify([])', 'E730:') *************** *** 1336,1344 **** call assert_equal(0, filewritable('doesnotexist')) ! call mkdir('Xdir') ! call assert_equal(2, filewritable('Xdir')) ! call delete('Xdir', 'd') call delete('Xfilewritable') bw! --- 1335,1343 ---- call assert_equal(0, filewritable('doesnotexist')) ! call mkdir('Xwritedir') ! call assert_equal(2, filewritable('Xwritedir')) ! call delete('Xwritedir', 'd') call delete('Xfilewritable') bw! *************** *** 1364,1380 **** bwipe " create "notepad.bat" ! call mkdir('Xdir') ! let notepadbat = fnamemodify('Xdir/notepad.bat', ':p') call writefile([], notepadbat) new " check that the path and the pathext order is valid ! lcd Xdir let [pathext, $PATHEXT] = [$PATHEXT, '.com;.exe;.bat;.cmd'] call assert_equal(notepadbat, exepath('notepad')) let $PATHEXT = pathext bwipe ! eval 'Xdir'->delete('rf') elseif has('unix') call assert_equal(1, 'cat'->executable()) call assert_equal(0, executable('nodogshere')) --- 1363,1379 ---- bwipe " create "notepad.bat" ! call mkdir('Xnotedir') ! let notepadbat = fnamemodify('Xnotedir/notepad.bat', ':p') call writefile([], notepadbat) new " check that the path and the pathext order is valid ! lcd Xnotedir let [pathext, $PATHEXT] = [$PATHEXT, '.com;.exe;.bat;.cmd'] call assert_equal(notepadbat, exepath('notepad')) let $PATHEXT = pathext bwipe ! eval 'Xnotedir'->delete('rf') elseif has('unix') call assert_equal(1, 'cat'->executable()) call assert_equal(0, executable('nodogshere')) *************** *** 2073,2160 **** endfunc func Test_readdir() ! call mkdir('Xdir') ! call writefile([], 'Xdir/foo.txt') ! call writefile([], 'Xdir/bar.txt') ! call mkdir('Xdir/dir') " All results ! let files = readdir('Xdir') call assert_equal(['bar.txt', 'dir', 'foo.txt'], sort(files)) " Only results containing "f" ! let files = 'Xdir'->readdir({ x -> stridx(x, 'f') != -1 }) call assert_equal(['foo.txt'], sort(files)) " Only .txt files ! let files = readdir('Xdir', { x -> x =~ '.txt$' }) call assert_equal(['bar.txt', 'foo.txt'], sort(files)) " Only .txt files with string ! let files = readdir('Xdir', 'v:val =~ ".txt$"') call assert_equal(['bar.txt', 'foo.txt'], sort(files)) " Limit to 1 result. let l = [] ! let files = readdir('Xdir', {x -> len(add(l, x)) == 2 ? -1 : 1}) call assert_equal(1, len(files)) " Nested readdir() must not crash ! let files = readdir('Xdir', 'readdir("Xdir", "1") != []') call sort(files)->assert_equal(['bar.txt', 'dir', 'foo.txt']) ! eval 'Xdir'->delete('rf') endfunc func Test_readdirex() ! call mkdir('Xdir') ! call writefile(['foo'], 'Xdir/foo.txt') ! call writefile(['barbar'], 'Xdir/bar.txt') ! call mkdir('Xdir/dir') " All results ! let files = readdirex('Xdir')->map({-> v:val.name}) call assert_equal(['bar.txt', 'dir', 'foo.txt'], sort(files)) ! let sizes = readdirex('Xdir')->map({-> v:val.size}) call assert_equal([0, 4, 7], sort(sizes)) " Only results containing "f" ! let files = 'Xdir'->readdirex({ e -> stridx(e.name, 'f') != -1 }) \ ->map({-> v:val.name}) call assert_equal(['foo.txt'], sort(files)) " Only .txt files ! let files = readdirex('Xdir', { e -> e.name =~ '.txt$' }) \ ->map({-> v:val.name}) call assert_equal(['bar.txt', 'foo.txt'], sort(files)) " Only .txt files with string ! let files = readdirex('Xdir', 'v:val.name =~ ".txt$"') \ ->map({-> v:val.name}) call assert_equal(['bar.txt', 'foo.txt'], sort(files)) " Limit to 1 result. let l = [] ! let files = readdirex('Xdir', {e -> len(add(l, e.name)) == 2 ? -1 : 1}) \ ->map({-> v:val.name}) call assert_equal(1, len(files)) " Nested readdirex() must not crash ! let files = readdirex('Xdir', 'readdirex("Xdir", "1") != []') \ ->map({-> v:val.name}) call sort(files)->assert_equal(['bar.txt', 'dir', 'foo.txt']) " report broken link correctly if has("unix") ! call writefile([], 'Xdir/abc.txt') ! call system("ln -s Xdir/abc.txt Xdir/link") ! call delete('Xdir/abc.txt') ! let files = readdirex('Xdir', 'readdirex("Xdir", "1") != []') \ ->map({-> v:val.name .. '_' .. v:val.type}) call sort(files)->assert_equal( \ ['bar.txt_file', 'dir_dir', 'foo.txt_file', 'link_link']) endif ! eval 'Xdir'->delete('rf') call assert_fails('call readdirex("doesnotexist")', 'E484:') endfunc --- 2072,2159 ---- endfunc func Test_readdir() ! call mkdir('Xreaddir') ! call writefile([], 'Xreaddir/foo.txt') ! call writefile([], 'Xreaddir/bar.txt') ! call mkdir('Xreaddir/dir') " All results ! let files = readdir('Xreaddir') call assert_equal(['bar.txt', 'dir', 'foo.txt'], sort(files)) " Only results containing "f" ! let files = 'Xreaddir'->readdir({ x -> stridx(x, 'f') != -1 }) call assert_equal(['foo.txt'], sort(files)) " Only .txt files ! let files = readdir('Xreaddir', { x -> x =~ '.txt$' }) call assert_equal(['bar.txt', 'foo.txt'], sort(files)) " Only .txt files with string ! let files = readdir('Xreaddir', 'v:val =~ ".txt$"') call assert_equal(['bar.txt', 'foo.txt'], sort(files)) " Limit to 1 result. let l = [] ! let files = readdir('Xreaddir', {x -> len(add(l, x)) == 2 ? -1 : 1}) call assert_equal(1, len(files)) " Nested readdir() must not crash ! let files = readdir('Xreaddir', 'readdir("Xreaddir", "1") != []') call sort(files)->assert_equal(['bar.txt', 'dir', 'foo.txt']) ! eval 'Xreaddir'->delete('rf') endfunc func Test_readdirex() ! call mkdir('Xexdir') ! call writefile(['foo'], 'Xexdir/foo.txt') ! call writefile(['barbar'], 'Xexdir/bar.txt') ! call mkdir('Xexdir/dir') " All results ! let files = readdirex('Xexdir')->map({-> v:val.name}) call assert_equal(['bar.txt', 'dir', 'foo.txt'], sort(files)) ! let sizes = readdirex('Xexdir')->map({-> v:val.size}) call assert_equal([0, 4, 7], sort(sizes)) " Only results containing "f" ! let files = 'Xexdir'->readdirex({ e -> stridx(e.name, 'f') != -1 }) \ ->map({-> v:val.name}) call assert_equal(['foo.txt'], sort(files)) " Only .txt files ! let files = readdirex('Xexdir', { e -> e.name =~ '.txt$' }) \ ->map({-> v:val.name}) call assert_equal(['bar.txt', 'foo.txt'], sort(files)) " Only .txt files with string ! let files = readdirex('Xexdir', 'v:val.name =~ ".txt$"') \ ->map({-> v:val.name}) call assert_equal(['bar.txt', 'foo.txt'], sort(files)) " Limit to 1 result. let l = [] ! let files = readdirex('Xexdir', {e -> len(add(l, e.name)) == 2 ? -1 : 1}) \ ->map({-> v:val.name}) call assert_equal(1, len(files)) " Nested readdirex() must not crash ! let files = readdirex('Xexdir', 'readdirex("Xexdir", "1") != []') \ ->map({-> v:val.name}) call sort(files)->assert_equal(['bar.txt', 'dir', 'foo.txt']) " report broken link correctly if has("unix") ! call writefile([], 'Xexdir/abc.txt') ! call system("ln -s Xexdir/abc.txt Xexdir/link") ! call delete('Xexdir/abc.txt') ! let files = readdirex('Xexdir', 'readdirex("Xexdir", "1") != []') \ ->map({-> v:val.name .. '_' .. v:val.type}) call sort(files)->assert_equal( \ ['bar.txt_file', 'dir_dir', 'foo.txt_file', 'link_link']) endif ! eval 'Xexdir'->delete('rf') call assert_fails('call readdirex("doesnotexist")', 'E484:') endfunc *************** *** 2166,2199 **** throw 'Skipped: Test_readdirex_sort on systems that do not allow this using the default filesystem' endif let _collate = v:collate ! call mkdir('Xdir2') ! call writefile(['1'], 'Xdir2/README.txt') ! call writefile(['2'], 'Xdir2/Readme.txt') ! call writefile(['3'], 'Xdir2/readme.txt') " 1) default ! let files = readdirex('Xdir2')->map({-> v:val.name}) let default = copy(files) call assert_equal(['README.txt', 'Readme.txt', 'readme.txt'], files, 'sort using default') " 2) no sorting ! let files = readdirex('Xdir2', 1, #{sort: 'none'})->map({-> v:val.name}) let unsorted = copy(files) call assert_equal(['README.txt', 'Readme.txt', 'readme.txt'], sort(files), 'unsorted') ! call assert_fails("call readdirex('Xdir2', 1, #{slort: 'none'})", 'E857: Dictionary key "sort" required') " 3) sort by case (same as default) ! let files = readdirex('Xdir2', 1, #{sort: 'case'})->map({-> v:val.name}) call assert_equal(default, files, 'sort by case') " 4) sort by ignoring case ! let files = readdirex('Xdir2', 1, #{sort: 'icase'})->map({-> v:val.name}) call assert_equal(unsorted->sort('i'), files, 'sort by icase') " 5) Default Collation let collate = v:collate lang collate C ! let files = readdirex('Xdir2', 1, #{sort: 'collate'})->map({-> v:val.name}) call assert_equal(['README.txt', 'Readme.txt', 'readme.txt'], files, 'sort by C collation') " 6) Collation de_DE --- 2165,2198 ---- throw 'Skipped: Test_readdirex_sort on systems that do not allow this using the default filesystem' endif let _collate = v:collate ! call mkdir('Xsortdir2') ! call writefile(['1'], 'Xsortdir2/README.txt') ! call writefile(['2'], 'Xsortdir2/Readme.txt') ! call writefile(['3'], 'Xsortdir2/readme.txt') " 1) default ! let files = readdirex('Xsortdir2')->map({-> v:val.name}) let default = copy(files) call assert_equal(['README.txt', 'Readme.txt', 'readme.txt'], files, 'sort using default') " 2) no sorting ! let files = readdirex('Xsortdir2', 1, #{sort: 'none'})->map({-> v:val.name}) let unsorted = copy(files) call assert_equal(['README.txt', 'Readme.txt', 'readme.txt'], sort(files), 'unsorted') ! call assert_fails("call readdirex('Xsortdir2', 1, #{slort: 'none'})", 'E857: Dictionary key "sort" required') " 3) sort by case (same as default) ! let files = readdirex('Xsortdir2', 1, #{sort: 'case'})->map({-> v:val.name}) call assert_equal(default, files, 'sort by case') " 4) sort by ignoring case ! let files = readdirex('Xsortdir2', 1, #{sort: 'icase'})->map({-> v:val.name}) call assert_equal(unsorted->sort('i'), files, 'sort by icase') " 5) Default Collation let collate = v:collate lang collate C ! let files = readdirex('Xsortdir2', 1, #{sort: 'collate'})->map({-> v:val.name}) call assert_equal(['README.txt', 'Readme.txt', 'readme.txt'], files, 'sort by C collation') " 6) Collation de_DE *************** *** 2201,2220 **** " available try lang collate de_DE ! let files = readdirex('Xdir2', 1, #{sort: 'collate'})->map({-> v:val.name}) call assert_equal(['readme.txt', 'Readme.txt', 'README.txt'], files, 'sort by de_DE collation') catch throw 'Skipped: de_DE collation is not available' finally exe 'lang collate' collate ! eval 'Xdir2'->delete('rf') endtry endfunc func Test_readdir_sort() " some more cases for testing sorting for readdirex ! let dir = 'Xdir3' call mkdir(dir) call writefile(['1'], dir .. '/README.txt') call writefile(['2'], dir .. '/Readm.txt') --- 2200,2219 ---- " available try lang collate de_DE ! let files = readdirex('Xsortdir2', 1, #{sort: 'collate'})->map({-> v:val.name}) call assert_equal(['readme.txt', 'Readme.txt', 'README.txt'], files, 'sort by de_DE collation') catch throw 'Skipped: de_DE collation is not available' finally exe 'lang collate' collate ! eval 'Xsortdir2'->delete('rf') endtry endfunc func Test_readdir_sort() " some more cases for testing sorting for readdirex ! let dir = 'Xsortdir3' call mkdir(dir) call writefile(['1'], dir .. '/README.txt') call writefile(['2'], dir .. '/Readm.txt') *************** *** 2259,2284 **** endfunc func Test_delete_rf() ! call mkdir('Xdir') ! call writefile([], 'Xdir/foo.txt') ! call writefile([], 'Xdir/bar.txt') ! call mkdir('Xdir/[a-1]') " issue #696 ! call writefile([], 'Xdir/[a-1]/foo.txt') ! call writefile([], 'Xdir/[a-1]/bar.txt') ! call assert_true(filereadable('Xdir/foo.txt')) ! call assert_true('Xdir/[a-1]/foo.txt'->filereadable()) ! ! call assert_equal(0, delete('Xdir', 'rf')) ! call assert_false(filereadable('Xdir/foo.txt')) ! call assert_false(filereadable('Xdir/[a-1]/foo.txt')) if has('unix') ! call mkdir('Xdir/Xdir2', 'p') ! silent !chmod 555 Xdir ! call assert_equal(-1, delete('Xdir/Xdir2', 'rf')) ! call assert_equal(-1, delete('Xdir', 'rf')) ! silent !chmod 755 Xdir ! call assert_equal(0, delete('Xdir', 'rf')) endif endfunc --- 2258,2283 ---- endfunc func Test_delete_rf() ! call mkdir('Xrfdir') ! call writefile([], 'Xrfdir/foo.txt') ! call writefile([], 'Xrfdir/bar.txt') ! call mkdir('Xrfdir/[a-1]') " issue #696 ! call writefile([], 'Xrfdir/[a-1]/foo.txt') ! call writefile([], 'Xrfdir/[a-1]/bar.txt') ! call assert_true(filereadable('Xrfdir/foo.txt')) ! call assert_true('Xrfdir/[a-1]/foo.txt'->filereadable()) ! ! call assert_equal(0, delete('Xrfdir', 'rf')) ! call assert_false(filereadable('Xrfdir/foo.txt')) ! call assert_false(filereadable('Xrfdir/[a-1]/foo.txt')) if has('unix') ! call mkdir('Xrfdir/Xdir2', 'p') ! silent !chmod 555 Xrfdir ! call assert_equal(-1, delete('Xrfdir/Xdir2', 'rf')) ! call assert_equal(-1, delete('Xrfdir', 'rf')) ! silent !chmod 755 Xrfdir ! call assert_equal(0, delete('Xrfdir', 'rf')) endif endfunc *** ../vim-9.0.0322/src/testdir/test_getcwd.vim 2020-08-12 17:43:41.000000000 +0100 --- src/testdir/test_getcwd.vim 2022-08-29 21:31:48.196875701 +0100 *************** *** 40,48 **** eval 'Xtopdir'->mkdir() cd Xtopdir let g:topdir = getcwd() ! call mkdir('Xdir1') ! call mkdir('Xdir2') ! call mkdir('Xdir3') endfunction let g:cwd=getcwd() --- 40,48 ---- eval 'Xtopdir'->mkdir() cd Xtopdir let g:topdir = getcwd() ! call mkdir('Xcwdir1') ! call mkdir('Xcwdir2') ! call mkdir('Xcwdir3') endfunction let g:cwd=getcwd() *************** *** 57,79 **** new b new c 3wincmd w ! lcd Xdir1 ! call assert_equal("a Xdir1 1", GetCwdInfo(0, 0)) call assert_equal(g:topdir, getcwd(-1)) wincmd W call assert_equal("b Xtopdir 0", GetCwdInfo(0, 0)) call assert_equal(g:topdir, getcwd(-1)) wincmd W ! lcd Xdir3 ! call assert_equal("c Xdir3 1", GetCwdInfo(0, 0)) ! call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), 0)) call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), 0)) ! call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), 0)) call assert_equal(g:topdir, getcwd(-1)) wincmd W ! call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), tabpagenr())) call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), tabpagenr())) ! call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), tabpagenr())) call assert_equal(g:topdir, getcwd(-1)) tabnew x --- 57,79 ---- new b new c 3wincmd w ! lcd Xcwdir1 ! call assert_equal("a Xcwdir1 1", GetCwdInfo(0, 0)) call assert_equal(g:topdir, getcwd(-1)) wincmd W call assert_equal("b Xtopdir 0", GetCwdInfo(0, 0)) call assert_equal(g:topdir, getcwd(-1)) wincmd W ! lcd Xcwdir3 ! call assert_equal("c Xcwdir3 1", GetCwdInfo(0, 0)) ! call assert_equal("a Xcwdir1 1", GetCwdInfo(bufwinnr("a"), 0)) call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), 0)) ! call assert_equal("c Xcwdir3 1", GetCwdInfo(bufwinnr("c"), 0)) call assert_equal(g:topdir, getcwd(-1)) wincmd W ! call assert_equal("a Xcwdir1 1", GetCwdInfo(bufwinnr("a"), tabpagenr())) call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), tabpagenr())) ! call assert_equal("c Xcwdir3 1", GetCwdInfo(bufwinnr("c"), tabpagenr())) call assert_equal(g:topdir, getcwd(-1)) tabnew x *************** *** 83,103 **** call assert_equal("x Xtopdir 0", GetCwdInfo(0, 0)) call assert_equal(g:topdir, getcwd(-1)) wincmd W ! lcd Xdir2 ! call assert_equal("y Xdir2 1", GetCwdInfo(0, 0)) call assert_equal(g:topdir, getcwd(-1)) wincmd W ! lcd Xdir3 ! call assert_equal("z Xdir3 1", GetCwdInfo(0, 0)) call assert_equal("x Xtopdir 0", GetCwdInfo(bufwinnr("x"), 0)) ! call assert_equal("y Xdir2 1", GetCwdInfo(bufwinnr("y"), 0)) ! call assert_equal("z Xdir3 1", GetCwdInfo(bufwinnr("z"), 0)) call assert_equal(g:topdir, getcwd(-1)) let tp_nr = tabpagenr() tabrewind call assert_equal("x Xtopdir 0", GetCwdInfo(3, tp_nr)) ! call assert_equal("y Xdir2 1", GetCwdInfo(2, tp_nr)) ! call assert_equal("z Xdir3 1", GetCwdInfo(1, tp_nr)) call assert_equal(g:topdir, getcwd(-1)) " Non existing windows and tab pages call assert_equal('', getcwd(100)) --- 83,103 ---- call assert_equal("x Xtopdir 0", GetCwdInfo(0, 0)) call assert_equal(g:topdir, getcwd(-1)) wincmd W ! lcd Xcwdir2 ! call assert_equal("y Xcwdir2 1", GetCwdInfo(0, 0)) call assert_equal(g:topdir, getcwd(-1)) wincmd W ! lcd Xcwdir3 ! call assert_equal("z Xcwdir3 1", GetCwdInfo(0, 0)) call assert_equal("x Xtopdir 0", GetCwdInfo(bufwinnr("x"), 0)) ! call assert_equal("y Xcwdir2 1", GetCwdInfo(bufwinnr("y"), 0)) ! call assert_equal("z Xcwdir3 1", GetCwdInfo(bufwinnr("z"), 0)) call assert_equal(g:topdir, getcwd(-1)) let tp_nr = tabpagenr() tabrewind call assert_equal("x Xtopdir 0", GetCwdInfo(3, tp_nr)) ! call assert_equal("y Xcwdir2 1", GetCwdInfo(2, tp_nr)) ! call assert_equal("z Xcwdir3 1", GetCwdInfo(1, tp_nr)) call assert_equal(g:topdir, getcwd(-1)) " Non existing windows and tab pages call assert_equal('', getcwd(100)) *************** *** 241,264 **** " Change the global directory for the first tab page tabrewind | 1wincmd w ! cd ../Xdir1 ! call assert_equal("a Xdir1 0", GetCwdInfo(1, 1)) ! call assert_equal("b Xdir1 0", GetCwdInfo(2, 1)) call assert_equal("m Xtabdir1 2", GetCwdInfo(1, 2)) call assert_equal("n Xwindir2 1", GetCwdInfo(2, 2)) " Change the global directory for the second tab page tabnext | 1wincmd w ! cd ../Xdir3 ! call assert_equal("m Xdir3 0", GetCwdInfo(1, 2)) call assert_equal("n Xwindir2 1", GetCwdInfo(2, 2)) ! call assert_equal("o Xdir3 0", GetCwdInfo(3, 2)) " Change the tab-local directory for the third tab page tabnext | 1wincmd w ! cd ../Xdir1 ! call assert_equal("x Xdir1 0", GetCwdInfo(1, 3)) ! call assert_equal("y Xdir1 0", GetCwdInfo(2, 3)) call assert_equal("z Xwindir3 1", GetCwdInfo(3, 3)) enew | only | tabonly --- 241,264 ---- " Change the global directory for the first tab page tabrewind | 1wincmd w ! cd ../Xcwdir1 ! call assert_equal("a Xcwdir1 0", GetCwdInfo(1, 1)) ! call assert_equal("b Xcwdir1 0", GetCwdInfo(2, 1)) call assert_equal("m Xtabdir1 2", GetCwdInfo(1, 2)) call assert_equal("n Xwindir2 1", GetCwdInfo(2, 2)) " Change the global directory for the second tab page tabnext | 1wincmd w ! cd ../Xcwdir3 ! call assert_equal("m Xcwdir3 0", GetCwdInfo(1, 2)) call assert_equal("n Xwindir2 1", GetCwdInfo(2, 2)) ! call assert_equal("o Xcwdir3 0", GetCwdInfo(3, 2)) " Change the tab-local directory for the third tab page tabnext | 1wincmd w ! cd ../Xcwdir1 ! call assert_equal("x Xcwdir1 0", GetCwdInfo(1, 3)) ! call assert_equal("y Xcwdir1 0", GetCwdInfo(2, 3)) call assert_equal("z Xwindir3 1", GetCwdInfo(3, 3)) enew | only | tabonly *** ../vim-9.0.0322/src/testdir/test_gui.vim 2022-08-28 13:38:40.145369135 +0100 --- src/testdir/test_gui.vim 2022-08-29 21:35:45.233017506 +0100 *************** *** 1400,1435 **** %argdelete " pressing shift when dropping files should change directory let save_cwd = getcwd() ! call mkdir('Xdir1') ! call writefile([], 'Xdir1/Xfile1') ! call writefile([], 'Xdir1/Xfile2') ! let d = #{files: ['Xdir1/Xfile1', 'Xdir1/Xfile2'], row: 1, col: 1, \ modifiers: 0x4} call test_gui_event('dropfiles', d) ! call assert_equal('Xdir1', fnamemodify(getcwd(), ':t')) call assert_equal('Xfile1', @%) call chdir(save_cwd) " pressing shift when dropping directory and files should change directory ! let d = #{files: ['Xdir1', 'Xdir1/Xfile2'], row: 1, col: 1, modifiers: 0x4} call test_gui_event('dropfiles', d) ! call assert_equal('Xdir1', fnamemodify(getcwd(), ':t')) ! call assert_equal('Xdir1', fnamemodify(@%, ':t')) call chdir(save_cwd) %bw! %argdelete " dropping a directory should edit it ! let d = #{files: ['Xdir1'], row: 1, col: 1, modifiers: 0} call test_gui_event('dropfiles', d) ! call assert_equal('Xdir1', @%) %bw! %argdelete " dropping only a directory name with Shift should ignore it ! let d = #{files: ['Xdir1'], row: 1, col: 1, modifiers: 0x4} call test_gui_event('dropfiles', d) call assert_equal('', @%) %bw! %argdelete ! call delete('Xdir1', 'rf') " drop files in the command line. The GUI drop files adds the file names to " the low level input buffer. So need to use a cmdline map and feedkeys() --- 1400,1435 ---- %argdelete " pressing shift when dropping files should change directory let save_cwd = getcwd() ! call mkdir('Xdropdir1') ! call writefile([], 'Xdropdir1/Xfile1') ! call writefile([], 'Xdropdir1/Xfile2') ! let d = #{files: ['Xdropdir1/Xfile1', 'Xdropdir1/Xfile2'], row: 1, col: 1, \ modifiers: 0x4} call test_gui_event('dropfiles', d) ! call assert_equal('Xdropdir1', fnamemodify(getcwd(), ':t')) call assert_equal('Xfile1', @%) call chdir(save_cwd) " pressing shift when dropping directory and files should change directory ! let d = #{files: ['Xdropdir1', 'Xdropdir1/Xfile2'], row: 1, col: 1, modifiers: 0x4} call test_gui_event('dropfiles', d) ! call assert_equal('Xdropdir1', fnamemodify(getcwd(), ':t')) ! call assert_equal('Xdropdir1', fnamemodify(@%, ':t')) call chdir(save_cwd) %bw! %argdelete " dropping a directory should edit it ! let d = #{files: ['Xdropdir1'], row: 1, col: 1, modifiers: 0} call test_gui_event('dropfiles', d) ! call assert_equal('Xdropdir1', @%) %bw! %argdelete " dropping only a directory name with Shift should ignore it ! let d = #{files: ['Xdropdir1'], row: 1, col: 1, modifiers: 0x4} call test_gui_event('dropfiles', d) call assert_equal('', @%) %bw! %argdelete ! call delete('Xdropdir1', 'rf') " drop files in the command line. The GUI drop files adds the file names to " the low level input buffer. So need to use a cmdline map and feedkeys() *** ../vim-9.0.0322/src/testdir/test_help.vim 2022-07-30 12:03:12.839558828 +0100 --- src/testdir/test_help.vim 2022-08-29 21:38:40.245082778 +0100 *************** *** 129,158 **** " Test for the :helptags command " NOTE: if you run tests as root this will fail. Don't run tests as root! func Test_helptag_cmd() ! call mkdir('Xdir/a/doc', 'p') " No help file to process in the directory ! call assert_fails('helptags Xdir', 'E151:') ! call writefile([], 'Xdir/a/doc/sample.txt') " Test for ++t argument ! helptags ++t Xdir ! call assert_equal(["help-tags\ttags\t1"], readfile('Xdir/tags')) ! call delete('Xdir/tags') " Test parsing tags call writefile(['*tag1*', 'Example: >', ' *notag*', 'Example end: *tag2*'], ! \ 'Xdir/a/doc/sample.txt') ! helptags Xdir call assert_equal(["tag1\ta/doc/sample.txt\t/*tag1*", ! \ "tag2\ta/doc/sample.txt\t/*tag2*"], readfile('Xdir/tags')) " Duplicate tags in the help file ! call writefile(['*tag1*', '*tag1*', '*tag2*'], 'Xdir/a/doc/sample.txt') ! call assert_fails('helptags Xdir', 'E154:') ! call delete('Xdir', 'rf') endfunc func Test_helptag_cmd_readonly() --- 129,158 ---- " Test for the :helptags command " NOTE: if you run tests as root this will fail. Don't run tests as root! func Test_helptag_cmd() ! call mkdir('Xtagdir/a/doc', 'p') " No help file to process in the directory ! call assert_fails('helptags Xtagdir', 'E151:') ! call writefile([], 'Xtagdir/a/doc/sample.txt') " Test for ++t argument ! helptags ++t Xtagdir ! call assert_equal(["help-tags\ttags\t1"], readfile('Xtagdir/tags')) ! call delete('Xtagdir/tags') " Test parsing tags call writefile(['*tag1*', 'Example: >', ' *notag*', 'Example end: *tag2*'], ! \ 'Xtagdir/a/doc/sample.txt') ! helptags Xtagdir call assert_equal(["tag1\ta/doc/sample.txt\t/*tag1*", ! \ "tag2\ta/doc/sample.txt\t/*tag2*"], readfile('Xtagdir/tags')) " Duplicate tags in the help file ! call writefile(['*tag1*', '*tag1*', '*tag2*'], 'Xtagdir/a/doc/sample.txt') ! call assert_fails('helptags Xtagdir', 'E154:') ! call delete('Xtagdir', 'rf') endfunc func Test_helptag_cmd_readonly() *************** *** 160,184 **** CheckNotRoot " Read-only tags file ! call mkdir('Xdir/doc', 'p') ! call writefile([''], 'Xdir/doc/tags') ! call writefile([], 'Xdir/doc/sample.txt') ! call setfperm('Xdir/doc/tags', 'r-xr--r--') ! call assert_fails('helptags Xdir/doc', 'E152:', getfperm('Xdir/doc/tags')) let rtp = &rtp ! let &rtp = 'Xdir' helptags ALL let &rtp = rtp ! call delete('Xdir/doc/tags') " No permission to read the help file ! call mkdir('Xdir/b/doc', 'p') ! call writefile([], 'Xdir/b/doc/sample.txt') ! call setfperm('Xdir/b/doc/sample.txt', '-w-------') ! call assert_fails('helptags Xdir', 'E153:', getfperm('Xdir/b/doc/sample.txt')) ! call delete('Xdir', 'rf') endfunc " Test for setting the 'helpheight' option in the help window --- 160,184 ---- CheckNotRoot " Read-only tags file ! call mkdir('Xrodir/doc', 'p') ! call writefile([''], 'Xrodir/doc/tags') ! call writefile([], 'Xrodir/doc/sample.txt') ! call setfperm('Xrodir/doc/tags', 'r-xr--r--') ! call assert_fails('helptags Xrodir/doc', 'E152:', getfperm('Xrodir/doc/tags')) let rtp = &rtp ! let &rtp = 'Xrodir' helptags ALL let &rtp = rtp ! call delete('Xrodir/doc/tags') " No permission to read the help file ! call mkdir('Xrodir/b/doc', 'p') ! call writefile([], 'Xrodir/b/doc/sample.txt') ! call setfperm('Xrodir/b/doc/sample.txt', '-w-------') ! call assert_fails('helptags Xrodir', 'E153:', getfperm('Xrodir/b/doc/sample.txt')) ! call delete('Xrodir', 'rf') endfunc " Test for setting the 'helpheight' option in the help window *** ../vim-9.0.0322/src/testdir/test_ins_complete.vim 2022-07-31 11:37:16.451058499 +0100 --- src/testdir/test_ins_complete.vim 2022-08-29 21:47:11.421168120 +0100 *************** *** 9,16 **** edit test_ins_complete.vim " The files in the current directory interferes with the files " used by this test. So use a separate directory for the test. ! call mkdir('Xdir') ! cd Xdir set ff=unix call writefile(["test11\t36Gepeto\t/Tag/", --- 9,16 ---- edit test_ins_complete.vim " The files in the current directory interferes with the files " used by this test. So use a separate directory for the test. ! call mkdir('Xcpldir') ! cd Xcpldir set ff=unix call writefile(["test11\t36Gepeto\t/Tag/", *************** *** 105,111 **** call delete('Xtestdata') set cpt& cot& def& tags& tagbsearch& hidden& cd .. ! call delete('Xdir', 'rf') endfunc func Test_ins_complete_invalid_byte() --- 105,111 ---- call delete('Xtestdata') set cpt& cot& def& tags& tagbsearch& hidden& cd .. ! call delete('Xcpldir', 'rf') endfunc func Test_ins_complete_invalid_byte() *************** *** 433,439 **** func Test_ins_completeslash() CheckMSWindows ! call mkdir('Xdir') let orig_shellslash = &shellslash set cpt& new --- 433,439 ---- func Test_ins_completeslash() CheckMSWindows ! call mkdir('Xcpldir') let orig_shellslash = &shellslash set cpt& new *************** *** 442,472 **** set completeslash= exe "normal oXd\\" ! call assert_equal('Xdir\', getline('.')) set completeslash=backslash exe "normal oXd\\" ! call assert_equal('Xdir\', getline('.')) set completeslash=slash exe "normal oXd\\" ! call assert_equal('Xdir/', getline('.')) set shellslash set completeslash= exe "normal oXd\\" ! call assert_equal('Xdir/', getline('.')) set completeslash=backslash exe "normal oXd\\" ! call assert_equal('Xdir\', getline('.')) set completeslash=slash exe "normal oXd\\" ! call assert_equal('Xdir/', getline('.')) %bw! ! call delete('Xdir', 'rf') set noshellslash set completeslash=slash --- 442,472 ---- set completeslash= exe "normal oXd\\" ! call assert_equal('Xcpldir\', getline('.')) set completeslash=backslash exe "normal oXd\\" ! call assert_equal('Xcpldir\', getline('.')) set completeslash=slash exe "normal oXd\\" ! call assert_equal('Xcpldir/', getline('.')) set shellslash set completeslash= exe "normal oXd\\" ! call assert_equal('Xcpldir/', getline('.')) set completeslash=backslash exe "normal oXd\\" ! call assert_equal('Xcpldir\', getline('.')) set completeslash=slash exe "normal oXd\\" ! call assert_equal('Xcpldir/', getline('.')) %bw! ! call delete('Xcpldir', 'rf') set noshellslash set completeslash=slash *** ../vim-9.0.0322/src/testdir/test_packadd.vim 2022-01-31 17:24:22.000000000 +0000 --- src/testdir/test_packadd.vim 2022-08-29 21:49:36.129175420 +0100 *************** *** 3,9 **** source check.vim func SetUp() ! let s:topdir = getcwd() . '/Xdir' exe 'set packpath=' . s:topdir let s:plugdir = s:topdir . '/pack/mine/opt/mytest' endfunc --- 3,9 ---- source check.vim func SetUp() ! let s:topdir = getcwd() . '/Xppdir' exe 'set packpath=' . s:topdir let s:plugdir = s:topdir . '/pack/mine/opt/mytest' endfunc *************** *** 51,59 **** call assert_equal(77, g:plugin_also_works) call assert_equal(17, g:ftdetect_works) call assert_true(len(&rtp) > len(rtp)) ! call assert_match('/testdir/Xdir/pack/mine/opt/mytest\($\|,\)', &rtp) ! let new_after = match(&rtp, '/testdir/Xdir/pack/mine/opt/mytest/after,') let forwarded = substitute(first_after_entry, '\\', '[/\\\\]', 'g') let old_after = match(&rtp, ',' . forwarded . '\>') call assert_true(new_after > 0, 'rtp is ' . &rtp) --- 51,59 ---- call assert_equal(77, g:plugin_also_works) call assert_equal(17, g:ftdetect_works) call assert_true(len(&rtp) > len(rtp)) ! call assert_match('/testdir/Xppdir/pack/mine/opt/mytest\($\|,\)', &rtp) ! let new_after = match(&rtp, '/testdir/Xppdir/pack/mine/opt/mytest/after,') let forwarded = substitute(first_after_entry, '\\', '[/\\\\]', 'g') let old_after = match(&rtp, ',' . forwarded . '\>') call assert_true(new_after > 0, 'rtp is ' . &rtp) *************** *** 67,73 **** " Check the path of 'myte' is added call assert_true(len(&rtp) > len(rtp)) ! call assert_match('/testdir/Xdir/pack/mine/opt/myte\($\|,\)', &rtp) " Check exception call assert_fails("packadd directorynotfound", 'E919:') --- 67,73 ---- " Check the path of 'myte' is added call assert_true(len(&rtp) > len(rtp)) ! call assert_match('/testdir/Xppdir/pack/mine/opt/myte\($\|,\)', &rtp) " Check exception call assert_fails("packadd directorynotfound", 'E919:') *************** *** 89,95 **** call assert_equal(24, g:plugin_works) call assert_true(len(&rtp) > len(rtp)) ! call assert_match('/testdir/Xdir/pack/mine/start/other\($\|,\)', &rtp) endfunc func Test_packadd_noload() --- 89,95 ---- call assert_equal(24, g:plugin_works) call assert_true(len(&rtp) > len(rtp)) ! call assert_match('/testdir/Xppdir/pack/mine/start/other\($\|,\)', &rtp) endfunc func Test_packadd_noload() *************** *** 106,112 **** packadd! mytest call assert_true(len(&rtp) > len(rtp)) ! call assert_match('testdir/Xdir/pack/mine/opt/mytest\($\|,\)', &rtp) call assert_equal(0, g:plugin_works) " check the path is not added twice --- 106,112 ---- packadd! mytest call assert_true(len(&rtp) > len(rtp)) ! call assert_match('testdir/Xppdir/pack/mine/opt/mytest\($\|,\)', &rtp) call assert_equal(0, g:plugin_works) " check the path is not added twice *** ../vim-9.0.0322/src/testdir/test_quickfix.vim 2022-08-29 20:45:11.344535306 +0100 --- src/testdir/test_quickfix.vim 2022-08-29 21:50:22.325176785 +0100 *************** *** 4390,4396 **** autocmd BufRead * silent cd %:p:h augroup END ! 10Xvimgrep /vim/ Xdir/** let l = g:Xgetlist() call assert_equal('f1.txt', bufname(l[0].bufnr)) call assert_equal('f2.txt', fnamemodify(bufname(l[2].bufnr), ':t')) --- 4390,4396 ---- autocmd BufRead * silent cd %:p:h augroup END ! 10Xvimgrep /vim/ Xgrepdir/** let l = g:Xgetlist() call assert_equal('f1.txt', bufname(l[0].bufnr)) call assert_equal('f2.txt', fnamemodify(bufname(l[2].bufnr), ':t')) *************** *** 4403,4416 **** endfunc func Test_vimgrep_autocmd_cd() ! call mkdir('Xdir/a', 'p') ! call mkdir('Xdir/b', 'p') ! call writefile(['a_L1_vim', 'a_L2_vim'], 'Xdir/a/f1.txt') ! call writefile(['b_L1_vim', 'b_L2_vim'], 'Xdir/b/f2.txt') call Xvimgrep_autocmd_cd('c') call Xvimgrep_autocmd_cd('l') %bwipe ! call delete('Xdir', 'rf') endfunc " The following test used to crash Vim --- 4403,4416 ---- endfunc func Test_vimgrep_autocmd_cd() ! call mkdir('Xgrepdir/a', 'p') ! call mkdir('Xgrepdir/b', 'p') ! call writefile(['a_L1_vim', 'a_L2_vim'], 'Xgrepdir/a/f1.txt') ! call writefile(['b_L1_vim', 'b_L2_vim'], 'Xgrepdir/b/f2.txt') call Xvimgrep_autocmd_cd('c') call Xvimgrep_autocmd_cd('l') %bwipe ! call delete('Xgrepdir', 'rf') endfunc " The following test used to crash Vim *** ../vim-9.0.0322/src/testdir/test_startup.vim 2022-06-21 14:33:43.000000000 +0100 --- src/testdir/test_startup.vim 2022-08-29 21:51:33.565178118 +0100 *************** *** 1064,1076 **** call writefile(v:errors, 'Xtestout') qall [CODE] ! call mkdir('Xdir') ! call writefile(['let exrc_found=37'], 'Xdir/.exrc') ! call writefile(after, 'Xdir/Xafter') ! let cmd = GetVimProg() . ' --not-a-term -S Xafter --cmd "cd Xdir" --cmd "set enc=utf8 exrc secure"' exe "silent !" . cmd ! call assert_equal([], readfile('Xdir/Xtestout')) ! call delete('Xdir', 'rf') endfunc " Test for starting Vim with a non-terminal as input/output --- 1064,1076 ---- call writefile(v:errors, 'Xtestout') qall [CODE] ! call mkdir('Xrcdir') ! call writefile(['let exrc_found=37'], 'Xrcdir/.exrc') ! call writefile(after, 'Xrcdir/Xafter') ! let cmd = GetVimProg() . ' --not-a-term -S Xafter --cmd "cd Xrcdir" --cmd "set enc=utf8 exrc secure"' exe "silent !" . cmd ! call assert_equal([], readfile('Xrcdir/Xtestout')) ! call delete('Xrcdir', 'rf') endfunc " Test for starting Vim with a non-terminal as input/output *************** *** 1125,1134 **** " Test for failing to open the script output file. This test works only when " the language is English. if v:lang == "C" || v:lang =~ '^[Ee]n' ! call mkdir("Xdir") ! let m = system(GetVimCommand() .. " -w Xdir") ! call assert_equal("Cannot open for script output: \"Xdir\"\n", m) ! call delete("Xdir", 'rf') endif " A number argument sets the 'window' option --- 1125,1134 ---- " Test for failing to open the script output file. This test works only when " the language is English. if v:lang == "C" || v:lang =~ '^[Ee]n' ! call mkdir("Xargdir") ! let m = system(GetVimCommand() .. " -w Xargdir") ! call assert_equal("Cannot open for script output: \"Xargdir\"\n", m) ! call delete("Xargdir", 'rf') endif " A number argument sets the 'window' option *** ../vim-9.0.0322/src/testdir/test_terminal.vim 2022-06-15 17:49:55.000000000 +0100 --- src/testdir/test_terminal.vim 2022-08-29 21:53:45.513178475 +0100 *************** *** 630,641 **** CheckExecutable pwd let cmd = 'pwd' endif ! call mkdir('Xdir') ! let buf = term_start(cmd, {'cwd': 'Xdir'}) ! call WaitForAssert({-> assert_equal('Xdir', fnamemodify(getline(1), ":t"))}) exe buf . 'bwipe' ! call delete('Xdir', 'rf') endfunc func Test_terminal_cwd_failure() --- 630,641 ---- CheckExecutable pwd let cmd = 'pwd' endif ! call mkdir('Xtermdir') ! let buf = term_start(cmd, {'cwd': 'Xtermdir'}) ! call WaitForAssert({-> assert_equal('Xtermdir', fnamemodify(getline(1), ":t"))}) exe buf . 'bwipe' ! call delete('Xtermdir', 'rf') endfunc func Test_terminal_cwd_failure() *** ../vim-9.0.0322/src/testdir/test_vim9_disassemble.vim 2022-08-20 14:51:13.814510144 +0100 --- src/testdir/test_vim9_disassemble.vim 2022-08-29 21:54:33.153178038 +0100 *************** *** 315,328 **** enddef def Test_disassemble_push() ! mkdir('Xdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdir' var lines =<< trim END vim9script END ! writefile(lines, 'Xdir/autoload/autoscript.vim') lines =<< trim END vim9script --- 315,328 ---- enddef def Test_disassemble_push() ! mkdir('Xdisdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdisdir' var lines =<< trim END vim9script END ! writefile(lines, 'Xdisdir/autoload/autoscript.vim') lines =<< trim END vim9script *************** *** 342,348 **** END v9.CheckScriptSuccess(lines) ! delete('Xdir', 'rf') &rtp = save_rtp enddef --- 342,348 ---- END v9.CheckScriptSuccess(lines) ! delete('Xdisdir', 'rf') &rtp = save_rtp enddef *** ../vim-9.0.0322/src/testdir/test_vim9_func.vim 2022-08-20 14:51:13.814510144 +0100 --- src/testdir/test_vim9_func.vim 2022-08-29 22:16:56.985111281 +0100 *************** *** 41,47 **** enddef def TestCompilingErrorInTry() ! var dir = 'Xdir/autoload' mkdir(dir, 'p') var lines =<< trim END --- 41,47 ---- enddef def TestCompilingErrorInTry() ! var dir = 'Xcompdir/autoload' mkdir(dir, 'p') var lines =<< trim END *************** *** 61,67 **** catch /nothing/ endtry END ! lines[1] = 'set rtp=' .. getcwd() .. '/Xdir' writefile(lines, 'XTest_compile_error') var buf = g:RunVimInTerminal('-S XTest_compile_error', {rows: 10, wait_for_ruler: 0}) --- 61,67 ---- catch /nothing/ endtry END ! lines[1] = 'set rtp=' .. getcwd() .. '/Xcompdir' writefile(lines, 'XTest_compile_error') var buf = g:RunVimInTerminal('-S XTest_compile_error', {rows: 10, wait_for_ruler: 0}) *************** *** 71,77 **** # clean up g:StopVimInTerminal(buf) delete('XTest_compile_error') ! delete('Xdir', 'rf') enddef def Test_comment_error() --- 71,77 ---- # clean up g:StopVimInTerminal(buf) delete('XTest_compile_error') ! delete('Xcompdir', 'rf') enddef def Test_comment_error() *************** *** 170,176 **** enddef def Test_autoload_name_mismatch() ! var dir = 'Xdir/autoload' mkdir(dir, 'p') var lines =<< trim END --- 170,176 ---- enddef def Test_autoload_name_mismatch() ! var dir = 'Xnamedir/autoload' mkdir(dir, 'p') var lines =<< trim END *************** *** 183,200 **** writefile(lines, dir .. '/script.vim') var save_rtp = &rtp ! exe 'set rtp=' .. getcwd() .. '/Xdir' lines =<< trim END call script#Function() END v9.CheckScriptFailure(lines, 'E117:', 1) &rtp = save_rtp ! delete(dir, 'rf') enddef def Test_autoload_names() ! var dir = 'Xdir/autoload' mkdir(dir, 'p') var lines =<< trim END --- 183,200 ---- writefile(lines, dir .. '/script.vim') var save_rtp = &rtp ! exe 'set rtp=' .. getcwd() .. '/Xnamedir' lines =<< trim END call script#Function() END v9.CheckScriptFailure(lines, 'E117:', 1) &rtp = save_rtp ! delete('Xnamdir', 'rf') enddef def Test_autoload_names() ! var dir = 'Xandir/autoload' mkdir(dir, 'p') var lines =<< trim END *************** *** 206,212 **** writefile(lines, dir .. '/foobar.vim') var save_rtp = &rtp ! exe 'set rtp=' .. getcwd() .. '/Xdir' lines =<< trim END assert_equal('yes', foobar#function()) --- 206,212 ---- writefile(lines, dir .. '/foobar.vim') var save_rtp = &rtp ! exe 'set rtp=' .. getcwd() .. '/Xandir' lines =<< trim END assert_equal('yes', foobar#function()) *************** *** 218,228 **** v9.CheckDefAndScriptSuccess(lines) &rtp = save_rtp ! delete(dir, 'rf') enddef def Test_autoload_error_in_script() ! var dir = 'Xdir/autoload' mkdir(dir, 'p') var lines =<< trim END --- 218,228 ---- v9.CheckDefAndScriptSuccess(lines) &rtp = save_rtp ! delete('Xandir', 'rf') enddef def Test_autoload_error_in_script() ! var dir = 'Xaedir/autoload' mkdir(dir, 'p') var lines =<< trim END *************** *** 234,240 **** writefile(lines, dir .. '/scripterror.vim') var save_rtp = &rtp ! exe 'set rtp=' .. getcwd() .. '/Xdir' g:called_function = 'no' # The error in the autoload script cannot be checked with assert_fails(), use --- 234,240 ---- writefile(lines, dir .. '/scripterror.vim') var save_rtp = &rtp ! exe 'set rtp=' .. getcwd() .. '/Xaedir' g:called_function = 'no' # The error in the autoload script cannot be checked with assert_fails(), use *************** *** 264,270 **** assert_equal('yes', g:called_function) &rtp = save_rtp ! delete(dir, 'rf') enddef def s:CallRecursive(n: number): number --- 264,270 ---- assert_equal('yes', g:called_function) &rtp = save_rtp ! delete('Xaedir', 'rf') enddef def s:CallRecursive(n: number): number *** ../vim-9.0.0322/src/testdir/test_vim9_import.vim 2022-08-28 18:52:06.671888918 +0100 --- src/testdir/test_vim9_import.vim 2022-08-29 22:27:13.942199156 +0100 *************** *** 766,775 **** g:result = 49 enddef END ! mkdir('Xdir/autoload', 'p') ! writefile(lines, 'Xdir/autoload/XautoloadExport.vim') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdir' lines =<< trim END vim9script --- 766,775 ---- g:result = 49 enddef END ! mkdir('Ximpdir/autoload', 'p') ! writefile(lines, 'Ximpdir/autoload/XautoloadExport.vim') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Ximpdir' lines =<< trim END vim9script *************** *** 786,792 **** unlet g:result delete('Xmapscript.vim') nunmap ! delete('Xdir', 'rf') &rtp = save_rtp enddef --- 786,792 ---- unlet g:result delete('Xmapscript.vim') nunmap ! delete('Ximpdir', 'rf') &rtp = save_rtp enddef *************** *** 838,846 **** enddef def Test_use_autoload_import_in_insert_completion() ! mkdir('Xdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdir' var lines =<< trim END vim9script --- 838,846 ---- enddef def Test_use_autoload_import_in_insert_completion() ! mkdir('Xinsdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xinsdir' var lines =<< trim END vim9script *************** *** 857,863 **** enddef g:completion_loaded = 'yes' END ! writefile(lines, 'Xdir/autoload/completion.vim') new lines =<< trim END --- 857,863 ---- enddef g:completion_loaded = 'yes' END ! writefile(lines, 'Xinsdir/autoload/completion.vim') new lines =<< trim END *************** *** 874,895 **** set thesaurusfunc= bwipe! ! delete('Xdir', 'rf') &rtp = save_rtp enddef def Test_use_autoload_import_partial_in_opfunc() ! mkdir('Xdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdir' var lines =<< trim END vim9script ! export def Opfunc(..._) g:opfunc_called = 'yes' enddef END ! writefile(lines, 'Xdir/autoload/opfunc.vim') new lines =<< trim END --- 874,895 ---- set thesaurusfunc= bwipe! ! delete('Xinsdir', 'rf') &rtp = save_rtp enddef def Test_use_autoload_import_partial_in_opfunc() ! mkdir('Xpartdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xpartdir' var lines =<< trim END vim9script ! export def Opfunc1(..._) g:opfunc_called = 'yes' enddef END ! writefile(lines, 'Xpartdir/autoload/opfunc.vim') new lines =<< trim END *************** *** 897,903 **** import autoload 'opfunc.vim' nnoremap TheFunc() def TheFunc(): string ! &operatorfunc = function('opfunc.Opfunc', [0]) return 'g@' enddef feedkeys("\l", 'xt') --- 897,903 ---- import autoload 'opfunc.vim' nnoremap TheFunc() def TheFunc(): string ! &operatorfunc = function('opfunc.Opfunc1', [0]) return 'g@' enddef feedkeys("\l", 'xt') *************** *** 907,929 **** set opfunc= bwipe! ! delete('Xdir', 'rf') nunmap &rtp = save_rtp enddef def Test_set_opfunc_to_autoload_func_directly() ! mkdir('Xdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdir' var lines =<< trim END vim9script ! export def Opfunc(..._) g:opfunc_called = 'yes' enddef END ! writefile(lines, 'Xdir/autoload/opfunc.vim') new lines =<< trim END --- 907,929 ---- set opfunc= bwipe! ! delete('Xpartdir', 'rf') nunmap &rtp = save_rtp enddef def Test_set_opfunc_to_autoload_func_directly() ! mkdir('Xdirdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdirdir' var lines =<< trim END vim9script ! export def Opfunc2(..._) g:opfunc_called = 'yes' enddef END ! writefile(lines, 'Xdirdir/autoload/opfunc.vim') new lines =<< trim END *************** *** 931,937 **** import autoload 'opfunc.vim' nnoremap TheFunc() def TheFunc(): string ! &operatorfunc = opfunc.Opfunc return 'g@' enddef feedkeys("\l", 'xt') --- 931,937 ---- import autoload 'opfunc.vim' nnoremap TheFunc() def TheFunc(): string ! &operatorfunc = opfunc.Opfunc2 return 'g@' enddef feedkeys("\l", 'xt') *************** *** 941,955 **** set opfunc= bwipe! ! delete('Xdir', 'rf') nunmap &rtp = save_rtp enddef def Test_use_autoload_import_in_fold_expression() ! mkdir('Xdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdir' var lines =<< trim END vim9script --- 941,955 ---- set opfunc= bwipe! ! delete('Xdirdir', 'rf') nunmap &rtp = save_rtp enddef def Test_use_autoload_import_in_fold_expression() ! mkdir('Xfolddir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xfolddir' var lines =<< trim END vim9script *************** *** 961,967 **** enddef g:fold_loaded = 'yes' END ! writefile(lines, 'Xdir/autoload/fold.vim') lines =<< trim END vim9script --- 961,967 ---- enddef g:fold_loaded = 'yes' END ! writefile(lines, 'Xfolddir/autoload/fold.vim') lines =<< trim END vim9script *************** *** 985,991 **** set foldexpr= foldtext& foldmethod& debug= bwipe! ! delete('Xdir', 'rf') &rtp = save_rtp enddef --- 985,991 ---- set foldexpr= foldtext& foldmethod& debug= bwipe! ! delete('Xfolddir', 'rf') &rtp = save_rtp enddef *************** *** 1200,1206 **** END v9.CheckScriptFailure(lines, 'E484:') ! delete('Xdir', 'rf') enddef func Test_import_in_diffexpr() --- 1200,1206 ---- END v9.CheckScriptFailure(lines, 'E484:') ! delete('Xa.vim') enddef func Test_import_in_diffexpr() *************** *** 1455,1463 **** enddef def Test_export_shadows_global_function() ! mkdir('Xdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdir' var lines =<< trim END vim9script --- 1455,1463 ---- enddef def Test_export_shadows_global_function() ! mkdir('Xglobdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xglobdir' var lines =<< trim END vim9script *************** *** 1465,1471 **** return 'Shadow()' enddef END ! writefile(lines, 'Xdir/autoload/shadow.vim') lines =<< trim END vim9script --- 1465,1471 ---- return 'Shadow()' enddef END ! writefile(lines, 'Xglobdir/autoload/shadow.vim') lines =<< trim END vim9script *************** *** 1481,1487 **** delfunc g:Shadow bwipe! ! delete('Xdir', 'rf') &rtp = save_rtp enddef --- 1481,1487 ---- delfunc g:Shadow bwipe! ! delete('Xglobdir', 'rf') &rtp = save_rtp enddef *************** *** 2178,2187 **** enddef END ! mkdir('Xdir/autoload', 'p') ! writefile(lines, 'Xdir/autoload/some.vim') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdir' assert_equal('test', g:some#Gettest()) assert_equal('name', g:some#name) --- 2178,2187 ---- enddef END ! mkdir('Xfulldir/autoload', 'p') ! writefile(lines, 'Xfulldir/autoload/some.vim') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xfulldir' assert_equal('test', g:some#Gettest()) assert_equal('name', g:some#name) *************** *** 2198,2214 **** return 'other' enddef END ! writefile(lines, 'Xdir/autoload/Other.vim') assert_equal('other', g:Other#GetOther()) ! delete('Xdir', 'rf') &rtp = save_rtp enddef def Test_vim9script_autoload() ! mkdir('Xdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdir' # when the path has "/autoload/" prefix is not needed var lines =<< trim END --- 2198,2214 ---- return 'other' enddef END ! writefile(lines, 'Xfulldir/autoload/Other.vim') assert_equal('other', g:Other#GetOther()) ! delete('Xfulldir', 'rf') &rtp = save_rtp enddef def Test_vim9script_autoload() ! mkdir('Xaldir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xaldir' # when the path has "/autoload/" prefix is not needed var lines =<< trim END *************** *** 2232,2238 **** export final fname = 'final' export const cname = 'const' END ! writefile(lines, 'Xdir/autoload/prefixed.vim') g:prefixed_loaded = 0 g:expected_loaded = 0 --- 2232,2238 ---- export final fname = 'final' export const cname = 'const' END ! writefile(lines, 'Xaldir/autoload/prefixed.vim') g:prefixed_loaded = 0 g:expected_loaded = 0 *************** *** 2266,2279 **** unlet g:prefixed_loaded unlet g:expected_loaded ! delete('Xdir', 'rf') &rtp = save_rtp enddef def Test_import_autoload_not_exported() ! mkdir('Xdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdir' # error when using an item that is not exported from an autoload script var exportLines =<< trim END --- 2266,2279 ---- unlet g:prefixed_loaded unlet g:expected_loaded ! delete('Xaldir', 'rf') &rtp = save_rtp enddef def Test_import_autoload_not_exported() ! mkdir('Xnimdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xnimdir' # error when using an item that is not exported from an autoload script var exportLines =<< trim END *************** *** 2283,2289 **** echo 'nop' enddef END ! writefile(exportLines, 'Xdir/autoload/notExport1.vim') var lines =<< trim END vim9script --- 2283,2289 ---- echo 'nop' enddef END ! writefile(exportLines, 'Xnimdir/autoload/notExport1.vim') var lines =<< trim END vim9script *************** *** 2329,2335 **** # using a :def function we use a different autoload script every time so that # the function is compiled without the script loaded ! writefile(exportLines, 'Xdir/autoload/notExport2.vim') lines =<< trim END vim9script import autoload 'notExport2.vim' --- 2329,2335 ---- # using a :def function we use a different autoload script every time so that # the function is compiled without the script loaded ! writefile(exportLines, 'Xnimdir/autoload/notExport2.vim') lines =<< trim END vim9script import autoload 'notExport2.vim' *************** *** 2340,2346 **** END v9.CheckScriptFailure(lines, 'E1048: Item not found in script: notExport2#notFound') ! writefile(exportLines, 'Xdir/autoload/notExport3.vim') lines =<< trim END vim9script import autoload 'notExport3.vim' --- 2340,2346 ---- END v9.CheckScriptFailure(lines, 'E1048: Item not found in script: notExport2#notFound') ! writefile(exportLines, 'Xnimdir/autoload/notExport3.vim') lines =<< trim END vim9script import autoload 'notExport3.vim' *************** *** 2352,2358 **** # don't get E1049 because it is too complicated to figure out v9.CheckScriptFailure(lines, 'E1048: Item not found in script: notExport3#notExported') ! writefile(exportLines, 'Xdir/autoload/notExport4.vim') lines =<< trim END vim9script import autoload 'notExport4.vim' --- 2352,2358 ---- # don't get E1049 because it is too complicated to figure out v9.CheckScriptFailure(lines, 'E1048: Item not found in script: notExport3#notExported') ! writefile(exportLines, 'Xnimdir/autoload/notExport4.vim') lines =<< trim END vim9script import autoload 'notExport4.vim' *************** *** 2363,2369 **** END v9.CheckScriptFailure(lines, 'E117: Unknown function: notExport4#NotFunc') ! writefile(exportLines, 'Xdir/autoload/notExport5.vim') lines =<< trim END vim9script import autoload 'notExport5.vim' --- 2363,2369 ---- END v9.CheckScriptFailure(lines, 'E117: Unknown function: notExport4#NotFunc') ! writefile(exportLines, 'Xnimdir/autoload/notExport5.vim') lines =<< trim END vim9script import autoload 'notExport5.vim' *************** *** 2374,2380 **** END v9.CheckScriptFailure(lines, 'E117: Unknown function: notExport5#NotExport') ! writefile(exportLines, 'Xdir/autoload/notExport6.vim') lines =<< trim END vim9script import autoload 'notExport6.vim' --- 2374,2380 ---- END v9.CheckScriptFailure(lines, 'E117: Unknown function: notExport5#NotExport') ! writefile(exportLines, 'Xnimdir/autoload/notExport6.vim') lines =<< trim END vim9script import autoload 'notExport6.vim' *************** *** 2385,2391 **** END v9.CheckScriptFailure(lines, 'E117: Unknown function: notExport6#NotFunc') ! writefile(exportLines, 'Xdir/autoload/notExport7.vim') lines =<< trim END vim9script import autoload 'notExport7.vim' --- 2385,2391 ---- END v9.CheckScriptFailure(lines, 'E117: Unknown function: notExport6#NotFunc') ! writefile(exportLines, 'Xnimdir/autoload/notExport7.vim') lines =<< trim END vim9script import autoload 'notExport7.vim' *************** *** 2396,2409 **** END v9.CheckScriptFailure(lines, 'E117: Unknown function: notExport7#NotExport') ! delete('Xdir', 'rf') &rtp = save_rtp enddef def Test_vim9script_autoload_call() ! mkdir('Xdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdir' var lines =<< trim END vim9script --- 2396,2409 ---- END v9.CheckScriptFailure(lines, 'E117: Unknown function: notExport7#NotExport') ! delete('Xnimdir', 'rf') &rtp = save_rtp enddef def Test_vim9script_autoload_call() ! mkdir('Xcalldir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xcalldir' var lines =<< trim END vim9script *************** *** 2416,2422 **** g:result = 'other' enddef END ! writefile(lines, 'Xdir/autoload/another.vim') lines =<< trim END vim9script --- 2416,2422 ---- g:result = 'other' enddef END ! writefile(lines, 'Xcalldir/autoload/another.vim') lines =<< trim END vim9script *************** *** 2440,2453 **** v9.CheckScriptSuccess(lines) unlet g:result ! delete('Xdir', 'rf') &rtp = save_rtp enddef def Test_vim9script_noclear_autoload() ! mkdir('Xdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdir' var lines =<< trim END vim9script --- 2440,2453 ---- v9.CheckScriptSuccess(lines) unlet g:result ! delete('Xcalldir', 'rf') &rtp = save_rtp enddef def Test_vim9script_noclear_autoload() ! mkdir('Xnocdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xnocdir' var lines =<< trim END vim9script *************** *** 2456,2462 **** enddef g:double_loaded = 'yes' END ! writefile(lines, 'Xdir/autoload/double.vim') lines =<< trim END vim9script noclear --- 2456,2462 ---- enddef g:double_loaded = 'yes' END ! writefile(lines, 'Xnocdir/autoload/double.vim') lines =<< trim END vim9script noclear *************** *** 2482,2493 **** unlet g:double_loaded unlet g:script_loaded unlet g:result ! delete('Xdir', 'rf') &rtp = save_rtp enddef def Test_vim9script_autoload_duplicate() ! mkdir('Xdir/autoload', 'p') var lines =<< trim END vim9script --- 2482,2493 ---- unlet g:double_loaded unlet g:script_loaded unlet g:result ! delete('Xnocdir', 'rf') &rtp = save_rtp enddef def Test_vim9script_autoload_duplicate() ! mkdir('Xdupdir/autoload', 'p') var lines =<< trim END vim9script *************** *** 2498,2505 **** def Func() enddef END ! writefile(lines, 'Xdir/autoload/dupfunc.vim') ! assert_fails('source Xdir/autoload/dupfunc.vim', 'E1073:') lines =<< trim END vim9script --- 2498,2505 ---- def Func() enddef END ! writefile(lines, 'Xdupdir/autoload/dupfunc.vim') ! assert_fails('source Xdupdir/autoload/dupfunc.vim', 'E1073:') lines =<< trim END vim9script *************** *** 2510,2517 **** export def Func() enddef END ! writefile(lines, 'Xdir/autoload/dup2func.vim') ! assert_fails('source Xdir/autoload/dup2func.vim', 'E1073:') lines =<< trim END vim9script --- 2510,2517 ---- export def Func() enddef END ! writefile(lines, 'Xdupdir/autoload/dup2func.vim') ! assert_fails('source Xdupdir/autoload/dup2func.vim', 'E1073:') lines =<< trim END vim9script *************** *** 2521,2528 **** export var Func = 'asdf' END ! writefile(lines, 'Xdir/autoload/dup3func.vim') ! assert_fails('source Xdir/autoload/dup3func.vim', 'E1041: Redefining script item: "Func"') lines =<< trim END vim9script --- 2521,2528 ---- export var Func = 'asdf' END ! writefile(lines, 'Xdupdir/autoload/dup3func.vim') ! assert_fails('source Xdupdir/autoload/dup3func.vim', 'E1041: Redefining script item: "Func"') lines =<< trim END vim9script *************** *** 2532,2539 **** def Func() enddef END ! writefile(lines, 'Xdir/autoload/dup4func.vim') ! assert_fails('source Xdir/autoload/dup4func.vim', 'E707:') lines =<< trim END vim9script --- 2532,2539 ---- def Func() enddef END ! writefile(lines, 'Xdupdir/autoload/dup4func.vim') ! assert_fails('source Xdupdir/autoload/dup4func.vim', 'E707:') lines =<< trim END vim9script *************** *** 2543,2550 **** export def Func() enddef END ! writefile(lines, 'Xdir/autoload/dup5func.vim') ! assert_fails('source Xdir/autoload/dup5func.vim', 'E707:') lines =<< trim END vim9script --- 2543,2550 ---- export def Func() enddef END ! writefile(lines, 'Xdupdir/autoload/dup5func.vim') ! assert_fails('source Xdupdir/autoload/dup5func.vim', 'E707:') lines =<< trim END vim9script *************** *** 2554,2567 **** var Func = 'asdf' END ! writefile(lines, 'Xdir/autoload/dup6func.vim') ! assert_fails('source Xdir/autoload/dup6func.vim', 'E1041: Redefining script item: "Func"') ! delete('Xdir', 'rf') enddef def Test_autoload_missing_function_name() ! mkdir('Xdir/autoload', 'p') var lines =<< trim END vim9script --- 2554,2567 ---- var Func = 'asdf' END ! writefile(lines, 'Xdupdir/autoload/dup6func.vim') ! assert_fails('source Xdupdir/autoload/dup6func.vim', 'E1041: Redefining script item: "Func"') ! delete('Xdupdir', 'rf') enddef def Test_autoload_missing_function_name() ! mkdir('Xmisdir/autoload', 'p') var lines =<< trim END vim9script *************** *** 2569,2578 **** def loadme#() enddef END ! writefile(lines, 'Xdir/autoload/loadme.vim') ! assert_fails('source Xdir/autoload/loadme.vim', 'E129:') ! delete('Xdir', 'rf') enddef def Test_autoload_name_wrong() --- 2569,2578 ---- def loadme#() enddef END ! writefile(lines, 'Xmisdir/autoload/loadme.vim') ! assert_fails('source Xmisdir/autoload/loadme.vim', 'E129:') ! delete('Xmisdir', 'rf') enddef def Test_autoload_name_wrong() *************** *** 2584,2605 **** v9.CheckScriptFailure(lines, 'E746:') delete('Xscriptname.vim') ! mkdir('Xdir/autoload', 'p') lines =<< trim END vim9script def somescript#Func() enddef END ! writefile(lines, 'Xdir/autoload/somescript.vim') ! assert_fails('source Xdir/autoload/somescript.vim', 'E1263:') ! delete('Xdir', 'rf') enddef def Test_import_autoload_postponed() ! mkdir('Xdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdir' var lines =<< trim END vim9script --- 2584,2605 ---- v9.CheckScriptFailure(lines, 'E746:') delete('Xscriptname.vim') ! mkdir('Xwrodir/autoload', 'p') lines =<< trim END vim9script def somescript#Func() enddef END ! writefile(lines, 'Xwrodir/autoload/somescript.vim') ! assert_fails('source Xwrodir/autoload/somescript.vim', 'E1263:') ! delete('Xwrodir', 'rf') enddef def Test_import_autoload_postponed() ! mkdir('Xpostdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xpostdir' var lines =<< trim END vim9script *************** *** 2610,2616 **** return 'bla' enddef END ! writefile(lines, 'Xdir/autoload/postponed.vim') lines =<< trim END vim9script --- 2610,2616 ---- return 'bla' enddef END ! writefile(lines, 'Xpostdir/autoload/postponed.vim') lines =<< trim END vim9script *************** *** 2628,2641 **** assert_equal('true', g:loaded_postponed) unlet g:loaded_postponed ! delete('Xdir', 'rf') &rtp = save_rtp enddef def Test_import_autoload_override() ! mkdir('Xdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdir' test_override('autoload', 1) var lines =<< trim END --- 2628,2641 ---- assert_equal('true', g:loaded_postponed) unlet g:loaded_postponed ! delete('Xpostdir', 'rf') &rtp = save_rtp enddef def Test_import_autoload_override() ! mkdir('Xoverdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xoverdir' test_override('autoload', 1) var lines =<< trim END *************** *** 2647,2653 **** return 'bla' enddef END ! writefile(lines, 'Xdir/autoload/override.vim') lines =<< trim END vim9script --- 2647,2653 ---- return 'bla' enddef END ! writefile(lines, 'Xoverdir/autoload/override.vim') lines =<< trim END vim9script *************** *** 2664,2677 **** test_override('autoload', 0) unlet g:loaded_override ! delete('Xdir', 'rf') &rtp = save_rtp enddef def Test_autoload_mapping() ! mkdir('Xdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdir' var lines =<< trim END vim9script --- 2664,2677 ---- test_override('autoload', 0) unlet g:loaded_override ! delete('Xoverdir', 'rf') &rtp = save_rtp enddef def Test_autoload_mapping() ! mkdir('Xmapdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xmapdir' var lines =<< trim END vim9script *************** *** 2685,2691 **** g:doit_called = 'yes' enddef END ! writefile(lines, 'Xdir/autoload/toggle.vim') lines =<< trim END vim9script --- 2685,2691 ---- g:doit_called = 'yes' enddef END ! writefile(lines, 'Xmapdir/autoload/toggle.vim') lines =<< trim END vim9script *************** *** 2716,2722 **** nunmap yy unlet g:toggle_loaded unlet g:toggle_called ! delete('Xdir', 'rf') &rtp = save_rtp enddef --- 2716,2722 ---- nunmap yy unlet g:toggle_loaded unlet g:toggle_called ! delete('Xmapdir', 'rf') &rtp = save_rtp enddef *************** *** 2774,2782 **** " test disassembling an auto-loaded function starting with "debug" def Test_vim9_autoload_disass() ! mkdir('Xdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdir' var lines =<< trim END vim9script --- 2774,2782 ---- " test disassembling an auto-loaded function starting with "debug" def Test_vim9_autoload_disass() ! mkdir('Xdasdir/autoload', 'p') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdasdir' var lines =<< trim END vim9script *************** *** 2784,2790 **** return 'debug' enddef END ! writefile(lines, 'Xdir/autoload/debugit.vim') lines =<< trim END vim9script --- 2784,2790 ---- return 'debug' enddef END ! writefile(lines, 'Xdasdir/autoload/debugit.vim') lines =<< trim END vim9script *************** *** 2792,2798 **** return 'profile' enddef END ! writefile(lines, 'Xdir/autoload/profileit.vim') lines =<< trim END vim9script --- 2792,2798 ---- return 'profile' enddef END ! writefile(lines, 'Xdasdir/autoload/profileit.vim') lines =<< trim END vim9script *************** *** 2803,2809 **** END v9.CheckScriptSuccess(lines) ! delete('Xdir', 'rf') &rtp = save_rtp enddef --- 2803,2809 ---- END v9.CheckScriptSuccess(lines) ! delete('Xdasdir', 'rf') &rtp = save_rtp enddef *************** *** 2816,2825 **** enddef END ! mkdir('Xdir/autoload', 'p') ! writefile(lines, 'Xdir/autoload/foo.vim') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdir' augroup test autocmd TextYankPost * call foo#Test() augroup END --- 2816,2825 ---- enddef END ! mkdir('Xauldir/autoload', 'p') ! writefile(lines, 'Xauldir/autoload/foo.vim') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xauldir' augroup test autocmd TextYankPost * call foo#Test() augroup END *************** *** 2829,2835 **** augroup test autocmd! augroup END ! delete('Xdir', 'rf') &rtp = save_rtp enddef --- 2829,2835 ---- augroup test autocmd! augroup END ! delete('Xauldir', 'rf') &rtp = save_rtp enddef *************** *** 2842,2851 **** enddef END ! mkdir('Xdir/autoload', 'p') ! writefile(lines, 'Xdir/autoload/CaseSensitive.vim') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xdir' lines =<< trim END vim9script --- 2842,2851 ---- enddef END ! mkdir('Xcasedir/autoload', 'p') ! writefile(lines, 'Xcasedir/autoload/CaseSensitive.vim') var save_rtp = &rtp ! exe 'set rtp^=' .. getcwd() .. '/Xcasedir' lines =<< trim END vim9script *************** *** 2863,2869 **** v9.CheckScriptFailure(lines, 'E1262:') endif ! delete('Xdir', 'rf') &rtp = save_rtp enddef --- 2863,2869 ---- v9.CheckScriptFailure(lines, 'E1262:') endif ! delete('Xcasedir', 'rf') &rtp = save_rtp enddef *** ../vim-9.0.0322/src/testdir/test_vim9_script.vim 2022-08-20 14:51:13.814510144 +0100 --- src/testdir/test_vim9_script.vim 2022-08-29 22:01:11.161166132 +0100 *************** *** 3586,3598 **** export def Func() enddef END ! mkdir('Xdir/autoload', 'p') ! writefile(lines, 'Xdir/autoload/script.vim') lines =<< trim END vim9script set cpo+=M ! exe 'set rtp^=' .. getcwd() .. '/Xdir' au CmdlineEnter : ++once timer_start(0, (_) => script#Func()) setline(1, 'some text') END --- 3586,3598 ---- export def Func() enddef END ! mkdir('Xnordir/autoload', 'p') ! writefile(lines, 'Xnordir/autoload/script.vim') lines =<< trim END vim9script set cpo+=M ! exe 'set rtp^=' .. getcwd() .. '/Xnordir' au CmdlineEnter : ++once timer_start(0, (_) => script#Func()) setline(1, 'some text') END *************** *** 3605,3611 **** term_sendkeys(buf, "\u") g:StopVimInTerminal(buf) delete('XTest_redraw_cpo') ! delete('Xdir', 'rf') enddef func Test_reject_declaration() --- 3605,3611 ---- term_sendkeys(buf, "\u") g:StopVimInTerminal(buf) delete('XTest_redraw_cpo') ! delete('Xnordir', 'rf') enddef func Test_reject_declaration() *** ../vim-9.0.0322/src/testdir/test_viminfo.vim 2021-11-21 11:32:04.000000000 +0000 --- src/testdir/test_viminfo.vim 2022-08-29 22:01:26.885165436 +0100 *************** *** 962,971 **** call delete('Xviminfo') " Try to write the viminfo to a directory ! call mkdir('Xdir') ! call assert_fails('wviminfo Xdir', 'E137:') ! call assert_fails('rviminfo Xdir', 'E195:') ! call delete('Xdir', 'rf') endfunc " Test for writing to an existing viminfo file merges the file marks --- 962,971 ---- call delete('Xviminfo') " Try to write the viminfo to a directory ! call mkdir('Xvifdir') ! call assert_fails('wviminfo Xvifdir', 'E137:') ! call assert_fails('rviminfo Xvifdir', 'E195:') ! call delete('Xvifdir', 'rf') endfunc " Test for writing to an existing viminfo file merges the file marks *** ../vim-9.0.0322/src/testdir/test_writefile.vim 2022-03-14 19:16:37.000000000 +0000 --- src/testdir/test_writefile.vim 2022-08-29 22:02:10.641163402 +0100 *************** *** 251,259 **** " Try to overwrite a directory if has('unix') ! call mkdir('Xdir1') ! call assert_fails('write Xdir1', 'E17:') ! call delete('Xdir1', 'd') endif " Test for :wall for a buffer with no name --- 251,259 ---- " Try to overwrite a directory if has('unix') ! call mkdir('Xwerdir1') ! call assert_fails('write Xwerdir1', 'E17:') ! call delete('Xwerdir1', 'd') endif " Test for :wall for a buffer with no name *************** *** 479,498 **** " Root can do it too. CheckNotRoot ! call mkdir('Xdir/') ! call writefile(['one'], 'Xdir/Xfile1') ! call setfperm('Xdir', 'r-xr--r--') " try to create a new file in the directory ! new Xdir/Xfile2 call setline(1, 'two') call assert_fails('write', 'E212:') " try to create a backup file in the directory ! edit! Xdir/Xfile1 ! set backupdir=./Xdir backupskip= set patchmode=.orig call assert_fails('write', 'E509:') ! call setfperm('Xdir', 'rwxr--r--') ! call delete('Xdir', 'rf') set backupdir& backupskip& patchmode& endfunc --- 479,498 ---- " Root can do it too. CheckNotRoot ! call mkdir('Xrodir/') ! call writefile(['one'], 'Xrodir/Xfile1') ! call setfperm('Xrodir', 'r-xr--r--') " try to create a new file in the directory ! new Xrodir/Xfile2 call setline(1, 'two') call assert_fails('write', 'E212:') " try to create a backup file in the directory ! edit! Xrodir/Xfile1 ! set backupdir=./Xrodir backupskip= set patchmode=.orig call assert_fails('write', 'E509:') ! call setfperm('Xrodir', 'rwxr--r--') ! call delete('Xrodir', 'rf') set backupdir& backupskip& patchmode& endfunc *** ../vim-9.0.0322/src/version.c 2022-08-29 20:45:11.344535306 +0100 --- src/version.c 2022-08-29 22:28:18.817450606 +0100 *************** *** 709,710 **** --- 709,712 ---- { /* Add new patch number below this line */ + /**/ + 323, /**/ -- It might look like I'm doing nothing, but at the cellular level I'm really quite busy. /// 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 ///