Skip to content

Commit 6432971

Browse files
zzzyxwvutchrisbra
authored andcommitted
CI(screendump): Move an early-return test out of the loop
And express the established indentation style of the file in its modeline. related: #17704 Signed-off-by: Aliaksei Budavei <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 25ea224 commit 6432971

1 file changed

Lines changed: 17 additions & 19 deletions

File tree

src/testdir/util/screendump.vim

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ enddef
4646
" Returns non-zero when verification fails.
4747
func VerifyScreenDump(buf, filename, options, ...)
4848
if has('gui_running') && exists("g:check_screendump_called") && g:check_screendump_called == v:false
49-
echoerr "VerifyScreenDump() called from a test that lacks a CheckScreendump guard."
50-
return 1
49+
echoerr "VerifyScreenDump() called from a test that lacks a CheckScreendump guard."
50+
return 1
5151
endif
5252
let reference = 'dumps/' . a:filename . '.dump'
5353
let filter = 'dumps/' . a:filename . '.vim'
@@ -66,34 +66,30 @@ func VerifyScreenDump(buf, filename, options, ...)
6666
" text and attributes only from the internal buffer.
6767
redraw
6868

69-
if filereadable(reference)
70-
let refdump = ReadAndFilter(reference, filter)
71-
else
72-
" Must be a new screendump, always fail
73-
let refdump = []
74-
endif
75-
7669
let did_mkdir = 0
7770
if !isdirectory('failed')
7871
let did_mkdir = 1
7972
call mkdir('failed')
8073
endif
8174

75+
if !filereadable(reference)
76+
" Leave a bit of time for updating the original window while we spin wait.
77+
sleep 10m
78+
call delete(testfile)
79+
call term_dumpwrite(a:buf, testfile, a:options)
80+
call assert_report('See new dump file: call term_dumpload("testdir/' .. testfile .. '")')
81+
" No point in retrying.
82+
let g:run_nr = 10
83+
return 1
84+
endif
85+
86+
let refdump = ReadAndFilter(reference, filter)
8287
let i = 0
8388
while 1
84-
" leave a bit of time for updating the original window while we spin wait.
89+
" Leave a bit of time for updating the original window while we spin wait.
8590
sleep 1m
8691
call delete(testfile)
8792
call term_dumpwrite(a:buf, testfile, a:options)
88-
89-
if refdump->empty()
90-
let msg = 'See new dump file: call term_dumpload("testdir/' .. testfile .. '")'
91-
call assert_report(msg)
92-
" no point in retrying
93-
let g:run_nr = 10
94-
return 1
95-
endif
96-
9793
let testdump = ReadAndFilter(testfile, filter)
9894
if refdump == testdump
9995
call delete(testfile)
@@ -137,3 +133,5 @@ func VerifyScreenDump(buf, filename, options, ...)
137133
endwhile
138134
return 0
139135
endfunc
136+
137+
" vim:sw=2:ts=8:noet:

0 commit comments

Comments
 (0)