1
0
forked from aniani/vim

patch 9.1.0339: tests: xdg test uses screen dumps

Problem:  tests: xdg test uses screen dumps
Solution: Convert screen dump to normal test
          (Yegappan Lakshmanan)

closes: #14564

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yegappan Lakshmanan
2024-04-16 22:18:15 +02:00
committed by Christian Brabandt
parent 9a90179a11
commit 8560e6cf97
6 changed files with 58 additions and 132 deletions

View File

@@ -1,20 +0,0 @@
|~+0#4040ff13#ffffff0| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|r+0#0000000&|c|_|o|n|e| @16|o|n|e| @48
|r|c| @20|.|v|i|m|r|c| @45
|P+0#00e0003&|r|e|s@1| |E|N|T|E|R| |o|r| |t|y|p|e| |c|o|m@1|a|n|d| |t|o| |c|o|n|t|i|n|u|e> +0#0000000&@35

View File

@@ -1,20 +0,0 @@
|~+0#4040ff13#ffffff0| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|r+0#0000000&|c|_|t|w|o| @16|t|w|o| @48
|r|c| @20|.|v|i|m|/|v|i|m|r|c| @41
|P+0#00e0003&|r|e|s@1| |E|N|T|E|R| |o|r| |t|y|p|e| |c|o|m@1|a|n|d| |t|o| |c|o|n|t|i|n|u|e> +0#0000000&@35

View File

@@ -1,20 +0,0 @@
|~+0#4040ff13#ffffff0| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|r+0#0000000&|c|_|t|h|r|e@1| @14|t|h|r|e@1| @46
|r|c| @20|.|c|o|n|f|i|g|/|v|i|m|/|v|i|m|r|c| @34
|P+0#00e0003&|r|e|s@1| |E|N|T|E|R| |o|r| |t|y|p|e| |c|o|m@1|a|n|d| |t|o| |c|o|n|t|i|n|u|e> +0#0000000&@35

View File

@@ -1,20 +0,0 @@
|~+0#4040ff13#ffffff0| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|r+0#0000000&|c|_|f|o|u|r| @15|f|o|u|r| @47
|r|c| @20|x|d|g|/|v|i|m|/|v|i|m|r|c| @38
|P+0#00e0003&|r|e|s@1| |E|N|T|E|R| |o|r| |t|y|p|e| |c|o|m@1|a|n|d| |t|o| |c|o|n|t|i|n|u|e> +0#0000000&@35

View File

@@ -1,12 +1,9 @@
" Tests for the XDG feature " Tests for the XDG feature
source check.vim source check.vim
CheckFeature terminal
source shared.vim source shared.vim
source screendump.vim
source mouse.vim source mouse.vim
source term_util.vim
func s:get_rcs() func s:get_rcs()
let rcs = { let rcs = {
@@ -77,63 +74,70 @@ func Test_xdg_runtime_files()
call writefile(file3, rc3) call writefile(file3, rc3)
call writefile(file4, rc4) call writefile(file4, rc4)
let rows = 20 " Get the Vim command to run without the '-u NONE' argument
let buf = RunVimInTerminal('', #{rows: rows, no_clean: 1}) let vimcmd = substitute(GetVimCommand(), '-u NONE', '', '')
call TermWait(buf)
call term_sendkeys(buf, ":echo \$MYVIMRC[-30:]\<cr>") " Test for ~/.vimrc
call WaitForAssert({-> assert_match('XfakeHOME/\.vimrc', term_getline(buf, rows))}) let lines =<< trim END
call term_sendkeys(buf, ":call filter(g:, {idx, _ -> idx =~ '^rc'})\<cr>") call assert_match('XfakeHOME/\.vimrc', $MYVIMRC)
call TermWait(buf) call filter(g:, {idx, _ -> idx =~ '^rc'})
call term_sendkeys(buf, ":redraw!\<cr>") call assert_equal(#{rc_one: 'one', rc: '.vimrc'}, g:)
call TermWait(buf) call writefile(v:errors, 'Xresult')
call term_sendkeys(buf, ":let g:\<cr>") quit
call VerifyScreenDump(buf, 'Test_xdg_1', {}) END
call StopVimInTerminal(buf) call writefile(lines, 'Xscript', 'D')
call system($'{vimcmd} -S Xscript')
call assert_equal([], readfile('Xresult'))
call delete(rc1) call delete(rc1)
bw
let buf = RunVimInTerminal('', #{rows: rows, no_clean: 1}) " Test for ~/.vim/vimrc
call TermWait(buf) let lines =<< trim END
call term_sendkeys(buf, ":echo \$MYVIMRC[-30:]\<cr>") call assert_match('XfakeHOME/\.vim/vimrc', $MYVIMRC)
call WaitForAssert({-> assert_match('XfakeHOME/\.vim/vimrc', term_getline(buf, rows))}) call filter(g:, {idx, _ -> idx =~ '^rc'})
call term_sendkeys(buf, ":call filter(g:, {idx, _ -> idx =~ '^rc'})\<cr>") call assert_equal(#{rc_two: 'two', rc: '.vim/vimrc'}, g:)
call TermWait(buf) call writefile(v:errors, 'Xresult')
call term_sendkeys(buf, ":redraw!\<cr>") quit
call TermWait(buf) END
call term_sendkeys(buf, ":let g:\<cr>") call writefile(lines, 'Xscript', 'D')
call VerifyScreenDump(buf, 'Test_xdg_2', {}) call system($'{vimcmd} -S Xscript')
call StopVimInTerminal(buf) call assert_equal([], readfile('Xresult'))
call delete(rc2) call delete(rc2)
bw
let buf = RunVimInTerminal('', #{rows: rows, no_clean: 1}) " XDG_CONFIG_HOME is set in Github CI runners
call TermWait(buf) unlet $XDG_CONFIG_HOME
call term_sendkeys(buf, ":echo \$MYVIMRC[-30:]\<cr>")
call WaitForAssert({-> assert_match('XfakeHOME/\.config/vim/vimrc', term_getline(buf, rows))}) " Test for ~/.config/vim/vimrc
call term_sendkeys(buf, ":call filter(g:, {idx, _ -> idx =~ '^rc'})\<cr>") let lines =<< trim END
call TermWait(buf) let msg = $'HOME="{$HOME}", ~="{expand("~")}"'
call term_sendkeys(buf, ":redraw!\<cr>") call assert_match('XfakeHOME/\.config/vim/vimrc', $MYVIMRC, msg)
call TermWait(buf) call filter(g:, {idx, _ -> idx =~ '^rc'})
call term_sendkeys(buf, ":let g:\<cr>") call assert_equal(#{rc_three: 'three', rc: '.config/vim/vimrc'}, g:)
call VerifyScreenDump(buf, 'Test_xdg_3', {}) call writefile(v:errors, 'Xresult')
call StopVimInTerminal(buf) quit
END
call writefile(lines, 'Xscript', 'D')
call system($'{vimcmd} -S Xscript')
call assert_equal([], readfile('Xresult'))
call delete(rc3) call delete(rc3)
bw
" Test for ~/xdg/vim/vimrc
let $XDG_CONFIG_HOME=expand('~/xdg/') let $XDG_CONFIG_HOME=expand('~/xdg/')
let buf = RunVimInTerminal('', #{rows: rows, no_clean: 1}) let lines =<< trim END
call TermWait(buf) let msg = $'HOME="{$HOME}", XDG_CONFIG_HOME="{$XDG_CONFIG_HOME}"'
call term_sendkeys(buf, ":redraw!\<cr>") call assert_match('XfakeHOME/xdg/vim/vimrc', $MYVIMRC, msg)
call TermWait(buf) call filter(g:, {idx, _ -> idx =~ '^rc'})
call term_sendkeys(buf, ":echo \$MYVIMRC[-30:]\<cr>") call assert_equal(#{rc_four: 'four', rc: 'xdg/vim/vimrc'}, g:)
call WaitForAssert({-> assert_match('XfakeHOME/xdg/vim/vimrc', term_getline(buf, rows))}) call writefile(v:errors, 'Xresult')
call term_sendkeys(buf, ":call filter(g:, {idx, _ -> idx =~ '^rc'})\<cr>") quit
call TermWait(buf) END
call term_sendkeys(buf, ":let g:\<cr>") call writefile(lines, 'Xscript', 'D')
call VerifyScreenDump(buf, 'Test_xdg_4', {}) call system($'{vimcmd} -S Xscript')
call StopVimInTerminal(buf) call assert_equal([], readfile('Xresult'))
call delete(rc4) call delete(rc4)
bw
unlet $XDG_CONFIG_HOME unlet $XDG_CONFIG_HOME
endfunc endfunc

View File

@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
339,
/**/ /**/
338, 338,
/**/ /**/