Patch 9.0.0767

5 views
Skip to first unread message

Bram Moolenaar

unread,
Oct 15, 2022, 3:53:09 PM10/15/22
to vim...@googlegroups.com

Patch 9.0.0767
Problem: Too many delete() calls in tests.
Solution: Use deferred delete where possible.
Files: src/testdir/test_tabline.vim, src/testdir/test_tabpage.vim,
src/testdir/test_tagcase.vim, src/testdir/test_tagfunc.vim,
src/testdir/test_tagjump.vim, src/testdir/test_taglist.vim,
src/testdir/test_tcl.vim, src/testdir/test_termencoding.vim,
src/testdir/test_terminal.vim, src/testdir/test_terminal2.vim,
src/testdir/test_terminal3.vim, src/testdir/test_timers.vim,
src/testdir/test_trycatch.vim


*** ../vim-9.0.0766/src/testdir/test_tabline.vim 2022-08-24 19:27:41.648667087 +0100
--- src/testdir/test_tabline.vim 2022-10-15 20:21:06.946321191 +0100
***************
*** 154,163 ****
set mouse=a
exe "norm \<LeftMouse>"
END
! call writefile(lines, 'Xclickscript')
call RunVim([], [], "-e -s -S Xclickscript -c qa")
-
- call delete('Xclickscript')
endfunc


--- 154,161 ----
set mouse=a
exe "norm \<LeftMouse>"
END
! call writefile(lines, 'Xclickscript', 'D')
call RunVim([], [], "-e -s -S Xclickscript -c qa")
endfunc


*** ../vim-9.0.0766/src/testdir/test_tabpage.vim 2022-10-05 11:24:42.228494178 +0100
--- src/testdir/test_tabpage.vim 2022-10-15 20:21:26.930163796 +0100
***************
*** 606,618 ****
\ 'echo "hello\nthere"',
\ 'tabnext',
\ 'redraw',
! \ ], 'XTest_tabpage_cmdheight')
" Check that cursor line is concealed
let buf = RunVimInTerminal('-S XTest_tabpage_cmdheight', {'statusoff': 3})
call VerifyScreenDump(buf, 'Test_tabpage_cmdheight', {})

call StopVimInTerminal(buf)
- call delete('XTest_tabpage_cmdheight')
endfunc

" Test for closing the tab page from a command window
--- 606,617 ----
\ 'echo "hello\nthere"',
\ 'tabnext',
\ 'redraw',
! \ ], 'XTest_tabpage_cmdheight', 'D')
" Check that cursor line is concealed
let buf = RunVimInTerminal('-S XTest_tabpage_cmdheight', {'statusoff': 3})
call VerifyScreenDump(buf, 'Test_tabpage_cmdheight', {})

call StopVimInTerminal(buf)
endfunc

" Test for closing the tab page from a command window
*** ../vim-9.0.0766/src/testdir/test_tagcase.vim 2020-08-12 17:43:41.000000000 +0100
--- src/testdir/test_tagcase.vim 2022-10-15 20:22:04.169881372 +0100
***************
*** 1,7 ****
" test 'tagcase' option

func Test_tagcase()
! call writefile(["Bar\tXtext\t3", "Foo\tXtext\t2", "foo\tXtext\t4"], 'Xtags')
set tags=Xtags
e Xtext

--- 1,7 ----
" test 'tagcase' option

func Test_tagcase()
! call writefile(["Bar\tXtext\t3", "Foo\tXtext\t2", "foo\tXtext\t4"], 'Xtags', 'D')
set tags=Xtags
e Xtext

***************
*** 43,49 ****
endfor
endfor

- call delete('Xtags')
set tags&
set ic&
setg tc&
--- 43,48 ----
*** ../vim-9.0.0766/src/testdir/test_tagfunc.vim 2022-09-05 19:51:09.221360577 +0100
--- src/testdir/test_tagfunc.vim 2022-10-15 20:22:22.233749206 +0100
***************
*** 105,111 ****
return [{'name' : 'mytag', 'filename' : 'Xtest', 'cmd' : '1'}]
endfunc
set tagfunc=Mytagfunc1
! call writefile([''], 'Xtest')
call assert_fails('tag xyz', 'E986:')

func Mytagfunc2(pat, flags, info)
--- 105,111 ----
return [{'name' : 'mytag', 'filename' : 'Xtest', 'cmd' : '1'}]
endfunc
set tagfunc=Mytagfunc1
! call writefile([''], 'Xtest', 'D')
call assert_fails('tag xyz', 'E986:')

func Mytagfunc2(pat, flags, info)
***************
*** 115,121 ****
set tagfunc=Mytagfunc2
call assert_fails('tag xyz', 'E986:')

- call delete('Xtest')
set tagfunc&
delfunc Mytagfunc1
delfunc Mytagfunc2
--- 115,120 ----
*** ../vim-9.0.0766/src/testdir/test_tagjump.vim 2022-09-02 21:55:45.507049444 +0100
--- src/testdir/test_tagjump.vim 2022-10-15 20:35:15.025931366 +0100
***************
*** 20,27 ****
\ "one\tXptfile\t1",
\ "three\tXptfile\t3",
\ "two\tXptfile\t2"],
! \ 'Xpttags')
! call writefile(['one', 'two', 'three'], 'Xptfile')

%bw!
ptjump two
--- 20,27 ----
\ "one\tXptfile\t1",
\ "three\tXptfile\t3",
\ "two\tXptfile\t2"],
! \ 'Xpttags', 'D')
! call writefile(['one', 'two', 'three'], 'Xptfile', 'D')

%bw!
ptjump two
***************
*** 48,55 ****
call assert_equal(5, winheight(0))
close

- call delete('Xpttags')
- call delete('Xptfile')
set tags&
endfunc

--- 48,53 ----
***************
*** 60,73 ****
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "word\tfile1\tcmd1",
\ "word\tfile2\tcmd2"],
! \ 'Xtags')

only!
call feedkeys(":ptjump word\<CR>\<CR>", "xt")
help
call assert_equal(2, winnr('$'))

- call delete('Xtags')
set tags&
quit
endfunc
--- 58,70 ----
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "word\tfile1\tcmd1",
\ "word\tfile2\tcmd2"],
! \ 'Xtags', 'D')

only!
call feedkeys(":ptjump word\<CR>\<CR>", "xt")
help
call assert_equal(2, winnr('$'))

set tags&
quit
endfunc
***************
*** 77,83 ****
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "one\tXtjfile1\t/^one/;\"\tf\tfile:\tsignature:(void)",
\ "word\tXtjfile2\tcmd2"],
! \ 'Xtjtags')
new Xtjfile1
call setline(1, ['empty', 'one()', 'empty'])
write
--- 74,80 ----
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "one\tXtjfile1\t/^one/;\"\tf\tfile:\tsignature:(void)",
\ "word\tXtjfile2\tcmd2"],
! \ 'Xtjtags', 'D')
new Xtjfile1
call setline(1, ['empty', 'one()', 'empty'])
write
***************
*** 86,92 ****

bwipe!
set tags&
- call delete('Xtjtags')
call delete('Xtjfile1')
endfunc

--- 83,88 ----
***************
*** 97,103 ****
\ "thesame\tXdtfile1\t2;\"\td\tfile:",
\ "thesame\tXdtfile1\t3;\"\td\tfile:",
\ ],
! \ 'Xdttags')
new Xdtfile1
call setline(1, ['thesame one', 'thesame two', 'thesame three'])
write
--- 93,99 ----
\ "thesame\tXdtfile1\t2;\"\td\tfile:",
\ "thesame\tXdtfile1\t3;\"\td\tfile:",
\ ],
! \ 'Xdttags', 'D')
new Xdtfile1
call setline(1, ['thesame one', 'thesame two', 'thesame three'])
write
***************
*** 110,116 ****

bwipe!
set tags&
- call delete('Xdttags')
call delete('Xdtfile1')
endfunc

--- 106,111 ----
***************
*** 121,128 ****
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "second\tXsbfile1\t2",
\ "third\tXsbfile1\t3",],
! \ 'Xswtags')
! call writefile(['first', 'second', 'third'], 'Xsbfile1')

enew | only
set switchbuf=
--- 116,123 ----
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "second\tXsbfile1\t2",
\ "third\tXsbfile1\t3",],
! \ 'Xswtags', 'D')
! call writefile(['first', 'second', 'third'], 'Xsbfile1', 'D')

enew | only
set switchbuf=
***************
*** 153,160 ****

tabclose!
enew | only
- call delete('Xsbfile1')
- call delete('Xswtags')
set tags&
set switchbuf&vim
endfunc
--- 148,153 ----
***************
*** 168,180 ****
\ " test text",
\ " start OK if found this line",
\ " start found wrong line",
! \ "test text"], 'Xtestfile')
call writefile(["/* test text test tex start here",
\ " some text",
\ " test text",
\ " start OK if found this line",
\ " start found wrong line",
! \ "test text"], 'Xinclude')
new Xtestfile
call cursor(1,1)
call search("start")
--- 161,173 ----
\ " test text",
\ " start OK if found this line",
\ " start found wrong line",
! \ "test text"], 'Xtestfile', 'D')
call writefile(["/* test text test tex start here",
\ " some text",
\ " test text",
\ " start OK if found this line",
\ " start found wrong line",
! \ "test text"], 'Xinclude', 'D')
new Xtestfile
call cursor(1,1)
call search("start")
***************
*** 189,196 ****
call assert_fails('tag /\%(/', 'E426:')

enew! | only
- call delete('Xtestfile')
- call delete('Xinclude')
endfunction

" Test for jumping to a tag with 'hidden' set, with symbolic link in path of
--- 182,187 ----
***************
*** 205,213 ****
call writefile([
\ "SECTION_OFF " . getcwd() . "/Xtest.dir/Xtest.c /^#define SECTION_OFF 3$/",
\ '',
! \ ], 'Xsymtags')
call writefile(['#define SECTION_OFF 3',
! \ '#define NUM_SECTIONS 3'], 'Xtest.c')

" Try jumping to a tag, but with a path that contains a symbolic link. When
" wrong, this will give the ATTENTION message. The next space will then be
--- 196,204 ----
call writefile([
\ "SECTION_OFF " . getcwd() . "/Xtest.dir/Xtest.c /^#define SECTION_OFF 3$/",
\ '',
! \ ], 'Xsymtags', 'D')
call writefile(['#define SECTION_OFF 3',
! \ '#define NUM_SECTIONS 3'], 'Xtest.c', 'D')

" Try jumping to a tag, but with a path that contains a symbolic link. When
" wrong, this will give the ATTENTION message. The next space will then be
***************
*** 223,230 ****
set hidden&
set tags&
enew!
- call delete('Xsymtags')
- call delete('Xtest.c')
call delete("Xtest.dir", "rf")
%bwipe!
endfunc
--- 214,219 ----
***************
*** 243,255 ****
set encoding=utf8

let content = ['text for tags1', 'abcdefghijklmnopqrs']
! call writefile(content, 'Xtags1.txt')
let content = ['text for tags2', 'ABC']
! call writefile(content, 'Xtags2.txt')
let content = ['text for tags3', 'ABC']
! call writefile(content, 'Xtags3.txt')
let content = ['!_TAG_FILE_ENCODING utf-8 //', 'abcdefghijklmnopqrs Xtags1.txt /abcdefghijklmnopqrs']
! call writefile(content, 'Xtags1')

" case1:
new
--- 232,244 ----
set encoding=utf8

let content = ['text for tags1', 'abcdefghijklmnopqrs']
! call writefile(content, 'Xtags1.txt', 'D')
let content = ['text for tags2', 'ABC']
! call writefile(content, 'Xtags2.txt', 'D')
let content = ['text for tags3', 'ABC']
! call writefile(content, 'Xtags3.txt', 'D')
let content = ['!_TAG_FILE_ENCODING utf-8 //', 'abcdefghijklmnopqrs Xtags1.txt /abcdefghijklmnopqrs']
! call writefile(content, 'Xtags1', 'D')

" case1:
new
***************
*** 280,299 ****
call add(contents, 'abc' .. i
\ .. " Xtags3.txt /\x82`\x82a\x82b")
endfor
! call writefile(contents, 'Xenctags')
set tags=Xenctags
tag abc50
call assert_equal('Xtags3.txt', expand('%:t'))
call assert_equal('ABC', getline('.'))
- call delete('Xenctags')
close

set tags&
let &encoding = save_enc
- call delete('Xtags1.txt')
- call delete('Xtags2.txt')
- call delete('Xtags3.txt')
- call delete('Xtags1')
endfunc

" Test for emacs-style tags file (TAGS)
--- 269,283 ----
call add(contents, 'abc' .. i
\ .. " Xtags3.txt /\x82`\x82a\x82b")
endfor
! call writefile(contents, 'Xenctags', 'D')
set tags=Xenctags
tag abc50
call assert_equal('Xtags3.txt', expand('%:t'))
call assert_equal('ABC', getline('.'))
close

set tags&
let &encoding = save_enc
endfunc

" Test for emacs-style tags file (TAGS)
***************
*** 307,320 ****
\ "\tfoo();",
\ "\treturn 0;",
\ "}",
! \ ], 'Xmain.c')

call writefile([
\ "\x0c",
\ "Xmain.c,64",
\ "void foo() {}\x7ffoo\x011,0",
\ "int main(int argc, char **argv)\x7fmain\x012,14",
! \ ], 'Xtetags')
set tags=Xtetags
ta foo
call assert_equal('void foo() {}', getline('.'))
--- 291,304 ----
\ "\tfoo();",
\ "\treturn 0;",
\ "}",
! \ ], 'Xmain.c', 'D')

call writefile([
\ "\x0c",
\ "Xmain.c,64",
\ "void foo() {}\x7ffoo\x011,0",
\ "int main(int argc, char **argv)\x7fmain\x012,14",
! \ ], 'Xtetags', 'D')
set tags=Xtetags
ta foo
call assert_equal('void foo() {}', getline('.'))
***************
*** 333,339 ****
\ "\x0c",
\ "Xmain.c,64",
\ "int main(int argc, char **argv)\x7fmain\x012,14",
! \ ], 'Xtags2')
tag main
call assert_equal(2, line('.'))
call assert_fails('tag bar', 'E426:')
--- 317,323 ----
\ "\x0c",
\ "Xmain.c,64",
\ "int main(int argc, char **argv)\x7fmain\x012,14",
! \ ], 'Xtags2', 'D')
tag main
call assert_equal(2, line('.'))
call assert_fails('tag bar', 'E426:')
***************
*** 383,400 ****
\ ], 'Xtags2')
call assert_fails('tag foo', 'E431:')

- call delete('Xtetags')
- call delete('Xtags2')
- call delete('Xmain.c')
set tags&
bwipe!
endfunc

" Test for getting and modifying the tag stack
func Test_getsettagstack()
! call writefile(['line1', 'line2', 'line3'], 'Xstsfile1')
! call writefile(['line1', 'line2', 'line3'], 'Xstsfile2')
! call writefile(['line1', 'line2', 'line3'], 'Xstsfile3')

enew | only
call settagstack(1, {'items' : []})
--- 367,381 ----
\ ], 'Xtags2')
call assert_fails('tag foo', 'E431:')

set tags&
bwipe!
endfunc

" Test for getting and modifying the tag stack
func Test_getsettagstack()
! call writefile(['line1', 'line2', 'line3'], 'Xstsfile1', 'D')
! call writefile(['line1', 'line2', 'line3'], 'Xstsfile2', 'D')
! call writefile(['line1', 'line2', 'line3'], 'Xstsfile3', 'D')

enew | only
call settagstack(1, {'items' : []})
***************
*** 414,420 ****
\ "one\tXstsfile1\t1",
\ "three\tXstsfile3\t3",
\ "two\tXstsfile2\t2"],
! \ 'Xtsttags')

let stk = []
call add(stk, {'bufnr' : bufnr('%'), 'tagname' : 'one',
--- 395,401 ----
\ "one\tXstsfile1\t1",
\ "three\tXstsfile3\t3",
\ "two\tXstsfile2\t2"],
! \ 'Xtsttags', 'D')

let stk = []
call add(stk, {'bufnr' : bufnr('%'), 'tagname' : 'one',
***************
*** 515,542 ****
call assert_fails('call gettagstack()', 'E342:')

call settagstack(1, {'items' : []})
- call delete('Xstsfile1')
- call delete('Xstsfile2')
- call delete('Xstsfile3')
- call delete('Xtsttags')
set tags&
endfunc

func Test_tag_with_count()
call writefile([
\ 'test Xtest.h /^void test();$/;" p typeref:typename:void signature:()',
! \ ], 'Xtags')
call writefile([
\ 'main Xtest.c /^int main()$/;" f typeref:typename:int signature:()',
\ 'test Xtest.c /^void test()$/;" f typeref:typename:void signature:()',
! \ ], 'Ytags')
cal writefile([
\ 'int main()',
\ 'void test()',
! \ ], 'Xtest.c')
cal writefile([
\ 'void test();',
! \ ], 'Xtest.h')
set tags=Xtags,Ytags

new Xtest.c
--- 496,519 ----
call assert_fails('call gettagstack()', 'E342:')

call settagstack(1, {'items' : []})
set tags&
endfunc

func Test_tag_with_count()
call writefile([
\ 'test Xtest.h /^void test();$/;" p typeref:typename:void signature:()',
! \ ], 'Xtags', 'D')
call writefile([
\ 'main Xtest.c /^int main()$/;" f typeref:typename:int signature:()',
\ 'test Xtest.c /^void test()$/;" f typeref:typename:void signature:()',
! \ ], 'Ytags', 'D')
cal writefile([
\ 'int main()',
\ 'void test()',
! \ ], 'Xtest.c', 'D')
cal writefile([
\ 'void test();',
! \ ], 'Xtest.h', 'D')
set tags=Xtags,Ytags

new Xtest.c
***************
*** 552,563 ****
call assert_equal(bufname('%'), 'Xtest.h')

set tags&
- call delete('Xtags')
- call delete('Ytags')
bwipe Xtest.h
bwipe Xtest.c
- call delete('Xtest.h')
- call delete('Xtest.c')
endfunc

func Test_tagnr_recall()
--- 529,536 ----
***************
*** 565,578 ****
\ 'test Xtest.h /^void test();$/;" p',
\ 'main Xtest.c /^int main()$/;" f',
\ 'test Xtest.c /^void test()$/;" f',
! \ ], 'Xtags')
cal writefile([
\ 'int main()',
\ 'void test()',
! \ ], 'Xtest.c')
cal writefile([
\ 'void test();',
! \ ], 'Xtest.h')
set tags=Xtags

new Xtest.c
--- 538,551 ----
\ 'test Xtest.h /^void test();$/;" p',
\ 'main Xtest.c /^int main()$/;" f',
\ 'test Xtest.c /^void test()$/;" f',
! \ ], 'Xtags', 'D')
cal writefile([
\ 'int main()',
\ 'void test()',
! \ ], 'Xtest.c', 'D')
cal writefile([
\ 'void test();',
! \ ], 'Xtest.h', 'D')
set tags=Xtags

new Xtest.c
***************
*** 588,604 ****
call assert_equal(bufname('%'), 'Xtest.h')

set tags&
- call delete('Xtags')
bwipe Xtest.h
bwipe Xtest.c
- call delete('Xtest.h')
- call delete('Xtest.c')
endfunc

func Test_tag_line_toolong()
call writefile([
\ '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 django/contrib/admin/templates/admin/edit_inline/stacked.html 16;" j line:16 language:HTML'
! \ ], 'Xtags')
set tags=Xtags
let old_vbs = &verbose
set verbose=5
--- 561,574 ----
call assert_equal(bufname('%'), 'Xtest.h')

set tags&
bwipe Xtest.h
bwipe Xtest.c
endfunc

func Test_tag_line_toolong()
call writefile([
\ '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 django/contrib/admin/templates/admin/edit_inline/stacked.html 16;" j line:16 language:HTML'
! \ ], 'Xtags', 'D')
set tags=Xtags
let old_vbs = &verbose
set verbose=5
***************
*** 635,641 ****
\ 'two',
\ 'trhee',
\ 'four',
! \ ], 'Xsomewhere')
tag foobar
call assert_equal('Xsomewhere', expand('%'))
call assert_equal(3, getcurpos()[1])
--- 605,611 ----
\ 'two',
\ 'trhee',
\ 'four',
! \ ], 'Xsomewhere', 'D')
tag foobar
call assert_equal('Xsomewhere', expand('%'))
call assert_equal(3, getcurpos()[1])
***************
*** 650,657 ****
" Should not crash
call assert_true(v:true)

- call delete('Xtags')
- call delete('Xsomewhere')
set tags&
let &verbose = old_vbs
endfunc
--- 620,625 ----
***************
*** 665,680 ****
\ 'main Xtest.h /^void test();$/;" f',
\ 'main Xtest.c /^int main()$/;" f',
\ 'main Xtest.x /^void test()$/;" f',
! \ ], 'Xtags')
cal writefile([
\ 'int main()',
\ 'void test()',
! \ ], 'Xtest.c')

let lines =<< trim [SCRIPT]
set tags=Xtags
[SCRIPT]
! call writefile(lines, 'XTest_tselect')
let buf = RunVimInTerminal('-S XTest_tselect', {'rows': 10, 'cols': 50})

call TermWait(buf, 50)
--- 633,648 ----
\ 'main Xtest.h /^void test();$/;" f',
\ 'main Xtest.c /^int main()$/;" f',
\ 'main Xtest.x /^void test()$/;" f',
! \ ], 'Xtags', 'D')
cal writefile([
\ 'int main()',
\ 'void test()',
! \ ], 'Xtest.c', 'D')

let lines =<< trim [SCRIPT]
set tags=Xtags
[SCRIPT]
! call writefile(lines, 'XTest_tselect', 'D')
let buf = RunVimInTerminal('-S XTest_tselect', {'rows': 10, 'cols': 50})

call TermWait(buf, 50)
***************
*** 682,703 ****
call VerifyScreenDump(buf, 'Test_tselect_1', {})

call StopVimInTerminal(buf)
- call delete('Xtags')
- call delete('Xtest.c')
- call delete('XTest_tselect')
endfunc

func Test_tagline()
call writefile([
\ 'provision Xtest.py /^ def provision(self, **kwargs):$/;" m line:1 language:Python class:Foo',
\ 'provision Xtest.py /^ def provision(self, **kwargs):$/;" m line:3 language:Python class:Bar',
! \], 'Xtags')
call writefile([
\ ' def provision(self, **kwargs):',
\ ' pass',
\ ' def provision(self, **kwargs):',
\ ' pass',
! \], 'Xtest.py')

set tags=Xtags

--- 650,668 ----
call VerifyScreenDump(buf, 'Test_tselect_1', {})

call StopVimInTerminal(buf)
endfunc

func Test_tagline()
call writefile([
\ 'provision Xtest.py /^ def provision(self, **kwargs):$/;" m line:1 language:Python class:Foo',
\ 'provision Xtest.py /^ def provision(self, **kwargs):$/;" m line:3 language:Python class:Bar',
! \], 'Xtags', 'D')
call writefile([
\ ' def provision(self, **kwargs):',
\ ' pass',
\ ' def provision(self, **kwargs):',
\ ' pass',
! \], 'Xtest.py', 'D')

set tags=Xtags

***************
*** 706,719 ****
2tag provision
call assert_equal(line('.'), 3)

- call delete('Xtags')
- call delete('Xtest.py')
set tags&
endfunc

" Test for expanding environment variable in a tag file name
func Test_tag_envvar()
! call writefile(["Func1\t$FOO\t/^Func1/"], 'Xtags')
set tags=Xtags

let $FOO='TagTestEnv'
--- 671,682 ----
2tag provision
call assert_equal(line('.'), 3)

set tags&
endfunc

" Test for expanding environment variable in a tag file name
func Test_tag_envvar()
! call writefile(["Func1\t$FOO\t/^Func1/"], 'Xtags', 'D')
set tags=Xtags

let $FOO='TagTestEnv'
***************
*** 728,734 ****
call assert_true(caught_exception)

set tags&
- call delete('Xtags')
unlet $FOO
endfunc

--- 691,696 ----
***************
*** 737,745 ****
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "second\tXtpfile1\t2",
\ "third\tXtpfile1\t3",],
! \ 'Xtags')
set tags=Xtags
! call writefile(['first', 'second', 'third'], 'Xtpfile1')

enew | only
ptag third
--- 699,707 ----
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "second\tXtpfile1\t2",
\ "third\tXtpfile1\t3",],
! \ 'Xtags', 'D')
set tags=Xtags
! call writefile(['first', 'second', 'third'], 'Xtpfile1', 'D')

enew | only
ptag third
***************
*** 766,773 ****
pclose
call assert_equal(1, winnr('$'))

- call delete('Xtpfile1')
- call delete('Xtags')
set tags&
endfunc

--- 728,733 ----
***************
*** 778,784 ****
\ "func2\tXfoo\t/^int func2(int y)/",
\ "func3\tXfoo\t/^func3/",
\ "func4\tXfoo\t/^func4/"],
! \ 'Xtags')
set tags=Xtags
let code =<< trim [CODE]

--- 738,744 ----
\ "func2\tXfoo\t/^int func2(int y)/",
\ "func3\tXfoo\t/^func3/",
\ "func4\tXfoo\t/^func4/"],
! \ 'Xtags', 'D')
set tags=Xtags
let code =<< trim [CODE]

***************
*** 788,794 ****
int * func3 () { }

[CODE]
! call writefile(code, 'Xfoo')

let v:statusmsg = ''
ta func1
--- 748,754 ----
int * func3 () { }

[CODE]
! call writefile(code, 'Xfoo', 'D')

let v:statusmsg = ''
ta func1
***************
*** 804,811 ****
call assert_equal(5, line('.'))
call assert_fails('ta func4', 'E434:')

- call delete('Xtags')
- call delete('Xfoo')
set tags&
endfunc

--- 764,769 ----
***************
*** 815,840 ****
\ "first\tXfoo\t1",
\ "ten\tXfoo\t3",
\ "six\tXfoo\t2"]
! call writefile(l, 'Xtags')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
int six() {}
int ten() {}
[CODE]
! call writefile(code, 'Xfoo')

call assert_fails('tag first', 'E432:')

" When multiple tag files are not sorted, then message should be displayed
" multiple times
! call writefile(l, 'Xtags2')
set tags=Xtags,Xtags2
call assert_fails('tag first', ['E432:', 'E432:'])

- call delete('Xtags')
- call delete('Xtags2')
- call delete('Xfoo')
set tags&
%bwipe
endfunc
--- 773,795 ----
\ "first\tXfoo\t1",
\ "ten\tXfoo\t3",
\ "six\tXfoo\t2"]
! call writefile(l, 'Xtags', 'D')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
int six() {}
int ten() {}
[CODE]
! call writefile(code, 'Xfoo', 'D')

call assert_fails('tag first', 'E432:')

" When multiple tag files are not sorted, then message should be displayed
" multiple times
! call writefile(l, 'Xtags2', 'D')
set tags=Xtags,Xtags2
call assert_fails('tag first', ['E432:', 'E432:'])

set tags&
%bwipe
endfunc
***************
*** 847,868 ****
\ "first\tXfoo\t1",
\ "second\tXfoo\t2",
\ "third\tXfoo\t3"],
! \ 'Xtags')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
int second() {}
int third() {}
[CODE]
! call writefile(code, 'Xfoo')

enew
tag second
call assert_equal('Xfoo', bufname(''))
call assert_equal(2, line('.'))

- call delete('Xtags')
- call delete('Xfoo')
set tags&
%bwipe
endfunc
--- 802,821 ----
\ "first\tXfoo\t1",
\ "second\tXfoo\t2",
\ "third\tXfoo\t3"],
! \ 'Xtags', 'D')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
int second() {}
int third() {}
[CODE]
! call writefile(code, 'Xfoo', 'D')

enew
tag second
call assert_equal('Xfoo', bufname(''))
call assert_equal(2, line('.'))

set tags&
%bwipe
endfunc
***************
*** 874,887 ****
\ "first\tXfoo\t1",
\ "second\tXfoo\t/^int second() {}$/",
\ "third\tXfoo\t3"],
! \ 'Xtags')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
int second() {}
int third() {}
[CODE]
! call writefile(code, 'Xfoo')

enew
call setloclist(0, [], 'f')
--- 827,840 ----
\ "first\tXfoo\t1",
\ "second\tXfoo\t/^int second() {}$/",
\ "third\tXfoo\t3"],
! \ 'Xtags', 'D')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
int second() {}
int third() {}
[CODE]
! call writefile(code, 'Xfoo', 'D')

enew
call setloclist(0, [], 'f')
***************
*** 899,906 ****
\ 'valid': 1, 'vcol': 0, 'nr': 0, 'type': '', 'module': '',
\ 'text': 'second'}], getloclist(0))

- call delete('Xtags')
- call delete('Xfoo')
set tags&
%bwipe
endfunc
--- 852,857 ----
***************
*** 913,926 ****
\ "first\tXfoo\t/^int first() {}/",
\ "second\tXfoo\t/^int second() {}/",
\ "third\tXfoo\t/^int third() {}/"],
! \ 'Xtags')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
int second() {}
int third() {}
[CODE]
! call writefile(code, 'Xfoo')

enew
let save_cpo = &cpo
--- 864,877 ----
\ "first\tXfoo\t/^int first() {}/",
\ "second\tXfoo\t/^int second() {}/",
\ "third\tXfoo\t/^int third() {}/"],
! \ 'Xtags', 'D')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
int second() {}
int third() {}
[CODE]
! call writefile(code, 'Xfoo', 'D')

enew
let save_cpo = &cpo
***************
*** 930,937 ****
call assert_equal('^int second() {}', @/)
let &cpo = save_cpo

- call delete('Xtags')
- call delete('Xfoo')
set tags&
%bwipe
endfunc
--- 881,886 ----
***************
*** 942,955 ****
for i in range(10, 31)
let l += ["var" .. i .. "\tXfoo\t/^int var" .. i .. ";$/"]
endfor
! call writefile(l, 'Xtags')
set tags=Xtags

let l = []
for i in range(10, 31)
let l += ["int var" .. i .. ";"]
endfor
! call writefile(l, 'Xfoo')

" Jump to a tag when the tag stack is full. Oldest entry should be removed.
enew
--- 891,904 ----
for i in range(10, 31)
let l += ["var" .. i .. "\tXfoo\t/^int var" .. i .. ";$/"]
endfor
! call writefile(l, 'Xtags', 'D')
set tags=Xtags

let l = []
for i in range(10, 31)
let l += ["int var" .. i .. ";"]
endfor
! call writefile(l, 'Xfoo', 'D')

" Jump to a tag when the tag stack is full. Oldest entry should be removed.
enew
***************
*** 994,1001 ****
call settagstack(1, {'items' : []})
call assert_fails('pop', 'E73:')

- call delete('Xtags')
- call delete('Xfoo')
set tags&
%bwipe
endfunc
--- 943,948 ----
***************
*** 1007,1020 ****
\ "first\tXfoo\t1",
\ "first\tXfoo\t2",
\ "first\tXfoo\t3"],
! \ 'Xtags')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
int first() {}
int first() {}
[CODE]
! call writefile(code, 'Xfoo')

call settagstack(1, {'items' : []})
tag first
--- 954,967 ----
\ "first\tXfoo\t1",
\ "first\tXfoo\t2",
\ "first\tXfoo\t3"],
! \ 'Xtags', 'D')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
int first() {}
int first() {}
[CODE]
! call writefile(code, 'Xfoo', 'D')

call settagstack(1, {'items' : []})
tag first
***************
*** 1041,1048 ****
call assert_equal(1, line('.'))
set ignorecase&

- call delete('Xtags')
- call delete('Xfoo')
set tags&
%bwipe
endfunc
--- 988,993 ----
***************
*** 1054,1067 ****
\ "first\tXfoo\t1",
\ "first\tXfoo\t2",
\ "first\tXfoo\t3"],
! \ 'Xtags')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
int first() {}
int first() {}
[CODE]
! call writefile(code, 'Xfoo')

enew | only
ptag first
--- 999,1012 ----
\ "first\tXfoo\t1",
\ "first\tXfoo\t2",
\ "first\tXfoo\t3"],
! \ 'Xtags', 'D')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
int first() {}
int first() {}
[CODE]
! call writefile(code, 'Xfoo', 'D')

enew | only
ptag first
***************
*** 1091,1098 ****

pclose

- call delete('Xtags')
- call delete('Xfoo')
set tags&
%bwipe
endfunc
--- 1036,1041 ----
***************
*** 1104,1117 ****
\ "first\tXfoo1\t1",
\ "first\tXfoo2\t1",
\ "first\tXfoo3\t1"],
! \ 'Xtags')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
[CODE]
! call writefile(code, 'Xfoo1')
! call writefile(code, 'Xfoo2')
! call writefile(code, 'Xfoo3')

tag first
tag first
--- 1047,1060 ----
\ "first\tXfoo1\t1",
\ "first\tXfoo2\t1",
\ "first\tXfoo3\t1"],
! \ 'Xtags', 'D')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
[CODE]
! call writefile(code, 'Xfoo1', 'D')
! call writefile(code, 'Xfoo2', 'D')
! call writefile(code, 'Xfoo3', 'D')

tag first
tag first
***************
*** 1120,1129 ****
tnext
call assert_fails('tnext', 'E428:')

- call delete('Xtags')
- call delete('Xfoo1')
- call delete('Xfoo2')
- call delete('Xfoo3')
set tags&
%bwipe
endfunc
--- 1063,1068 ----
***************
*** 1135,1148 ****
\ "first\tXfoo1\t1",
\ "first\tXfoo2\t1",
\ "first\tXfoo3\t1"],
! \ 'Xtags')
set tags=Xtags

call settagstack(1, {'items' : []})
call assert_fails('tag first', 'E429:')
call assert_equal(3, gettagstack().items[0].matchnr)

- call delete('Xtags')
set tags&
%bwipe
endfunc
--- 1074,1086 ----
\ "first\tXfoo1\t1",
\ "first\tXfoo2\t1",
\ "first\tXfoo3\t1"],
! \ 'Xtags', 'D')
set tags=Xtags

call settagstack(1, {'items' : []})
call assert_fails('tag first', 'E429:')
call assert_equal(3, gettagstack().items[0].matchnr)

set tags&
%bwipe
endfunc
***************
*** 1152,1165 ****
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
\ "first\tXfoo\t1" .. ';"' .. "\tv\ttyperef:typename:int\tfile:",
\ "first\tXfoo\t2" .. ';"' .. "\tkind:v\ttyperef:typename:char\tfile:"],
! \ 'Xtags')
set tags=Xtags

let code =<< trim [CODE]
static int first;
static char first;
[CODE]
! call writefile(code, 'Xfoo')

call feedkeys("\<CR>", "t")
let l = split(execute("tselect first"), "\n")
--- 1090,1103 ----
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
\ "first\tXfoo\t1" .. ';"' .. "\tv\ttyperef:typename:int\tfile:",
\ "first\tXfoo\t2" .. ';"' .. "\tkind:v\ttyperef:typename:char\tfile:"],
! \ 'Xtags', 'D')
set tags=Xtags

let code =<< trim [CODE]
static int first;
static char first;
[CODE]
! call writefile(code, 'Xfoo', 'D')

call feedkeys("\<CR>", "t")
let l = split(execute("tselect first"), "\n")
***************
*** 1175,1182 ****
[DATA]
call assert_equal(expected, l)

- call delete('Xtags')
- call delete('Xfoo')
set tags&
%bwipe
endfunc
--- 1113,1118 ----
***************
*** 1454,1462 ****
set tags=Xtags
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "tame\tXtlfile1\t1;",
! \ "tape\tXtlfile2\t1;"], 'Xtags')
! call writefile(['tame'], 'Xtlfile1')
! call writefile(['tape'], 'Xtlfile2')

" Jumping to the tag 'tape', should instead jump to 'tame'
new
--- 1390,1398 ----
set tags=Xtags
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "tame\tXtlfile1\t1;",
! \ "tape\tXtlfile2\t1;"], 'Xtags', 'D')
! call writefile(['tame'], 'Xtlfile1', 'D')
! call writefile(['tape'], 'Xtlfile2', 'D')

" Jumping to the tag 'tape', should instead jump to 'tame'
new
***************
*** 1468,1476 ****
tag /^tape$
call assert_equal('Xtlfile2', @%)

- call delete('Xtags')
- call delete('Xtlfile1')
- call delete('Xtlfile2')
set tags& taglength&
endfunc

--- 1404,1409 ----
***************
*** 1480,1487 ****

" missing search pattern or line number for a tag
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
! \ "foo\tXfile\t"], 'Xtags', 'b')
! call writefile(['foo'], 'Xfile')

enew
tag foo
--- 1413,1420 ----

" missing search pattern or line number for a tag
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
! \ "foo\tXfile\t"], 'Xtags', 'bD')
! call writefile(['foo'], 'Xfile', 'D')

enew
tag foo
***************
*** 1504,1511 ****
\ "foo\tXfile 1;"], 'Xtags')
call assert_fails('tag foo', 'E431:')

- call delete('Xtags')
- call delete('Xfile')
set tags&
endfunc

--- 1437,1442 ----
***************
*** 1514,1522 ****
new | only
set tags=Xtags
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
! \ "foo\tXfile\t1"], 'Xtags')
! call writefile(['foo'], 'Xfile')
! call writefile([], '.Xfile.swp')
" Remove the catch-all that runtest.vim adds
au! SwapExists
augroup StagTest
--- 1445,1453 ----
new | only
set tags=Xtags
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
! \ "foo\tXfile\t1"], 'Xtags', 'D')
! call writefile(['foo'], 'Xfile', 'D')
! call writefile([], '.Xfile.swp', 'D')
" Remove the catch-all that runtest.vim adds
au! SwapExists
augroup StagTest
***************
*** 1531,1538 ****
augroup StagTest
au!
augroup END
- call delete('Xfile')
- call delete('.Xfile.swp')
set tags&
endfunc

--- 1462,1467 ----
***************
*** 1546,1559 ****
\ "third\tXfoo\t3",
\ "second\tXfoo\t2",
\ "first\tXfoo\t1"],
! \ 'Xtags')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
int second() {}
int third() {}
[CODE]
! call writefile(code, 'Xfoo')

enew
set tagbsearch
--- 1475,1488 ----
\ "third\tXfoo\t3",
\ "second\tXfoo\t2",
\ "first\tXfoo\t1"],
! \ 'Xtags', 'D')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
int second() {}
int third() {}
[CODE]
! call writefile(code, 'Xfoo', 'D')

enew
set tagbsearch
***************
*** 1613,1620 ****
\ 'Xtags')
call assert_fails('tag bbb', 'E426:')

- call delete('Xtags')
- call delete('Xfoo')
set tags& tagbsearch&
endfunc

--- 1542,1547 ----
*** ../vim-9.0.0766/src/testdir/test_taglist.vim 2022-03-12 17:35:15.000000000 +0000
--- src/testdir/test_taglist.vim 2022-10-15 20:37:31.077466454 +0100
***************
*** 12,18 ****
\ "Kindly\tXbar\t3;\"\tv\tfile:",
\ "Lambda\tXbar\t3;\"\tλ\tfile:",
\ "Command\tXbar\tcall cursor(3, 4)|;\"\td",
! \ ], 'Xtags')
set tags=Xtags
split Xtext

--- 12,18 ----
\ "Kindly\tXbar\t3;\"\tv\tfile:",
\ "Lambda\tXbar\t3;\"\tλ\tfile:",
\ "Command\tXbar\tcall cursor(3, 4)|;\"\td",
! \ ], 'Xtags', 'D')
set tags=Xtags
split Xtext

***************
*** 40,51 ****
" Use characters with value > 127 in the tag extra field.
call writefile([
\ "vFoo\tXfoo\t4" .. ';"' .. "\ttypename:int\ta£££\tv",
! \ ], 'Xtags')
call assert_equal('v', taglist('vFoo')[0].kind)

call assert_fails("let l=taglist([])", 'E730:')

- call delete('Xtags')
set tags&
bwipe
endfunc
--- 40,50 ----
" Use characters with value > 127 in the tag extra field.
call writefile([
\ "vFoo\tXfoo\t4" .. ';"' .. "\ttypename:int\ta£££\tv",
! \ ], 'Xtags', 'D')
call assert_equal('v', taglist('vFoo')[0].kind)

call assert_fails("let l=taglist([])", 'E730:')

set tags&
bwipe
endfunc
***************
*** 58,71 ****
\ "src/os_unix.c,13491",
\ "set_signals(\x7f1335,32699",
\ "reset_signals(\x7f1407,34136",
! \ ], 'Xtags')

set tags=Xtags

call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']],
\ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]}))

- call delete('Xtags')
set tags&
endfunc

--- 57,69 ----
\ "src/os_unix.c,13491",
\ "set_signals(\x7f1335,32699",
\ "reset_signals(\x7f1407,34136",
! \ ], 'Xtags', 'D')

set tags=Xtags

call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']],
\ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]}))

set tags&
endfunc

***************
*** 77,90 ****
\ "src/os_unix.c,13491",
\ "set_signals(void)\x7fset_signals\x011335,32699",
\ "reset_signals(void)\x7freset_signals\x011407,34136",
! \ ], 'Xtags')

set tags=Xtags

call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']],
\ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]}))

- call delete('Xtags')
set tags&
endfunc

--- 75,87 ----
\ "src/os_unix.c,13491",
\ "set_signals(void)\x7fset_signals\x011335,32699",
\ "reset_signals(void)\x7freset_signals\x011407,34136",
! \ ], 'Xtags', 'D')

set tags=Xtags

call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']],
\ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]}))

set tags&
endfunc

***************
*** 96,103 ****
func Test_tagfiles()
call assert_equal([], tagfiles())

! call writefile(["FFoo\tXfoo\t1"], 'Xtags1')
! call writefile(["FBar\tXbar\t1"], 'Xtags2')
set tags=Xtags1,Xtags2
call assert_equal(['Xtags1', 'Xtags2'], tagfiles())

--- 93,100 ----
func Test_tagfiles()
call assert_equal([], tagfiles())

! call writefile(["FFoo\tXfoo\t1"], 'Xtags1', 'D')
! call writefile(["FBar\tXbar\t1"], 'Xtags2', 'D')
set tags=Xtags1,Xtags2
call assert_equal(['Xtags1', 'Xtags2'], tagfiles())

***************
*** 111,132 ****
set tags&
call assert_equal([], tagfiles())

- call delete('Xtags1')
- call delete('Xtags2')
bd
endfunc

" For historical reasons we support a tags file where the last line is missing
" the newline.
func Test_tagsfile_without_trailing_newline()
! call writefile(["Foo\tfoo\t1"], 'Xtags', 'b')
set tags=Xtags

let tl = taglist('.*')
call assert_equal(1, len(tl))
call assert_equal('Foo', tl[0].name)

- call delete('Xtags')
set tags&
endfunc

--- 108,126 ----
set tags&
call assert_equal([], tagfiles())

bd
endfunc

" For historical reasons we support a tags file where the last line is missing
" the newline.
func Test_tagsfile_without_trailing_newline()
! call writefile(["Foo\tfoo\t1"], 'Xtags', 'bD')
set tags=Xtags

let tl = taglist('.*')
call assert_equal(1, len(tl))
call assert_equal('Foo', tl[0].name)

set tags&
endfunc

***************
*** 136,142 ****
\ "!_TAG_PROGRAM_NAME /Test tags generator/",
\ "FBar\tXfoo\t2" .. ';"' .. "\textrafield\tf",
\ "!_TAG_FILE_FORMAT 2 /extended format/",
! \ ], 'Xtags')
set tags=Xtags

let l = taglist('.*')
--- 130,136 ----
\ "!_TAG_PROGRAM_NAME /Test tags generator/",
\ "FBar\tXfoo\t2" .. ';"' .. "\textrafield\tf",
\ "!_TAG_FILE_FORMAT 2 /extended format/",
! \ ], 'Xtags', 'D')
set tags=Xtags

let l = taglist('.*')
***************
*** 144,150 ****
call assert_equal('FBar', l[0].name)

set tags&
- call delete('Xtags')
endfunc

" Test for using an excmd in a tags file to position the cursor (instead of a
--- 138,143 ----
***************
*** 152,158 ****
func Test_tagfile_excmd()
call writefile([
\ "vFoo\tXfoo\tcall cursor(3, 4)" .. '|;"' .. "\tv",
! \ ], 'Xtags')
set tags=Xtags

let l = taglist('.*')
--- 145,151 ----
func Test_tagfile_excmd()
call writefile([
\ "vFoo\tXfoo\tcall cursor(3, 4)" .. '|;"' .. "\tv",
! \ ], 'Xtags', 'D')
set tags=Xtags

let l = taglist('.*')
***************
*** 164,177 ****
\ 'filename' : 'Xfoo'}], l)

set tags&
- call delete('Xtags')
endfunc

" Test for duplicate fields in a tag in a tags file
func Test_duplicate_field()
call writefile([
\ "vFoo\tXfoo\t4" .. ';"' .. "\ttypename:int\ttypename:int\tv",
! \ ], 'Xtags')
set tags=Xtags

let l = taglist('.*')
--- 157,169 ----
\ 'filename' : 'Xfoo'}], l)

set tags&
endfunc

" Test for duplicate fields in a tag in a tags file
func Test_duplicate_field()
call writefile([
\ "vFoo\tXfoo\t4" .. ';"' .. "\ttypename:int\ttypename:int\tv",
! \ ], 'Xtags', 'D')
set tags=Xtags

let l = taglist('.*')
***************
*** 184,197 ****
\ 'filename' : 'Xfoo'}], l)

set tags&
- call delete('Xtags')
endfunc

" Test for tag address with ;
func Test_tag_addr_with_semicolon()
call writefile([
\ "Func1\tXfoo\t6;/^Func1/" .. ';"' .. "\tf"
! \ ], 'Xtags')
set tags=Xtags

let l = taglist('.*')
--- 176,188 ----
\ 'filename' : 'Xfoo'}], l)

set tags&
endfunc

" Test for tag address with ;
func Test_tag_addr_with_semicolon()
call writefile([
\ "Func1\tXfoo\t6;/^Func1/" .. ';"' .. "\tf"
! \ ], 'Xtags', 'D')
set tags=Xtags

let l = taglist('.*')
***************
*** 203,214 ****
\ 'filename' : 'Xfoo'}], l)

set tags&
- call delete('Xtags')
endfunc

" Test for format error in a tags file
func Test_format_error()
! call writefile(['vFoo-Xfoo-4'], 'Xtags')
set tags=Xtags

let caught_exception = v:false
--- 194,204 ----
\ 'filename' : 'Xfoo'}], l)

set tags&
endfunc

" Test for format error in a tags file
func Test_format_error()
! call writefile(['vFoo-Xfoo-4'], 'Xtags', 'D')
set tags=Xtags

let caught_exception = v:false
***************
*** 228,239 ****
call assert_fails("echo taglist('foo')", 'E431:')

set tags&
- call delete('Xtags')
endfunc

" Test for :tag command completion with 'wildoptions' set to 'tagfile'
func Test_tag_complete_wildoptions()
! call writefile(["foo\ta.c\t10;\"\tf", "bar\tb.c\t20;\"\td"], 'Xtags')
set tags=Xtags
set wildoptions=tagfile

--- 218,228 ----
call assert_fails("echo taglist('foo')", 'E431:')

set tags&
endfunc

" Test for :tag command completion with 'wildoptions' set to 'tagfile'
func Test_tag_complete_wildoptions()
! call writefile(["foo\ta.c\t10;\"\tf", "bar\tb.c\t20;\"\td"], 'Xtags', 'D')
set tags=Xtags
set wildoptions=tagfile

***************
*** 242,248 ****

call assert_equal('"tag bar d b.c : foo f a.c', @:)

- call delete('Xtags')
set wildoptions&
set tags&
endfunc
--- 231,236 ----
***************
*** 256,262 ****
inboundGovernor a 2;" kind:⊢ type:forall (muxMode :: MuxMode) socket peerAddr versionNumber m a b. (MonadAsync m, MonadCatch m, MonadEvaluate m, MonadThrow m, MonadThrow (STM m), MonadTime m, MonadTimer m, MonadMask m, Ord peerAddr, HasResponder muxMode ~ True) => Tracer m (RemoteTransitionTrace peerAddr) -> Tracer m (InboundGovernorTrace peerAddr) -> ServerControlChannel muxMode peerAddr ByteString m a b -> DiffTime -> MuxConnectionManager muxMode socket peerAddr versionNumber ByteString m a b -> StrictTVar m InboundGovernorObservableState -> m Void
inboundGovernorCounters a 3;" kind:⊢ type:InboundGovernorState muxMode peerAddr m a b -> InboundGovernorCounters
END
! call writefile(tagslines, 'Xtags')
set tags=Xtags

" try with binary search
--- 244,250 ----
inboundGovernor a 2;" kind:⊢ type:forall (muxMode :: MuxMode) socket peerAddr versionNumber m a b. (MonadAsync m, MonadCatch m, MonadEvaluate m, MonadThrow m, MonadThrow (STM m), MonadTime m, MonadTimer m, MonadMask m, Ord peerAddr, HasResponder muxMode ~ True) => Tracer m (RemoteTransitionTrace peerAddr) -> Tracer m (InboundGovernorTrace peerAddr) -> ServerControlChannel muxMode peerAddr ByteString m a b -> DiffTime -> MuxConnectionManager muxMode socket peerAddr versionNumber ByteString m a b -> StrictTVar m InboundGovernorObservableState -> m Void
inboundGovernorCounters a 3;" kind:⊢ type:InboundGovernorState muxMode peerAddr m a b -> InboundGovernorCounters
END
! call writefile(tagslines, 'Xtags', 'D')
set tags=Xtags

" try with binary search
***************
*** 269,275 ****
call assert_equal('"tag inboundGSV inboundGovernor inboundGovernorCounters', @:)
set tagbsearch&

- call delete('Xtags')
set tags&
endfunc

--- 257,262 ----
*** ../vim-9.0.0766/src/testdir/test_tcl.vim 2022-06-23 20:38:03.000000000 +0100
--- src/testdir/test_tcl.vim 2022-10-15 20:37:46.837414640 +0100
***************
*** 684,708 ****
" Test :tclfile
func Test_tclfile()
call delete('Xtcl_file')
! call writefile(['set pi [format "%.2f" [expr acos(-1.0)]]'], 'Xtcl_file')
call setfperm('Xtcl_file', 'r-xr-xr-x')

tclfile Xtcl_file
call assert_equal('3.14', TclEval('set pi'))

tcl unset pi
- call delete('Xtcl_file')
endfunc

" Test :tclfile with syntax error in tcl script
func Test_tclfile_error()
call delete('Xtcl_file')
! call writefile(['xyz'], 'Xtcl_file')
call setfperm('Xtcl_file', 'r-xr-xr-x')

call assert_fails('tclfile Xtcl_file', 'invalid command name "xyz"')
-
- call delete('Xtcl_file')
endfunc

" Test exiting current Tcl interpreter and re-creating one.
--- 684,705 ----
" Test :tclfile
func Test_tclfile()
call delete('Xtcl_file')
! call writefile(['set pi [format "%.2f" [expr acos(-1.0)]]'], 'Xtcl_file', 'D')
call setfperm('Xtcl_file', 'r-xr-xr-x')

tclfile Xtcl_file
call assert_equal('3.14', TclEval('set pi'))

tcl unset pi
endfunc

" Test :tclfile with syntax error in tcl script
func Test_tclfile_error()
call delete('Xtcl_file')
! call writefile(['xyz'], 'Xtcl_file', 'D')
call setfperm('Xtcl_file', 'r-xr-xr-x')

call assert_fails('tclfile Xtcl_file', 'invalid command name "xyz"')
endfunc

" Test exiting current Tcl interpreter and re-creating one.
*** ../vim-9.0.0766/src/testdir/test_termencoding.vim 2020-08-12 17:43:41.000000000 +0100
--- src/testdir/test_termencoding.vim 2022-10-15 20:38:15.325321924 +0100
***************
*** 26,39 ****
\ 'scriptencoding utf-8',
\ 'exe "normal aE83: バッファを作成できないので、他のを使用します...\<Esc>"',
\ 'split Xeuc_jp.txt',
! \ ], 'XTest_tenc_euc_jp')
let buf = RunVimInTerminal('-S XTest_tenc_euc_jp', {'rows': 10})
call VerifyScreenDump(buf, 'Test_tenc_euc_jp_01', {})

" clean up
call StopVimInTerminal(buf)
call delete('Xeuc_jp.txt')
- call delete('XTest_tenc_euc_jp')
endfunc

" vim: shiftwidth=2 sts=2 expandtab
--- 26,38 ----
\ 'scriptencoding utf-8',
\ 'exe "normal aE83: バッファを作成できないので、他のを使用します...\<Esc>"',
\ 'split Xeuc_jp.txt',
! \ ], 'XTest_tenc_euc_jp', 'D')
let buf = RunVimInTerminal('-S XTest_tenc_euc_jp', {'rows': 10})
call VerifyScreenDump(buf, 'Test_tenc_euc_jp_01', {})

" clean up
call StopVimInTerminal(buf)
call delete('Xeuc_jp.txt')
endfunc

" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.0766/src/testdir/test_terminal.vim 2022-10-15 11:47:54.217416750 +0100
--- src/testdir/test_terminal.vim 2022-10-15 20:43:05.720433261 +0100
***************
*** 405,411 ****
endfunc

func Test_terminal_scrape_multibyte()
! call writefile(["léttまrs"], 'Xtext')
if has('win32')
" Run cmd with UTF-8 codepage to make the type command print the expected
" multibyte characters.
--- 405,411 ----
endfunc

func Test_terminal_scrape_multibyte()
! call writefile(["léttまrs"], 'Xtext', 'D')
if has('win32')
" Run cmd with UTF-8 codepage to make the type command print the expected
" multibyte characters.
***************
*** 436,442 ****
call TermWait(buf)

exe buf . 'bwipe'
- call delete('Xtext')
endfunc

func Test_terminal_one_column()
--- 436,441 ----
***************
*** 455,461 ****
endfunc

func Test_terminal_scroll()
! call writefile(range(1, 200), 'Xtext')
if has('win32')
let cmd = 'cmd /c "type Xtext"'
else
--- 454,460 ----
endfunc

func Test_terminal_scroll()
! call writefile(range(1, 200), 'Xtext', 'D')
if has('win32')
let cmd = 'cmd /c "type Xtext"'
else
***************
*** 484,496 ****
call assert_equal('200', term_getline(buf, 200 - scrolled))

exe buf . 'bwipe'
- call delete('Xtext')
endfunc

func Test_terminal_scrollback()
let buf = Run_shell_in_terminal({'term_rows': 15})
set termwinscroll=100
! call writefile(range(150), 'Xtext')
if has('win32')
call term_sendkeys(buf, "type Xtext\<CR>")
else
--- 483,494 ----
call assert_equal('200', term_getline(buf, 200 - scrolled))

exe buf . 'bwipe'
endfunc

func Test_terminal_scrollback()
let buf = Run_shell_in_terminal({'term_rows': 15})
set termwinscroll=100
! call writefile(range(150), 'Xtext', 'D')
if has('win32')
call term_sendkeys(buf, "type Xtext\<CR>")
else
***************
*** 505,518 ****
call StopShellInTerminal(buf)
exe buf . 'bwipe'
set termwinscroll&
- call delete('Xtext')
endfunc

func Test_terminal_postponed_scrollback()
" tail -f only works on Unix
CheckUnix

! call writefile(range(50), 'Xtext')
call writefile([
\ 'set shell=/bin/sh noruler',
\ 'terminal',
--- 503,515 ----
call StopShellInTerminal(buf)
exe buf . 'bwipe'
set termwinscroll&
endfunc

func Test_terminal_postponed_scrollback()
" tail -f only works on Unix
CheckUnix

! call writefile(range(50), 'Xtext', 'D')
call writefile([
\ 'set shell=/bin/sh noruler',
\ 'terminal',
***************
*** 520,526 ****
\ 'call feedkeys("tail -n 100 -f Xtext\<CR>", "xt")',
\ 'sleep 100m',
\ 'call feedkeys("\<C-W>N", "xt")',
! \ ], 'XTest_postponed')
let buf = RunVimInTerminal('-S XTest_postponed', {})
" Check that the Xtext lines are displayed and in Terminal-Normal mode
call VerifyScreenDump(buf, 'Test_terminal_scrollback_1', {})
--- 517,523 ----
\ 'call feedkeys("tail -n 100 -f Xtext\<CR>", "xt")',
\ 'sleep 100m',
\ 'call feedkeys("\<C-W>N", "xt")',
! \ ], 'XTest_postponed', 'D')
let buf = RunVimInTerminal('-S XTest_postponed', {})
" Check that the Xtext lines are displayed and in Terminal-Normal mode
call VerifyScreenDump(buf, 'Test_terminal_scrollback_1', {})
***************
*** 547,554 ****
echo type(tsk_ret)

call StopVimInTerminal(buf)
- call delete('XTest_postponed')
- call delete('Xtext')
endfunc

" Run diff on two dumps with different size.
--- 544,549 ----
***************
*** 783,792 ****
func Test_terminal_cwd_failure()
" Case 1: Provided directory is not actually a directory. Attempt to make
" the file executable as well.
! call writefile([], 'Xtcfile')
call setfperm('Xtcfile', 'rwx------')
call assert_fails("call term_start(&shell, {'cwd': 'Xtcfile'})", 'E475:')
- call delete('Xtcfile')

" Case 2: Directory does not exist.
call assert_fails("call term_start(&shell, {'cwd': 'Xdir'})", 'E475:')
--- 778,786 ----
func Test_terminal_cwd_failure()
" Case 1: Provided directory is not actually a directory. Attempt to make
" the file executable as well.
! call writefile([], 'Xtcfile', 'D')
call setfperm('Xtcfile', 'rwx------')
call assert_fails("call term_start(&shell, {'cwd': 'Xtcfile'})", 'E475:')

" Case 2: Directory does not exist.
call assert_fails("call term_start(&shell, {'cwd': 'Xdir'})", 'E475:')
***************
*** 989,1002 ****
" this file name only works on Unix
CheckUnix

! call mkdir('Xdir with spaces')
call writefile(['x'], 'Xdir with spaces/quoted"file')
term ls Xdir\ with\ spaces/quoted\"file
call WaitForAssert({-> assert_match('quoted"file', term_getline('', 1))})
" make sure the job has finished
call WaitForAssert({-> assert_match('finish', term_getstatus(bufnr()))})

- call delete('Xdir with spaces', 'rf')
bwipe
endfunc

--- 983,995 ----
" this file name only works on Unix
CheckUnix

! call mkdir('Xdir with spaces', 'R')
call writefile(['x'], 'Xdir with spaces/quoted"file')
term ls Xdir\ with\ spaces/quoted\"file
call WaitForAssert({-> assert_match('quoted"file', term_getline('', 1))})
" make sure the job has finished
call WaitForAssert({-> assert_match('finish', term_getstatus(bufnr()))})

bwipe
endfunc

***************
*** 1040,1053 ****
bwipe

if has('unix')
! call writefile(['one line'], 'Xtrfile')
let buf = term_start('cat', {'in_io': 'file', 'in_name': 'Xtrfile'})
call TermWait(buf)
call WaitForAssert({-> assert_equal('one line', term_getline(buf, 1))})
let g:job = term_getjob(buf)
call WaitForAssert({-> assert_equal('dead', job_status(g:job))})
bwipe
- call delete('Xtrfile')
endif
endfunc

--- 1033,1045 ----
bwipe

if has('unix')
! call writefile(['one line'], 'Xtrfile', 'D')
let buf = term_start('cat', {'in_io': 'file', 'in_name': 'Xtrfile'})
call TermWait(buf)
call WaitForAssert({-> assert_equal('one line', term_getline(buf, 1))})
let g:job = term_getjob(buf)
call WaitForAssert({-> assert_equal('dead', job_status(g:job))})
bwipe
endif
endfunc

***************
*** 1279,1285 ****
au FocusLost * call setline(1, 'I am lost') | set nomod
au FocusGained * call setline(1, 'I am back') | set nomod
END
! call writefile(lines, 'XtermFocus')
let buf = RunVimInTerminal('-S XtermFocus', #{rows: 6})

" Send a focus event to ourselves, it should be forwarded to the terminal
--- 1271,1277 ----
au FocusLost * call setline(1, 'I am lost') | set nomod
au FocusGained * call setline(1, 'I am back') | set nomod
END
! call writefile(lines, 'XtermFocus', 'D')
let buf = RunVimInTerminal('-S XtermFocus', #{rows: 6})

" Send a focus event to ourselves, it should be forwarded to the terminal
***************
*** 1297,1303 ****
call term_sendkeys(buf, "\<Esc>")

call StopVimInTerminal(buf)
- call delete('XtermFocus')
let &term = save_term
let &ttymouse = save_ttymouse
endfunc
--- 1289,1294 ----
***************
*** 1399,1405 ****
close
call win_gotoid(termid)
END
! call writefile(lines, 'XtermExit')
let buf = RunVimInTerminal('-S XtermExit', #{rows: 10})
let job = term_getjob(buf)
call WaitForAssert({-> assert_equal("run", job_status(job))})
--- 1390,1396 ----
close
call win_gotoid(termid)
END
! call writefile(lines, 'XtermExit', 'D')
let buf = RunVimInTerminal('-S XtermExit', #{rows: 10})
let job = term_getjob(buf)
call WaitForAssert({-> assert_equal("run", job_status(job))})
***************
*** 1407,1414 ****
" quit the shell, it will make Vim exit
call term_sendkeys(buf, "exit\<CR>")
call WaitForAssert({-> assert_equal("dead", job_status(job))})
-
- call delete('XtermExit')
endfunc

func Test_terminal_open_autocmd()
--- 1398,1403 ----
***************
*** 1455,1461 ****
set incsearch
cnoremap <F3> <Cmd>call term_start(['/bin/sh', '-c', ':'])<CR>
END
! call writefile(lines, 'Xopenterm')
let buf = RunVimInTerminal('-S Xopenterm', {})

" this opens a window, incsearch should not use the old cursor position
--- 1444,1450 ----
set incsearch
cnoremap <F3> <Cmd>call term_start(['/bin/sh', '-c', ':'])<CR>
END
! call writefile(lines, 'Xopenterm', 'D')
let buf = RunVimInTerminal('-S Xopenterm', {})

" this opens a window, incsearch should not use the old cursor position
***************
*** 1465,1482 ****
call term_sendkeys(buf, ":q\<CR>")

call StopVimInTerminal(buf)
- call delete('Xopenterm')
endfunc

func Test_combining_double_width()
CheckUnix
CheckRunVimInTerminal

! call writefile(["\xe3\x83\x9b\xe3\x82\x9a"], 'Xonedouble')
let lines =<< trim END
call term_start(['/bin/sh', '-c', 'cat Xonedouble'])
END
! call writefile(lines, 'Xcombining')
let buf = RunVimInTerminal('-S Xcombining', #{rows: 9})

" this opens a window, incsearch should not use the old cursor position
--- 1454,1470 ----
call term_sendkeys(buf, ":q\<CR>")

call StopVimInTerminal(buf)
endfunc

func Test_combining_double_width()
CheckUnix
CheckRunVimInTerminal

! call writefile(["\xe3\x83\x9b\xe3\x82\x9a"], 'Xonedouble', 'D')
let lines =<< trim END
call term_start(['/bin/sh', '-c', 'cat Xonedouble'])
END
! call writefile(lines, 'Xcombining', 'D')
let buf = RunVimInTerminal('-S Xcombining', #{rows: 9})

" this opens a window, incsearch should not use the old cursor position
***************
*** 1484,1491 ****
call term_sendkeys(buf, ":q\<CR>")

call StopVimInTerminal(buf)
- call delete('Xonedouble')
- call delete('Xcombining')
endfunc

func Test_terminal_popup_with_cmd()
--- 1472,1477 ----
***************
*** 1531,1537 ****

call term_sendkeys(termbuf, "echo 'test'")
END
! call writefile(lines, 'XpopupScript')
let buf = RunVimInTerminal('-S XpopupScript', {})

" typed text appears both in normal window and in popup
--- 1517,1523 ----

call term_sendkeys(termbuf, "echo 'test'")
END
! call writefile(lines, 'XpopupScript', 'D')
let buf = RunVimInTerminal('-S XpopupScript', {})

" typed text appears both in normal window and in popup
***************
*** 1542,1548 ****
call TermWait(buf)
call term_sendkeys(buf, ":q\<CR>")
call StopVimInTerminal(buf)
- call delete('XpopupScript')
endfunc

func Test_terminal_popup_insert_cmd()
--- 1528,1533 ----
***************
*** 1576,1582 ****
call assert_equal(1, winnr('$'))

let text = " a\u0300 e\u0302 o\u0308"
! call writefile([text], 'Xcomposing')
let buf = RunVimInTerminal('--cmd "set encoding=utf-8" Xcomposing', {})
call WaitForAssert({-> assert_match(text, term_getline(buf, 1))})
eval 'Xdump'->term_dumpwrite(buf)
--- 1561,1567 ----
call assert_equal(1, winnr('$'))

let text = " a\u0300 e\u0302 o\u0308"
! call writefile([text], 'Xcomposing', 'D')
let buf = RunVimInTerminal('--cmd "set encoding=utf-8" Xcomposing', {})
call WaitForAssert({-> assert_match(text, term_getline(buf, 1))})
eval 'Xdump'->term_dumpwrite(buf)
***************
*** 1584,1590 ****
call assert_match('|à| |ê| |ö', dumpline)

call StopVimInTerminal(buf)
- call delete('Xcomposing')
call delete('Xdump')
let &encoding = save_enc
endfunc
--- 1569,1574 ----
***************
*** 1647,1658 ****
let lines =<< trim END
call term_dumpload('dumps/Test_popupwin_22.dump', #{term_rows: 12})
END
! call writefile(lines, 'XtermDumpload')
let buf = RunVimInTerminal('-S XtermDumpload', #{rows: 15})
call VerifyScreenDump(buf, 'Test_terminal_dumpload', {})

call StopVimInTerminal(buf)
- call delete('XtermDumpload')
endfunc

func Test_terminal_dumpdiff()
--- 1631,1641 ----
let lines =<< trim END
call term_dumpload('dumps/Test_popupwin_22.dump', #{term_rows: 12})
END
! call writefile(lines, 'XtermDumpload', 'D')
let buf = RunVimInTerminal('-S XtermDumpload', #{rows: 15})
call VerifyScreenDump(buf, 'Test_terminal_dumpload', {})

call StopVimInTerminal(buf)
endfunc

func Test_terminal_dumpdiff()
***************
*** 1667,1675 ****

call assert_fails('call term_dumpdiff("X1.dump", [])', 'E730:')
call assert_fails('call term_dumpdiff("X1.dump", "X2.dump")', 'E485:')
! call writefile([], 'X1.dump')
call assert_fails('call term_dumpdiff("X1.dump", "X2.dump")', 'E485:')
- call delete('X1.dump')
endfunc

func Test_terminal_dumpdiff_swap()
--- 1650,1657 ----

call assert_fails('call term_dumpdiff("X1.dump", [])', 'E730:')
call assert_fails('call term_dumpdiff("X1.dump", "X2.dump")', 'E485:')
! call writefile([], 'X1.dump', 'D')
call assert_fails('call term_dumpdiff("X1.dump", "X2.dump")', 'E485:')
endfunc

func Test_terminal_dumpdiff_swap()
***************
*** 1766,1772 ****
CheckFeature timers

" Open a terminal window from a timer, typed text goes to the terminal
! call writefile(["call timer_start(100, { -> term_start('sh') })"], 'XtimerTerm')
let buf = RunVimInTerminal('-S XtimerTerm', {})
call CheckTerminalWindowWorks(buf)

--- 1748,1754 ----
CheckFeature timers

" Open a terminal window from a timer, typed text goes to the terminal
! call writefile(["call timer_start(100, { -> term_start('sh') })"], 'XtimerTerm', 'D')
let buf = RunVimInTerminal('-S XtimerTerm', {})
call CheckTerminalWindowWorks(buf)

***************
*** 1775,1781 ****
call CheckTerminalWindowWorks(buf)

call StopVimInTerminal(buf)
- call delete('XtimerTerm')
endfunc

func Test_terminal_window_focus()
--- 1757,1762 ----
***************
*** 1923,1935 ****
\ 'let &titlestring = ''["drop","Xtextfile"]''',
\ 'redraw',
\ "set t_ts=",
! \ ], 'Xscript')
let buf = RunVimInTerminal('-S Xscript', {'rows': 10})
call WaitForAssert({-> assert_equal('Xtextfile', expand('%:t'))})
call assert_equal(textfile_winid, win_getid())

call StopVimInTerminal(buf)
- call delete('Xscript')
bwipe Xtextfile
endfunc

--- 1904,1915 ----
\ 'let &titlestring = ''["drop","Xtextfile"]''',
\ 'redraw',
\ "set t_ts=",
! \ ], 'Xscript', 'D')
let buf = RunVimInTerminal('-S Xscript', {'rows': 10})
call WaitForAssert({-> assert_equal('Xtextfile', expand('%:t'))})
call assert_equal(textfile_winid, win_getid())

call StopVimInTerminal(buf)
bwipe Xtextfile
endfunc

***************
*** 2261,2273 ****
\ 'call matchadd("TgreenBold", "Y")',
\ 'call matchadd("TmagentaBold", "Z")',
\ 'redraw',
! \ ], 'Xcolorscript')
let buf = RunVimInTerminal('-S Xcolorscript', {'rows': 10})
call VerifyScreenDump(buf, 'Test_terminal_all_ansi_colors', {})

call term_sendkeys(buf, ":q\<CR>")
call StopVimInTerminal(buf)
- call delete('Xcolorscript')
endfunc

function On_BufFilePost()
--- 2241,2252 ----
\ 'call matchadd("TgreenBold", "Y")',
\ 'call matchadd("TmagentaBold", "Z")',
\ 'redraw',
! \ ], 'Xcolorscript', 'D')
let buf = RunVimInTerminal('-S Xcolorscript', {'rows': 10})
call VerifyScreenDump(buf, 'Test_terminal_all_ansi_colors', {})

call term_sendkeys(buf, ":q\<CR>")
call StopVimInTerminal(buf)
endfunc

function On_BufFilePost()
*** ../vim-9.0.0766/src/testdir/test_terminal2.vim 2022-09-02 21:55:45.507049444 +0100
--- src/testdir/test_terminal2.vim 2022-10-15 20:44:17.360226342 +0100
***************
*** 19,25 ****
for n in range(10)
call add(text, repeat(n, 50))
endfor
! call writefile(text, 'Xwinsize')
let buf = RunVimInTerminal('Xwinsize', {})
let win = bufwinid(buf)
call assert_equal([6, 40], term_getsize(buf))
--- 19,25 ----
for n in range(10)
call add(text, repeat(n, 50))
endfor
! call writefile(text, 'Xwinsize', 'D')
let buf = RunVimInTerminal('Xwinsize', {})
let win = bufwinid(buf)
call assert_equal([6, 40], term_getsize(buf))
***************
*** 34,40 ****
call assert_equal(60, winwidth(win))

call StopVimInTerminal(buf)
- call delete('Xwinsize')

call assert_fails('set termwinsize=40', 'E474:')
call assert_fails('set termwinsize=10+40', 'E474:')
--- 34,39 ----
***************
*** 192,198 ****
\ '#!/bin/sh',
\ 'echo "this is standard error" >&2',
\ 'echo "this is standard out" >&1',
! \ ], 'Xechoerrout.sh')
call setfperm('Xechoerrout.sh', 'rwxrwx---')

let outfile = 'Xtermstdout'
--- 191,197 ----
\ '#!/bin/sh',
\ 'echo "this is standard error" >&2',
\ 'echo "this is standard out" >&1',
! \ ], 'Xechoerrout.sh', 'D')
call setfperm('Xechoerrout.sh', 'rwxrwx---')

let outfile = 'Xtermstdout'
***************
*** 204,210 ****

call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))})
exe buf . 'bwipe'
- call delete('Xechoerrout.sh')
call delete(outfile)
endfunc

--- 203,208 ----
***************
*** 290,325 ****
unlet g:job
endfunc

! " TODO: re-enable when this no longer hangs on Travis
! "func Test_zz2_terminal_guioptions_bang()
! " CheckGui
! " set guioptions+=!
! "
! " let filename = 'Xtestscript'
! " if has('win32')
! " let filename .= '.bat'
! " let prefix = ''
! " let contents = ['@echo off', 'exit %1']
! " else
! " let filename .= '.sh'
! " let prefix = './'
! " let contents = ['#!/bin/sh', 'exit $1']
! " endif
! " call writefile(contents, filename)
! " call setfperm(filename, 'rwxrwx---')
! "
! " " Check if v:shell_error is equal to the exit status.
! " let exitval = 0
! " execute printf(':!%s%s %d', prefix, filename, exitval)
! " call assert_equal(exitval, v:shell_error)
! "
! " let exitval = 9
! " execute printf(':!%s%s %d', prefix, filename, exitval)
! " call assert_equal(exitval, v:shell_error)
! "
! " set guioptions&
! " call delete(filename)
! "endfunc

func Test_terminal_hidden()
CheckUnix
--- 288,321 ----
unlet g:job
endfunc

! func Test_zz2_terminal_guioptions_bang()
! CheckGui
! set guioptions+=!
!
! let filename = 'Xtestscript'
! if has('win32')
! let filename .= '.bat'
! let prefix = ''
! let contents = ['@echo off', 'exit %1']
! else
! let filename .= '.sh'
! let prefix = './'
! let contents = ['#!/bin/sh', 'exit $1']
! endif
! call writefile(contents, filename, 'D')
! call setfperm(filename, 'rwxrwx---')
!
! " Check if v:shell_error is equal to the exit status.
! let exitval = 0
! execute printf(':!%s%s %d', prefix, filename, exitval)
! call assert_equal(exitval, v:shell_error)
!
! let exitval = 9
! execute printf(':!%s%s %d', prefix, filename, exitval)
! call assert_equal(exitval, v:shell_error)
!
! set guioptions&
! endfunc

func Test_terminal_hidden()
CheckUnix
***************
*** 372,378 ****
call setline(1, range(11111, 11122))
3
END
! call writefile(lines, 'XtermNormal')
let buf = RunVimInTerminal('-S XtermNormal', {'rows': 8})
call TermWait(buf)

--- 368,374 ----
call setline(1, range(11111, 11122))
3
END
! call writefile(lines, 'XtermNormal', 'D')
let buf = RunVimInTerminal('-S XtermNormal', {'rows': 8})
call TermWait(buf)

***************
*** 389,395 ****
call assert_fails('call term_sendkeys(buf, [])', 'E730:')
call term_sendkeys(buf, "a:q!\<CR>:q\<CR>:q\<CR>")
call StopVimInTerminal(buf)
- call delete('XtermNormal')
endfunc

func Test_terminal_hidden_and_close()
--- 385,390 ----
***************
*** 415,421 ****
\ ]

for c in contents
! call writefile(c, 'Xdntfile')
if has('win32')
term cmd /c type Xdntfile
else
--- 410,416 ----
\ ]

for c in contents
! call writefile(c, 'Xdntfile', 'D')
if has('win32')
term cmd /c type Xdntfile
else
***************
*** 428,435 ****
call assert_equal(c, getline(1, line('$')))
quit
endfor
-
- call delete('Xdntfile')
endfunc

func GetDummyCmd()
--- 423,428 ----
*** ../vim-9.0.0766/src/testdir/test_terminal3.vim 2022-04-23 14:03:50.000000000 +0100
--- src/testdir/test_terminal3.vim 2022-10-15 20:46:26.103863282 +0100
***************
*** 18,24 ****
let cmd = "cat Xtext\<CR>"

let buf = term_start(&shell, {})
! call writefile(["\<Esc>[?1047h"], 'Xtext')
call term_sendkeys(buf, cmd)
call WaitForAssert({-> assert_equal(1, term_getaltscreen(buf))})

--- 18,24 ----
let cmd = "cat Xtext\<CR>"

let buf = term_start(&shell, {})
! call writefile(["\<Esc>[?1047h"], 'Xtext', 'D')
call term_sendkeys(buf, cmd)
call WaitForAssert({-> assert_equal(1, term_getaltscreen(buf))})

***************
*** 28,34 ****

call term_sendkeys(buf, "exit\r")
exe buf . "bwipe!"
- call delete('Xtext')
endfunc

func Test_terminal_shell_option()
--- 28,33 ----
***************
*** 79,85 ****
\ ] + a:open_cmds + [
\ 'endfunc',
\ ] + a:highlight_cmds
! call writefile(lines, 'XtermStart')
let buf = RunVimInTerminal('-S XtermStart', #{rows: 15})
call TermWait(buf, 100)
call term_sendkeys(buf, ":call OpenTerm()\<CR>")
--- 78,84 ----
\ ] + a:open_cmds + [
\ 'endfunc',
\ ] + a:highlight_cmds
! call writefile(lines, 'XtermStart', 'D')
let buf = RunVimInTerminal('-S XtermStart', #{rows: 15})
call TermWait(buf, 100)
call term_sendkeys(buf, ":call OpenTerm()\<CR>")
***************
*** 90,96 ****
call term_sendkeys(buf, "\<C-D>")
call TermWait(buf, 50)
call StopVimInTerminal(buf)
- call delete('XtermStart')
endfunc

func Test_terminal_color_Terminal()
--- 89,94 ----
***************
*** 143,149 ****
\ 'highlight MyWinCol ctermfg=red ctermbg=darkyellow',
\ 'highlight MyWinCol2 ctermfg=black ctermbg=blue',
\ ]
! call writefile(lines, 'XtermStart')
let buf = RunVimInTerminal('-S XtermStart', #{rows: 15})
call TermWait(buf, 100)
call term_sendkeys(buf, ":call OpenTerm()\<CR>")
--- 141,147 ----
\ 'highlight MyWinCol ctermfg=red ctermbg=darkyellow',
\ 'highlight MyWinCol2 ctermfg=black ctermbg=blue',
\ ]
! call writefile(lines, 'XtermStart', 'D')
let buf = RunVimInTerminal('-S XtermStart', #{rows: 15})
call TermWait(buf, 100)
call term_sendkeys(buf, ":call OpenTerm()\<CR>")
***************
*** 162,168 ****
call term_sendkeys(buf, "\<C-D>")
call TermWait(buf, 50)
call StopVimInTerminal(buf)
- call delete('XtermStart')
endfunc

func Test_terminal_color_transp_Terminal()
--- 160,165 ----
***************
*** 245,251 ****
to edit
in a popup window
END
! call writefile(text, 'Xtext')
let cmd = GetVimCommandCleanTerm()
let lines = [
\ 'call setline(1, range(20))',
--- 242,248 ----
to edit
in a popup window
END
! call writefile(text, 'Xtext', 'D')
let cmd = GetVimCommandCleanTerm()
let lines = [
\ 'call setline(1, range(20))',
***************
*** 268,274 ****
\ ' call popup_create(s:buf, #{minwidth: 40, minheight: 6, border: []})',
\ 'endfunc',
\ ]
! call writefile(lines, 'XtermPopup')
let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15})
call TermWait(buf, 100)
call term_sendkeys(buf, ":call OpenTerm(0)\<CR>")
--- 265,271 ----
\ ' call popup_create(s:buf, #{minwidth: 40, minheight: 6, border: []})',
\ 'endfunc',
\ ]
! call writefile(lines, 'XtermPopup', 'D')
let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15})
call TermWait(buf, 100)
call term_sendkeys(buf, ":call OpenTerm(0)\<CR>")
***************
*** 312,319 ****
call TermWait(buf, 250) " wait for terminal to vanish

call StopVimInTerminal(buf)
- call delete('Xtext')
- call delete('XtermPopup')
endfunc

" Check a terminal in popup window uses the default minimum size.
--- 309,314 ----
***************
*** 325,331 ****
to show
in a popup window
END
! call writefile(text, 'Xtext')
let lines = [
\ 'call setline(1, range(20))',
\ 'func OpenTerm()',
--- 320,326 ----
to show
in a popup window
END
! call writefile(text, 'Xtext', 'D')
let lines = [
\ 'call setline(1, range(20))',
\ 'func OpenTerm()',
***************
*** 333,339 ****
\ ' let g:winid = popup_create(s:buf, #{ border: []})',
\ 'endfunc',
\ ]
! call writefile(lines, 'XtermPopup')
let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15})
call TermWait(buf, 100)
call term_sendkeys(buf, ":set noruler\<CR>")
--- 328,334 ----
\ ' let g:winid = popup_create(s:buf, #{ border: []})',
\ 'endfunc',
\ ]
! call writefile(lines, 'XtermPopup', 'D')
let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15})
call TermWait(buf, 100)
call term_sendkeys(buf, ":set noruler\<CR>")
***************
*** 346,353 ****
call term_sendkeys(buf, ":q\<CR>")
call TermWait(buf, 50) " wait for terminal to vanish
call StopVimInTerminal(buf)
- call delete('Xtext')
- call delete('XtermPopup')
endfunc

" Check a terminal in popup window with different colors
--- 341,346 ----
***************
*** 365,371 ****
\ ] + a:popup_cmds + [
\ 'endfunc',
\ ] + a:highlight_cmds
! call writefile(lines, 'XtermPopup')
let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15})
call TermWait(buf, 100)
call term_sendkeys(buf, ":set noruler\<CR>")
--- 358,364 ----
\ ] + a:popup_cmds + [
\ 'endfunc',
\ ] + a:highlight_cmds
! call writefile(lines, 'XtermPopup', 'D')
let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15})
call TermWait(buf, 100)
call term_sendkeys(buf, ":set noruler\<CR>")
***************
*** 379,385 ****
call term_sendkeys(buf, ":q\<CR>")
call TermWait(buf, 50) " wait for terminal to vanish
call StopVimInTerminal(buf)
- call delete('XtermPopup')
endfunc

func Test_terminal_in_popup_color_Terminal()
--- 372,377 ----
***************
*** 582,588 ****
term
startinsert
EOL
! call writefile(lines, 'XTest_startinsert')
let buf = RunVimInTerminal('-S XTest_startinsert', {})

call term_sendkeys(buf, "exit\r")
--- 574,580 ----
term
startinsert
EOL
! call writefile(lines, 'XTest_startinsert', 'D')
let buf = RunVimInTerminal('-S XTest_startinsert', {})

call term_sendkeys(buf, "exit\r")
***************
*** 592,598 ****
call WaitForAssert({-> assert_equal("some text<", term_getline(buf, 1))})

call StopVimInTerminal(buf)
- call delete('XTest_startinsert')
endfunc

" Test for passing invalid arguments to terminal functions
--- 584,589 ----
***************
*** 683,689 ****
red green yellow red blue
vim emacs sublime nano
END
! call writefile(lines, 'Xtest_mouse')

" Create a terminal window running Vim for the test with mouse enabled
let prev_win = win_getid()
--- 674,680 ----
red green yellow red blue
vim emacs sublime nano
END
! call writefile(lines, 'Xtest_mouse', 'D')

" Create a terminal window running Vim for the test with mouse enabled
let prev_win = win_getid()
***************
*** 783,789 ****
let &ttymouse = save_ttymouse
let &clipboard = save_clipboard
set mousetime&
- call delete('Xtest_mouse')
call delete('Xbuf')
endfunc

--- 774,779 ----
***************
*** 836,842 ****
red green yellow red blue
vim emacs sublime nano
END
! call writefile(lines, 'Xtest_modeless')

" Create a terminal window running Vim for the test with mouse disabled
let prev_win = win_getid()
--- 826,832 ----
red green yellow red blue
vim emacs sublime nano
END
! call writefile(lines, 'Xtest_modeless', 'D')

" Create a terminal window running Vim for the test with mouse disabled
let prev_win = win_getid()
***************
*** 869,875 ****
let &term = save_term
let &ttymouse = save_ttymouse
set mousetime& clipboard&
- call delete('Xtest_modeless')
new | only!
endfunc

--- 859,864 ----
*** ../vim-9.0.0766/src/testdir/test_timers.vim 2022-10-07 11:20:24.038352636 +0100
--- src/testdir/test_timers.vim 2022-10-15 20:47:53.324555463 +0100
***************
*** 371,382 ****
\ ' normal 3j',
\ 'endfunc',
\ 'call timer_start(100, "Doit")',
! \ ], 'Xtrcscript')
call writefile([
\ '1-1234',
\ '2-1234',
\ '3-1234',
! \ ], 'Xtrctext')
let buf = RunVimInTerminal('-S Xtrcscript Xtrctext', {})

" Wait for the timer to move the cursor to the third line.
--- 371,382 ----
\ ' normal 3j',
\ 'endfunc',
\ 'call timer_start(100, "Doit")',
! \ ], 'Xtrcscript', 'D')
call writefile([
\ '1-1234',
\ '2-1234',
\ '3-1234',
! \ ], 'Xtrctext', 'D')
let buf = RunVimInTerminal('-S Xtrcscript Xtrctext', {})

" Wait for the timer to move the cursor to the third line.
***************
*** 387,394 ****
call WaitForAssert({-> assert_equal(2, term_getcursor(buf)[1])})

call StopVimInTerminal(buf)
- call delete('Xtrcscript')
- call delete('Xtrctext')
endfunc

" Test that the garbage collector isn't triggered if a timer callback invokes
--- 387,392 ----
***************
*** 438,444 ****
set updatetime=50
call timer_start(1, 'Func')
[CODE]
! call writefile(lines, 'Xtest.vim')

let buf = term_start(GetVimCommandCleanTerm() .. ' -S Xtest.vim', {'term_rows': 8})
let job = term_getjob(buf)
--- 436,442 ----
set updatetime=50
call timer_start(1, 'Func')
[CODE]
! call writefile(lines, 'Xtest.vim', 'D')

let buf = term_start(GetVimCommandCleanTerm() .. ' -S Xtest.vim', {'term_rows': 8})
let job = term_getjob(buf)
***************
*** 456,462 ****
call assert_equal('', job_info(job).termsig)
endif

- call delete('Xtest.vim')
exe buf .. 'bwipe!'
endfunc

--- 454,459 ----
***************
*** 485,491 ****
endfor
au CmdlineLeave : call timer_start(0, {-> 0})
END
! call writefile(lines, 'XTest_timerchange')
let buf = RunVimInTerminal('-S XTest_timerchange', #{rows: 10})
call term_sendkeys(buf, ":fu\<CR>")
call WaitForAssert({-> assert_match('-- More --', term_getline(buf, 10))})
--- 482,488 ----
endfor
au CmdlineLeave : call timer_start(0, {-> 0})
END
! call writefile(lines, 'XTest_timerchange', 'D')
let buf = RunVimInTerminal('-S XTest_timerchange', #{rows: 10})
call term_sendkeys(buf, ":fu\<CR>")
call WaitForAssert({-> assert_match('-- More --', term_getline(buf, 10))})
***************
*** 494,500 ****
call term_sendkeys(buf, "\<Esc>")

call StopVimInTerminal(buf)
- call delete('XTest_timerchange')
endfunc

func Test_timer_outputting_message()
--- 491,496 ----
***************
*** 508,514 ****
echon repeat('x', &columns - 11)
})
END
! call writefile(lines, 'XTest_timermessage')
let buf = RunVimInTerminal('-S XTest_timermessage', #{rows: 6})
call term_sendkeys(buf, "l")
call term_wait(buf)
--- 504,510 ----
echon repeat('x', &columns - 11)
})
END
! call writefile(lines, 'XTest_timermessage', 'D')
let buf = RunVimInTerminal('-S XTest_timermessage', #{rows: 6})
call term_sendkeys(buf, "l")
call term_wait(buf)
***************
*** 516,522 ****
call WaitForAssert({-> assert_match('xxxxxxxxxxx', term_getline(buf, 6))})

call StopVimInTerminal(buf)
- call delete('XTest_timermessage')
endfunc

func Test_timer_using_win_execute_undo_sync()
--- 512,517 ----
*** ../vim-9.0.0766/src/testdir/test_trycatch.vim 2022-09-24 17:24:07.099558755 +0100
--- src/testdir/test_trycatch.vim 2022-10-15 20:48:30.149101134 +0100
***************
*** 1975,1981 ****
endfunc

func Test_reload_in_try_catch()
! call writefile(['x'], 'Xreload')
set autoread
edit Xreload
tabnew
--- 1975,1981 ----
endfunc

func Test_reload_in_try_catch()
! call writefile(['x'], 'Xreload', 'D')
set autoread
edit Xreload
tabnew
***************
*** 1995,2001 ****
autocmd! ReLoad
set noautoread
bwipe! Xreload
- call delete('Xreload')
endfunc

" Test for errors with :catch, :throw, :finally {{{1
--- 1995,2000 ----
***************
*** 2306,2315 ****
call s:main()
call assert_equal('yes', s:caught)
END
! call writefile(lines, 'XtestThrow')
source XtestThrow
-
- call delete('XtestThrow')
endfunc

func ThisWillFail()
--- 2305,2312 ----
call s:main()
call assert_equal('yes', s:caught)
END
! call writefile(lines, 'XtestThrow', 'D')
source XtestThrow
endfunc

func ThisWillFail()
***************
*** 2325,2337 ****
for l in []
finally
END
! call writefile(lines, 'XtestCatchAndFinally')
try
source XtestCatchAndFinally
catch /E600:/
endtry
-
- call delete('XtestCatchAndFinally')
endfunc

" This was causing an illegal memory access
--- 2322,2332 ----
for l in []
finally
END
! call writefile(lines, 'XtestCatchAndFinally', 'D')
try
source XtestCatchAndFinally
catch /E600:/
endtry
endfunc

" This was causing an illegal memory access
***************
*** 2345,2357 ****
if
endtry
END
! call writefile(lines, 'XtestEndtry')
try
source XtestEndtry
catch /E171:/
endtry
-
- call delete('XtestEndtry')
endfunc

" Modeline {{{1
--- 2340,2350 ----
if
endtry
END
! call writefile(lines, 'XtestEndtry', 'D')
try
source XtestEndtry
catch /E171:/
endtry
endfunc

" Modeline {{{1
*** ../vim-9.0.0766/src/version.c 2022-10-15 20:06:30.284328833 +0100
--- src/version.c 2022-10-15 20:51:39.911354274 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 767,
/**/

--
ROBIN: (warily) And if you get a question wrong?
ARTHUR: You are cast into the Gorge of Eternal Peril.
ROBIN: Oh ... wacho!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages