assert_equal(411, n)
enddef
+def Test_cnext_works_in_catch()
+ var lines =<< trim END
+ vim9script
+ au BufEnter * eval 0
+ writefile(['text'], 'Xfile1')
+ writefile(['text'], 'Xfile2')
+ var items = [
+ {lnum: 1, filename: 'Xfile1', valid: true},
+ {lnum: 1, filename: 'Xfile2', valid: true}
+ ]
+ setqflist([], ' ', {items: items})
+ cwindow
+
+ def CnextOrCfirst()
+ # if cnext fails, cfirst is used
+ try
+ cnext
+ catch
+ cfirst
+ endtry
+ enddef
+
+ CnextOrCfirst()
+ CnextOrCfirst()
+ writefile([getqflist({idx: 0}).idx], 'Xresult')
+ qall
+ END
+ writefile(lines, 'XCatchCnext')
+ RunVim([], [], '--clean -S XCatchCnext')
+ assert_equal(['1'], readfile('Xresult'))
+
+ delete('Xfile1')
+ delete('Xfile2')
+ delete('XCatchCnext')
+ delete('Xresult')
+enddef
+
def Test_throw_skipped()
if 0
throw dontgethere
trycmd->tcd_caught = TRUE;
}
did_emsg = got_int = did_throw = FALSE;
+ force_abort = need_rethrow = FALSE;
catch_exception(current_exception);
}
break;