@@ -17,14 +17,18 @@ func CheckCWD()
1717endfunc
1818command ! -nargs =0 - bar CheckCWD call CheckCWD ()
1919
20+ " "options" argument can contain:
21+ " 'msec' - time to wait for a match
22+ " 'match' - "pattern" to use "lines" as pattern instead of text
2023func CheckDbgOutput (buf , lines , options = {})
2124 " Verify the expected output
2225 let lnum = 20 - len (a: lines )
26+ let msec = get (a: options , ' msec' , 1000 )
2327 for l in a: lines
2428 if get (a: options , ' match' , ' equal' ) == # ' pattern'
25- call WaitForAssert ({- > assert_match (l , term_getline (a: buf , lnum))}, 200 )
29+ call WaitForAssert ({- > assert_match (l , term_getline (a: buf , lnum))}, msec )
2630 else
27- call WaitForAssert ({- > assert_equal (l , term_getline (a: buf , lnum))}, 200 )
31+ call WaitForAssert ({- > assert_equal (l , term_getline (a: buf , lnum))}, msec )
2832 endif
2933 let lnum += 1
3034 endfor
@@ -198,7 +202,7 @@ func Test_Debugger()
198202
199203 " Start a debug session, so that reading the last line from the terminal
200204 " works properly.
201- call RunDbgCmd (buf , ' :debug echo Foo()' )
205+ call RunDbgCmd (buf , ' :debug echo Foo()' , [ ' cmd: echo Foo() ' ] )
202206
203207 " No breakpoints
204208 call RunDbgCmd (buf , ' breakl' , [' No breakpoints defined' ])
@@ -809,9 +813,10 @@ func Test_Backtrace_CmdLine()
809813 \ ' -S Xtest1.vim -c "debug call GlobalFunction()"' ,
810814 \ {' wait_for_ruler' : 0 })
811815
812- " Need to wait for the vim-in-terminal to be ready
816+ " Need to wait for the vim-in-terminal to be ready.
817+ " With valgrind this can take quite long.
813818 call CheckDbgOutput (buf , [' command line' ,
814- \ ' cmd: call GlobalFunction()' ])
819+ \ ' cmd: call GlobalFunction()' ], #{msec: 5000 } )
815820
816821 " At this point the ontly thing in the stack is the cmdline
817822 call RunDbgCmd (buf , ' backtrace' , [
@@ -960,14 +965,14 @@ func Test_debug_backtrace_level()
960965 " set a breakpoint and source file1.vim
961966 let buf = RunVimInTerminal (
962967 \ ' -c "breakadd file 1 Xtest1.vim" -S Xtest1.vim' ,
963- \ #{ wait_for_ruler: 0 } )
968+ \ #{wait_for_ruler: 0 } )
964969
965970 call CheckDbgOutput (buf , [
966971 \ ' Breakpoint in "' .. file1 .. ' " line 1' ,
967972 \ ' Entering Debug mode. Type "cont" to continue.' ,
968973 \ ' command line..script ' .. file1,
969974 \ ' line 1: let s:file1_var = '' file1'' '
970- \ ])
975+ \ ], #{msec: 5000 } )
971976
972977 " step throught the initial declarations
973978 call RunDbgCmd (buf , ' step' , [ ' line 2: let g:global_var = '' global'' ' ] )
0 commit comments